From c8222d3f17a55df98222cddf2dfc0c8e9ce947f8 Mon Sep 17 00:00:00 2001 From: dungdq Date: Fri, 11 Jul 2025 17:34:52 +0700 Subject: [PATCH] add doc spin api --- api-doc/controllers/spin/_category_.json | 18 +++ api-doc/controllers/spin/spin-controller.md | 134 ++++++++++++++++++++ api-doc/controllers/spin/spin-model.md | 114 +++++++++++++++++ api-doc/controllers/spin/spin-view.md | 14 ++ 4 files changed, 280 insertions(+) create mode 100644 api-doc/controllers/spin/_category_.json create mode 100644 api-doc/controllers/spin/spin-controller.md create mode 100644 api-doc/controllers/spin/spin-model.md create mode 100644 api-doc/controllers/spin/spin-view.md diff --git a/api-doc/controllers/spin/_category_.json b/api-doc/controllers/spin/_category_.json new file mode 100644 index 0000000..f7be141 --- /dev/null +++ b/api-doc/controllers/spin/_category_.json @@ -0,0 +1,18 @@ +{ + "position": 3, + "label": "Spin", + "collapsible": true, + "collapsed": true, + "link": { + "type": "generated-index", + "title": "Spin", + "description": "This section will guide you through the process of setting up a new project, including creating a new repository and configuring your development environment.", + "keywords": [ + "controller", + "project", + "repository", + "model", + "spin" + ] + } +} \ No newline at end of file diff --git a/api-doc/controllers/spin/spin-controller.md b/api-doc/controllers/spin/spin-controller.md new file mode 100644 index 0000000..de1413d --- /dev/null +++ b/api-doc/controllers/spin/spin-controller.md @@ -0,0 +1,134 @@ +--- +sidebar_position: 1 +--- + +# Spin Controller + +## Index + +### Properties + +* [savedBetPoint](#savedbetpoint) `Number` Current played bet. +* [savedTotalBetPoint](#savedtotalbetpoint) `Number` Current total played bet. +* [isPaused](#ispaused) `Boolean` Indicates if the game is currently paused, including when paused by lobby force. +* [waiter](#waiter) `object ` Waits until not paused. + +### Methods + +* [_start](#_start) Starts a spin round. Prepares spin data, handles game round confirmation, and waits until the game is not paused before sending a spin request. +* [_complete](#_complete) Completes the spin round and stops any waiting processes. +* [onBetDataChanged](#onbetdatachanged) Updates internal bet tracking based on input data. +* [onNextScrollDataReceived](#onnextscrolldatareceived) Updates the model with new scroll data received from the network. +* [onStopSpinClicked](#onstopspinclicked) Notifies listeners when the stop spin button is clicked. + +> + +## Details + +### Properties + +#### savedbetpoint + +>

Current played bet.

+ +| meta | description | +| :--- | :---------- | +| Type | [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | +| Defined in | [p4f-slotty-core/src/controller/spin-controller.js#L14](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/spin-controller.js#L14)| + +#### savedTotalBetPoint + +>

Current total played bet.

+ +| meta | description | +| :--- | :---------- | +| Type | [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | +| Defined in | [p4f-slotty-core/src/controller/spin-controller.js#L15](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/spin-controller.js#L15)| + +#### isPaused + +>

Indicates if the game is currently paused, including when paused by lobby force.

+ +| meta | description | +| :--- | :---------- | +| Type | [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | +| Defined in | [p4f-slotty-core/src/controller/spin-controller.js#L16](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/spin-controller.js#L16)| + +#### waiter + +>

Waits until not paused.

+ +| meta | description | +| :--- | :---------- | +| Type | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| null | +| Defined in | [p4f-slotty-core/src/controller/spin-controller.js#L17](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/spin-controller.js#L17)| + +### Methods + +#### _start + +Starts a spin round. Prepares spin data, handles game round confirmation, and waits until the game is not paused before sending a spin request. + +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/spin-controller.js#L32](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/spin-controller.js#L32)| + +

+ + **Parameters** + * `data` [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + * `betPoint` [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) + * `totalBetPoint` [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) + * `isFreeSpin` [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) + * `freeroundsID` [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) +

+ +#### _complete + +Completes the spin round and stops any waiting processes. + +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/spin-controller.js#L68](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/spin-controller.js#L68)| + + +#### onBetDataChanged + +> Updates internal bet tracking based on input data. + +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/spin-controller.js#L77](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/spin-controller.js#L77)| + +

+ + **Parameters** + * `data` [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) + + * `betPoint` [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number). + * `totalBetPoint` [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number). +

+ +#### onNextScrollDataReceived + +Updates the model with the new scroll data received from the network. + +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/spin-controller.js#L83](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/spin-controller.js#L83)| + +

+ + **Parameters** + * `data` [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) +

+ +#### onStopSpinClicked + +Notifies listeners when the stop spin button is clicked. + +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/spin-controller.js#L89](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/spin-controller.js#L89)| + diff --git a/api-doc/controllers/spin/spin-model.md b/api-doc/controllers/spin/spin-model.md new file mode 100644 index 0000000..008bca0 --- /dev/null +++ b/api-doc/controllers/spin/spin-model.md @@ -0,0 +1,114 @@ +--- +sidebar_position: 2 +--- + +# Spin model + +## Index + +### Properties + +* [nextScrollData](#nextscrolldata) `Object` Stores the next scroll data +* [betPoint](#betpoint) `Number` Stores the current bet point. +* [totalBetPoint](#totalbetpoint) `Number` Stores the total bet point. + +### Methods + +* [SetBetPoint](#setbetpoint) Sets the bet point value. +* [GetBetPoint](#getbetpoint) Gets the current bet point value. +* [SetTotalBetPoint](#settotalbetpoint) Sets the total bet point value. +* [GetTotalBetPoint](#gettotalbetpoint) Gets the current total bet point value. +* [SetNextScrollData](#setnextscrolldata) Sets the next scroll data. + +## Details + +### Properties + +#### nextScrollData + +>

Stores the current bet point.

+ +| meta | description | +| :--- | :---------- | +| Type | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) \| null | +| Defined in | [p4f-slotty-core/src/model/spin-model.js.js#L9](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/model/spin-model.js#L9)| + +#### betPoint + +>

Stores the next scroll data.

+ +| meta | description | +| :--- | :---------- | +| Type | [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | +| Defined in | [p4f-slotty-core/src/model/spin-model.js.js#L10](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/model/spin-model.js#L10)| + +#### totalBetPoint + +>

Stores the next scroll data.

+ +| meta | description | +| :--- | :---------- | +| Type | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)| +| Defined in | [p4f-slotty-core/src/model/spin-model.js.js#L10](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/model/spin-model.js#L10)| + +### Meethods + +#### SetBetPoint + +Sets the bet point value. + +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/model/spin-model.js.js#L16](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/model/spin-model.js#L16)| + +

+ + **Parameters** + * `betPoint` [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) +

+ +#### GetBetPoint + +Gets the current bet point value. + +| meta | description | +| :--- | :---------- | +| Returns | [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)| +| Defined in | [p4f-slotty-core/src/model/spin-model.js.js#L22](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/model/spin-model.js#L22)| + +#### SetTotalBetPoint + +Stores the total bet point. + +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/model/spin-model.js.js#L28](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/model/spin-model.js#L28)| + +

+ + **Parameters** + * `totalBetPoint` [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) +

+ +#### GetTotalBetPoint + +Gets the current total bet point value. + +| meta | description | +| :--- | :---------- | +| Returns | [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)| +| Defined in | [p4f-slotty-core/src/model/spin-model.js.js#L34](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/model/spin-model.js#L34)| + +#### SetNextScrollData + +Sets the next scroll data. + +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/model/spin-model.js.js#L40](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/model/spin-model.js#L40)| + +

+ + **Parameters** + * `nextScrollData` [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) +

diff --git a/api-doc/controllers/spin/spin-view.md b/api-doc/controllers/spin/spin-view.md new file mode 100644 index 0000000..2beab92 --- /dev/null +++ b/api-doc/controllers/spin/spin-view.md @@ -0,0 +1,14 @@ +--- +sidebar_position: 3 +--- + +# Spin view + +## Overview + +* SpinView is a view class for the spin feature in the slot game. It extends the base View class and is intended to handle the visual representation and UI logic for spins. + +## Description: +* Initializes a new instance of SpinView. +* Calls the base View constructor. +