From 9224592ebc852ca778742f3fe71edbdfe9044e5d Mon Sep 17 00:00:00 2001 From: Nguyen Ngoc Thanh Date: Fri, 11 Jul 2025 09:32:08 +0700 Subject: [PATCH] add slot machine balance, initialize --- api-doc/controllers/_category_.json | 17 ++ api-doc/controllers/balance/_category_.json | 18 ++ .../controllers/balance/balance-controller.md | 176 ++++++++++++++++++ api-doc/controllers/balance/balance-model.md | 80 ++++++++ api-doc/controllers/balance/balance-view.md | 19 ++ api-doc/controllers/initialize-controller.md | 63 +++++++ api-doc/intro.md | 4 + 7 files changed, 377 insertions(+) create mode 100644 api-doc/controllers/_category_.json create mode 100644 api-doc/controllers/balance/_category_.json create mode 100644 api-doc/controllers/balance/balance-controller.md create mode 100644 api-doc/controllers/balance/balance-model.md create mode 100644 api-doc/controllers/balance/balance-view.md create mode 100644 api-doc/controllers/initialize-controller.md diff --git a/api-doc/controllers/_category_.json b/api-doc/controllers/_category_.json new file mode 100644 index 0000000..e7418b9 --- /dev/null +++ b/api-doc/controllers/_category_.json @@ -0,0 +1,17 @@ +{ + "position": 1, + "label": "Slot Game Machine", + "collapsible": true, + "collapsed": true, + "link": { + "type": "generated-index", + "title": "Slot Game Machine", + "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", + "development environment" + ] + } +} \ No newline at end of file diff --git a/api-doc/controllers/balance/_category_.json b/api-doc/controllers/balance/_category_.json new file mode 100644 index 0000000..122f127 --- /dev/null +++ b/api-doc/controllers/balance/_category_.json @@ -0,0 +1,18 @@ +{ + "position": 2, + "label": "Balance", + "collapsible": true, + "collapsed": true, + "link": { + "type": "generated-index", + "title": "Balance", + "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", + "balance" + ] + } +} \ No newline at end of file diff --git a/api-doc/controllers/balance/balance-controller.md b/api-doc/controllers/balance/balance-controller.md new file mode 100644 index 0000000..e797060 --- /dev/null +++ b/api-doc/controllers/balance/balance-controller.md @@ -0,0 +1,176 @@ +--- +sidebar_position: 2 +--- + +# Balance Controller +## Index + +### Properties +* [savedCurrentPoint](#savedcurrentpoint) `Number` Current played bet. +* [savedFreePoint](#savedfreepoint) `Number` Current free point played bet. +* [isResume](#isresume) `Boolean` Indicates whether the game current state is resuming or not. + +### Methods + +* [onReplayHistoryClient](#onreplayhistoryclient) Indicates the game current state is resuming. +* [onResume](#onresume) Indicates the game current state is resuming. +* [onResumeEnd](#isresumeend) Indicates the game current state isn't resuming. +* [onDeposit](#ondeposit) Update the client balance when user deposit. +* [onConnected](#onconnected) Update the client balance when the game is connected. +* [onStartGame](#onstartgame) Show the client balance when the game is started. +* [onCollectDataReceived](#oncollectdatareceived)Update the client balance when the game is collected. +* [onBalanceDataReceived](#onbalancedatareceived) Update the client balance when get new balance data. +* [onBalanceChangeRateClicked](#onbalancechangerateclicked) Change the client balance rate. +* [updateBalance](#updatebalance) Update the client balance. +* [notifyBalance](#notifyblance) Notify the client balance. +* [placeBet](#placebet) Set current client bet. +* [clearBet](#clearbet) Clear current client bet

+* [onSpinStart](#onspinstart) Update the client balance when user spin. +* [onReplayHistory](#onreplayhistory) Indicates the game current state is resuming. +* [onReplayHistoryEnd](#onreplayhistoryend) Indicates the game current state isn't resuming. +* [onFastPlayDataReceived](#onfastokaydatareceived) Update the client balance when user playing Fast Play. + +## Details + +#### savedCurrentPoint +> Current played bet.
+ +| meta | description | +| :--- | :---------- | +| Type | [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:12](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L12)| + +#### savedFreePoint +> Current free point played bet.
+ +| meta | description | +| :--- | :---------- | +| Type | [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:13](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L13)| + +#### isResume +> Indicates whether the game state is not resumed.
+ +| meta | description | +| :--- | :---------- | +| Type | [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:14](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L14)| + +#### onReplayHistoryClient +> Indicates the game current state is resuming.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:28](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L28)| + +#### onResume +> Indicates the game current state is resuming.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:36](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L36)| + +#### onResumeEnd +> Indicates the game current state isn't resuming.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:44](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L44)| + +#### onDeposit +> Update the client balance when user deposit.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:52](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L52)| + +#### onConnected +> Update the client balance when the game is connected.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:82](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L82)| + +#### onStartGame +> Show the client balance when the game is started.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:90](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L90)| + +#### onCollectDataReceived +> Update the client balance when the game is collected.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:99](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L99)| + +#### onBalanceDataReceived +> Update the client balance when get new balance data.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:109](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L109)| + +#### onBalanceChangeRateClicked +> Change the client balance rate.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:117](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L117)| + +#### updateBalance +> Update the client balance.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:129](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L129)| + +#### notifyBalance +> Notify the client balance.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:141](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L141)| + +#### placeBet +> Set current client bet.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:151](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L151)| + +#### clearBet +> Clear current client bet.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/controller/balance-controller.js:180](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/controller/balance-controller.js#L180)| + +#### onSpinStart +> Update the client balance when user spin.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/balance-controller.js:17](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/branch/develop/src/controller/balance-controller.js#L17)| + +#### onReplayHistory +> Indicates the game current state is resuming.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/balance-controller.js:29](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/branch/develop/src/controller/balance-controller.js#L29)| + +#### onReplayHistoryEnd +>Indicates the game current state isn't resuming.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/balance-controller.js:37](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/branch/develop/src/controller/balance-controller.js#L37)| + +#### onFastPlayDataReceived +> Update the client balance.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/balance-controller.js:45](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/branch/develop/src/controller/balance-controller.js#L45)| \ No newline at end of file diff --git a/api-doc/controllers/balance/balance-model.md b/api-doc/controllers/balance/balance-model.md new file mode 100644 index 0000000..235583a --- /dev/null +++ b/api-doc/controllers/balance/balance-model.md @@ -0,0 +1,80 @@ +--- +sidebar_position: 2 +--- + +# Balance Model + +## Index + +### Properties +* [currentPoint](#currentpoint) `Number` Current point. +* [freePoint](#freepoint) `Number` Current free point. + +### Methods +* [SetCurrentPoint](#setcurrentpoint) Set current point. +* [GetCurrentPoint](#getcurrentpoint) Get current point. +* [SetFreePoint](#setfreepoint) Set current free point. +* [GetFreePoint](#getfreepoint) Get current free point. +* [GetAvailablePoint](#getavalablepoint) Get current point. +* [isNumber](#isnumber) Indicates whether the value is number or not. + +## Details + +#### currentPoint +> Current point.
+ +| meta | description | +| :--- | :---------- | +| Type | [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | +| Defined in | [p4f-game-core/src/model/balance-model.js:8](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/model/balance-model.js#L9)| + +#### freePoint +> Current free point.
+ +| meta | description | +| :--- | :---------- | +| Type | [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) | +| Defined in | [p4f-game-core/src/model/balance-model.js:9](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/model/balance-model.js#L9)| + +#### SetCurrentPoint +> Set current point.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/model/balance-model.js:14](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/model/balance-model.js#L14)| + +#### GetCurrentPoint +> Get current point.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/model/balance-model.js:21](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/model/balance-model.js#L21)| + +#### SetFreePoint +> Set Current free point.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/model/balance-model.js:27](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/model/balance-model.js#L27)| + +#### GetFreePoint +> Get current free point.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/model/balance-model.js:34](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/model/balance-model.js#L34)| + +#### GetAvailablePoint +> Get current point.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/model/balance-model.js:40](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/model/balance-model.js#L40)| + +#### isNumber +> Indicates whether the value is number or not.
+ +| meta | description | +| :--- | :---------- | +| Type | [Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | +| Defined in | [p4f-game-core/src/model/balance-model.js:46](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/model/balance-model.js#L46)| \ No newline at end of file diff --git a/api-doc/controllers/balance/balance-view.md b/api-doc/controllers/balance/balance-view.md new file mode 100644 index 0000000..95cc88a --- /dev/null +++ b/api-doc/controllers/balance/balance-view.md @@ -0,0 +1,19 @@ +--- +sidebar_position: 2 +--- + +# Balance View + +## Index + +### Methods +* [BalanceChangeRate](#balancechangerate) + +## Details + +#### BalanceChangeRate +> ... + +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-game-core/src/view/balance-view.js:12](https://gitea.plp19.com/cocos-core/p4f-game-core/src/branch/develop/src/view/balance-view.js#L11)| \ No newline at end of file diff --git a/api-doc/controllers/initialize-controller.md b/api-doc/controllers/initialize-controller.md new file mode 100644 index 0000000..e8ff296 --- /dev/null +++ b/api-doc/controllers/initialize-controller.md @@ -0,0 +1,63 @@ +--- +sidebar_position: 1 +--- + +# Initialize Controller + +## Index + +### Properties +* [resumeData ](#resumedata) `Object` Current played bet. + +### Methods + +* [_registerEvent](#_registerevent) Register events to get data from server. +* [_start](#_start) Send request data to server. +* [onConnected](#onconnected) Set resume data when connected server. +* [onStartGame](#onstartgame) Start game when connected succesfully. +* [startResumeGame](#startresumegame) Start game when connected succesfully with resume data. + +## Details + +#### resumeData +> Current played bet.
+ +| meta | description | +| :--- | :---------- | +| Type | [Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) | +| Defined in | [p4f-slotty-core/src/controller/initialize-controller.js:12](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/branch/develop/src/controller/initialize-controller.js#L12)| + +#### _registerEvent +> Register events to get data from server.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/initialize-controller.js:17](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/branch/develop/src/controller/initialize-controller.js#L17)| + +#### _start +> Send request data to server.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/initialize-controller.js:24](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/branch/develop/src/controller/initialize-controller.js#L24)| + +#### onConnected +> Set resume data when connected server.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/initialize-controller.js:32](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/branch/develop/src/controller/initialize-controller.js#L32)| + +#### onStartGame +> Start game when connected succesfully.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/initialize-controller.js:38](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/branch/develop/src/controller/initialize-controller.js#L38)| + +#### startResumeGame +> Start game when connected succesfully with resume data.
+ +| meta | description | +| :--- | :---------- | +| Defined in | [p4f-slotty-core/src/controller/initialize-controller.js:50](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/branch/develop/src/controller/initialize-controller.js#L50)| \ No newline at end of file diff --git a/api-doc/intro.md b/api-doc/intro.md index 3f0ba36..0a9889b 100644 --- a/api-doc/intro.md +++ b/api-doc/intro.md @@ -5,4 +5,8 @@ sidebar_position: 0 # Slot game API +## Slot Machine +# Slot Game API +## Slot Game Machine +* [Balance Controller](controllers/balance-controller) To be written \ No newline at end of file