Nguyen Ngoc Thanh 0c811feb5b add slot machine
balance, initialize, bet controller
2025-07-14 09:35:10 +07:00

176 lines
7.8 KiB
Markdown

---
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<br/><br/>
* [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.<br/>
| meta | description |
| :--- | :---------- |
| Type | [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) |
| 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.<br/>
| meta | description |
| :--- | :---------- |
| Type | [Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) |
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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.<br/>
| 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)|