Merge pull request 'feature/add-freeround' (#53) from feature/add-freeround into develop

Reviewed-on: #53
This commit is contained in:
Pham Huynh Duc Huy 2025-05-19 14:50:37 +08:00
commit 590e65b3de
8 changed files with 78 additions and 56 deletions

View File

@ -11,95 +11,117 @@ description: Display and manage remaining free rounds in the game.
- Handles the **display** and **logic** for tracking remaining free rounds in a slot game.
- Supports both **desktop** and **mobile**, including animation and event handling.
| Orientation | Preview |
|-------------|---------|
| Desktop | ![Desktop](../img/05-main-scene/freeround-counter/overview-freeround-desktop.png) |
| Mobile | ![Mobile](../img/05-main-scene/freeround-counter/overview-freeround.png) |
| Platform | Preview |
|----------|---------|
| Desktop | ![Desktop](../img/05-main-scene/freeround-counter/overview-freeround-desktop.png) |
| Mobile | ![Mobile](../img/05-main-scene/freeround-counter/overview-freeround.png) |
---
## Implementation
## Implementation
### Prefab Location
#### In Core
- Copy or parse prefabs from core to game assets.
| Path | Example |
|---------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| `assets\core-assets\hyper-core\packages\freeround-count-box\prefabs` | <center>![Core Prefab](../img/05-main-scene/freeround-counter/freeround-path-prefabs.png)</center> |
#### Core
#### In Game
| Path | Preview |
|------|---------|
| `assets/core-assets/hyper-core/packages/freeround-count-box/prefabs` | ![Desktop](../img/05-main-scene/freeround-counter/freeround-path-prefabs.png) |
| Path | Example |
|-----------------------------------|---------------------------------------------------------------------------------------------------|
| `assets\game-assets\prefabs` | <center>![Copied Prefab](../img/05-main-scene/freeround-counter/freeround-path-prefabs-in-game.png)</center> |
#### Game
| Path | Preview |
|------|---------|
| `assets/game-assets/prefabs` |![Preview](../img/05-main-scene/freeround-counter/freeround-path-prefabs-in-game.png) |
---
### General Setup
![Copied Prefab](../img/05-main-scene/freeround-counter/freeround-counter-general.png)
- Ensure the script references the correct nodes.
- Component that manages and displays the free rounds counter.
![General](../img/05-main-scene/freeround-counter/freeround-counter-general.png)
![Copied Prefab](../img/05-main-scene/freeround-counter/freeround-counter-setting-general.png)
- Manages and displays the remaining free round count in-game.
**(platform)**: Desktop / Mobile <span class="red-star">*</span>
![Desktop](../img/05-main-scene/freeround-counter/freeround-counter-setting-general.png)"
| Property | Description |
|---------------|------------------------------------------|
| `duration` | Animation duration in seconds (fade In/Out) |
| `content` | Container node for the counter |
| `labelLeft` | Label displaying remaining free rounds |
| Property | Description |
|---------------|--------------------------------------------|
| `duration` | Duration of fade in/out animation (seconds) |
| `content` | Container node for the counter |
| `labelLeft` | Label showing remaining free rounds |
---
### Platform Setup
- Ensure that the desktop and mobile prefabs are positioned differently in the main game scene for proper layout on each platform.
#### Desktop
| Component | Description |
|--------------------------|---------------------------------------------------------------------------------------------------------------|
| `Platform-ui-controller` | [Platform UI Controller](http://localhost:3000/docs/faqs/setup-cocos-scene#Platform-ui-controller) |
![Desktop](../img/05-main-scene/freeround-counter/freeround-counter-setup-desktop.png)
![Overview](../img/05-main-scene/freeround-counter/freeround-counter-setup-desktop.png)
| Component | Description |
|-------------------------|-------------|
| `Platform-ui-controller` | [View Setup](http://localhost:3000/docs/faqs/setup-cocos-scene#platform-ui-controller) |
---
#### Mobile
| Component | Description |
|-----------------------|--------------------------------------------------------------------------------------------------------------------------|
| `Platform-ui-controller` | [Platform UI Controller](http://localhost:3000/docs/faqs/setup-cocos-scene#Platform-ui-controller) |
| `UI Mobile Position` | [UI Mobile Position](http://localhost:3000/docs/faqs/setup-cocos-scene#ui-mobile-landscape--portrait--position) |
![Desktop](../img/05-main-scene/freeround-counter/freeround-counter-setup-mobile.png)
![Overview](../img/05-main-scene/freeround-counter/freeround-counter-setup-mobile.png)
| Component | Description |
|-------------------------|-------------|
| `Platform-ui-controller` | [View Setup](http://localhost:3000/docs/faqs/setup-cocos-scene#platform-ui-controller) |
| `UI Mobile Position` | [Mobile Position Setup](http://localhost:3000/docs/faqs/setup-cocos-scene#ui-mobile-landscape--portrait--position) |
---
### Asset Setup
#### Desktop
| Path | Preview |
|------|---------|
| `assets/game-assets/textures/desktop/preloads/main-game/custom-scale` | ![Assets Desktop](../img/05-main-scene/freeround-counter/assets-freeround-desktop.png) |
#### Mobile
| Path | Preview |
|------|---------|
| `assets/game-assets/textures/mobile/preloads/main-game/custom-scale` | ![Assets Mobile](../img/05-main-scene/freeround-counter/assets-freeround-mobile.png) |
#### Common
- **Free Round Background**
![Assets Mobile](../img/05-main-scene/freeround-counter/assets-freeround-background.png)
🔗 More: [Game Asset Structure](http://localhost:3000/docs/category/game-asset-structure)
:::tip
- **Position & Size**: Follow the game design layout.
- **Asset Packing**: Use separate textures for Desktop and Mobile.
:::
---
### Font Setup
<table>
<thead>
<tr>
<th style={{ width: "700px" }}>Preview</th>
</tr>
</thead>
<tbody>
<tr>
<td><center>![Add Font](../img/05-main-scene/freeround-counter/add-font.png)</center></td>
</tr>
</tbody>
</table>
| Preview |
|---------|
| ![Assets Mobile](../img/05-main-scene/freeround-counter/add-font.png) |
:::tip
- **Position And Size**: Follow Game Design.
:::
---
## Game Result Example
## Game Result Examples
*To show the free round popup, make sure the main scene includes the popup panel.*
<span class="red-star">*</span> More Detail: [Popup Panel](http://localhost:3000/docs/setup-main-game/main-scene/popup-panel#multiple-popup-panel)
|Platform|Popup|Action|Result|
|--------|-----|------|------|
|Desktop|![Desktop](../img/05-main-scene/freeround-counter/popup-freeround-counter-desktop.png)|click → Start|![Add Font](../img/05-main-scene/freeround-counter/overview-freeround-desktop.png)|
|Mobile|![Mobile](../img/05-main-scene/freeround-counter/popup-freeround-counter-mobile.png)|click → Start|![Add Font](../img/05-main-scene/freeround-counter/overview-freeround.png)|
Make sure the main scene includes the popup panel.
🔗 [See Popup Panel Guide](http://localhost:3000/docs/setup-main-game/main-scene/popup-panel#multiple-popup-panel)
| Platform | Popup | Action | Result |
|----------|--------|---------------|--------|
| Desktop | ![Popup Desktop](../img/05-main-scene/freeround-counter/popup-freeround-counter-desktop.png) | Click → Start | ![Result Desktop](../img/05-main-scene/freeround-counter/overview-freeround-desktop.png) |
| Mobile | ![Popup Mobile](../img/05-main-scene/freeround-counter/popup-freeround-counter-mobile.png) | Click → Start | ![Result Mobile](../img/05-main-scene/freeround-counter/overview-freeround.png) |

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB