add take and gamble doc

This commit is contained in:
dungdq 2025-07-15 13:33:59 +07:00
parent 0a6c89c94b
commit 527d6629b3
6 changed files with 168 additions and 12 deletions

View File

@ -1,14 +1,18 @@
---
---
sidebar_position: 2
---
# Auto Spin Model
# EndRoundModel
## Overview
* EndRoundModel is a model class for the spin feature in the slot game. It extends the base model class and is intended to handle the visual representation and UI logic for spins.
`EndRoundModel` is a model class for managing the end-of-round logic in the slot machine game. It extends the base model class and is responsible for handling the visual representation and UI logic related to the end of a spin.
## Description:
* Initializes a new instance of EndRoundModel.
* Calls the base model constructor.
* [p4f-game-core/src/view/end-round-model.js:#L5](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/model/end-round-model.js#L5)
## Description
- Initializes a new instance of `EndRoundModel`.
- Calls the base model constructor.
- Handles end-of-round events and updates the UI accordingly.
[Source code reference](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/model/end-round-model.js#L5)

View File

@ -2,13 +2,14 @@
sidebar_position: 3
---
# Auto Spin view
# EndRoundView
## Overview
* EndRoundView 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.
EndRoundView is a UI component for managing the end-of-round visuals in the slot machine game. It extends the base View class, providing logic and presentation for the spin completion state.
## Description:
* Initializes a new instance of EndRoundView.
* Calls the base View constructor.
* [p4f-game-core/src/view/end-round-view.js:#L5](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/view/end-round-view.js#L5)
## Description
- Constructs a new EndRoundView instance.
- Invokes the base View constructor for initialization.
- [Source code reference](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/view/end-round-view.js#L5)

View File

@ -0,0 +1,18 @@
{
"position": 30,
"label": "Take and Gamble",
"collapsible": true,
"collapsed": true,
"link": {
"type": "generated-index",
"title": "Take and Gamble",
"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",
"take-and-gamble"
]
}
}

View File

@ -0,0 +1,101 @@
---
sidebar_position: 1
---
# Take Or Gamble Controller
## Index
### Methods
- [_start](#_start) Initializes the take-or-gamble phase depending on game state.
- [_registerEvent](#_registerevent) Registers trigger listeners for take or gamble actions.
- [onTakeClicked](#ontakeclicked) Handles take button click.
- [onGambleClicked](#ongambleclicked) Handles gamble button click.
- [take](#take) Triggers the 'take' action.
- [gamble](#gamble) Triggers the 'gamble' action.
- [checkShowWinLimit](#checkshowwinlimit) Checks whether win limit has been reached and if skipping gamble is disabled.
- [_complete](#_complete) Placeholder for completion handling.
---
## Details
### Methods
#### _start
Initializes the take-or-gamble phase depending on game state.
| meta | description |
| :--- | :---------- |
| Defined in | [p4f-slotty-core/src/controller/take-or-gamble-controller.js#L16](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/take-or-gamble-controller.js#L16) |
---
#### _registerEvent
Registers trigger listeners for take or gamble actions and win-limit check.
| meta | description |
| :--- | :---------- |
| Defined in | [p4f-slotty-core/src/controller/take-or-gamble-controller.js#L34](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/take-or-gamble-controller.js#L34) |
---
#### onTakeClicked
Handles take button click.
| meta | description |
| :--- | :---------- |
| Defined in | [p4f-slotty-core/src/controller/take-or-gamble-controller.js#L47](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/take-or-gamble-controller.js#L47) |
---
#### onGambleClicked
Handles gamble button click.
| meta | description |
| :--- | :---------- |
| Defined in | [p4f-slotty-core/src/controller/take-or-gamble-controller.js#L57](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/take-or-gamble-controller.js#L57) |
---
#### take
Triggers the 'take' action and notifies with current total win points.
| meta | description |
| :--- | :---------- |
| Defined in | [p4f-slotty-core/src/controller/take-or-gamble-controller.js#L59](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/take-or-gamble-controller.js#L59) |
---
#### gamble
Triggers the 'gamble' action and notifies with current total win points.
| meta | description |
| :--- | :---------- |
| Defined in | [p4f-slotty-core/src/controller/take-or-gamble-controller.js#L67](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/take-or-gamble-controller.js#L67) |
---
#### checkShowWinLimit
Checks whether win limit has been reached and if skipping gamble is disabled.
| meta | description |
| :--- | :---------- |
| Defined in | [p4f-slotty-core/src/controller/take-or-gamble-controller.js#L75](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/take-or-gamble-controller.js#L75) |
---
#### _complete
Placeholder for completion handling.
| meta | description |
| :--- | :---------- |
| Defined in | [p4f-slotty-core/src/controller/take-or-gamble-controller.js#L80](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/controller/take-or-gamble-controller.js#L80) |

View File

@ -0,0 +1,16 @@
---
sidebar_position: 2
---
# TakeOrGambleModel
## Overview
`TakeOrGambleModel` is a model class for the "Take or Gamble" feature in the slot game. It extends the base model class and manages the logic and state for handling win events, including the decision to take winnings or gamble for more.
## Description
- Initializes a new instance of `TakeOrGambleModel`.
- Calls the base model constructor.
- Handles UI logic and state for the "Take or Gamble" feature.
- [Source code reference](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/model/take-or-gamble-model.js#L5)

View File

@ -0,0 +1,16 @@
---
sidebar_position: 3
---
# TakeOrGambleView
## Overview
`TakeOrGambleView` is a UI component for the slot machine's spin feature. It extends the base `View` class and manages the display and user interactions related to taking winnings or gambling them.
## Description
- Constructs a new `TakeOrGambleView` instance.
- Invokes the base `View` constructor.
- Source: [`take-or-gamble-view.js:5`](https://gitea.plp19.com/cocos-core/p4f-slotty-core/src/commit/7fbf58bf2ad8edec4258757b353151b638c96652/src/view/take-or-gamble-view.js#L5)