feature/add-setup-ui-panel-main-game #18
@ -6,7 +6,7 @@ sidebar_position: 3
|
||||
|
||||
Set **Javascript Engine Path** to a **custom Cocos Engine**.
|
||||
|
||||
Thank to the open source nature of Cocos Creator, we are able to customize some of the function in the source code to meet the requirement for Hyper Slot Game.
|
||||
Thanks to the open source nature of Cocos Creator, we are able to customize some of the function in the source code to meet the requirement for Hyper Slot Game.
|
||||
|
||||
For the detail of the Custom Engine, take a look at this [**Custom Cocos Engine documentation**](../custom-cocos-engine/custom-cocos-engine.md)
|
||||
|
||||
|
@ -28,7 +28,7 @@ Rename those scenes:
|
||||
|
||||

|
||||
|
||||
Inside `assets/game-assets/scripts/`, create a folder called `custome-scaler` then add a script `custom-scale-data.js`.
|
||||
Inside `assets/game-assets/scripts/`, create a folder called `custom-scaler` then add a script `custom-scale-data.js`.
|
||||
|
||||

|
||||
|
||||
|
@ -24,8 +24,21 @@ Try to run the project, you'll the result as below. It doesn't look like much bu
|
||||

|
||||
:::
|
||||
|
||||
## Setup Reel Slot
|
||||
## Setup SpriteFrame Provider
|
||||
---
|
||||
|
||||
**SpriteFrameProvider** allows global access to "sprite frames" from code.
|
||||
|
||||

|
||||
|
||||
## Setup Animation Provider
|
||||
---
|
||||
|
||||
**Animation Provider** contains all **animations** of the game.
|
||||
|
||||

|
||||
|
||||
## Setup Reel Slot
|
||||
---
|
||||
|
||||
1. Prepare the asset for symbols.
|
||||
@ -68,7 +81,17 @@ The setup is very straightforward by using the `Generate Panel` command in each
|
||||
|
||||
- Landing Panel:
|
||||
|
||||

|
||||

|
||||
|
||||
To define Landing Panel, create the following script:
|
||||
|
||||
:::warning
|
||||
```jsx title="assets/game-assets/scripts/slotty-settings/extend-slotty-setting.js"
|
||||
SlottySetting.prototype._registerInjection = function () {
|
||||
DIContainer.Register('landingGenerator', require('landing-generator'));
|
||||
};
|
||||
```
|
||||
:::
|
||||
|
||||
- Present Win Cell Panel:
|
||||
|
||||
@ -84,24 +107,301 @@ The setup is very straightforward by using the `Generate Panel` command in each
|
||||
|
||||
If the tension use a custom size frame, we can change the option **sizeMode** to **Custom** and set the static frame and size.
|
||||
|
||||

|
||||

|
||||
**check toggle General Panel**
|
||||

|
||||
To define Tension Panel, create the following script:
|
||||
:::warning
|
||||
```jsx title="assets/game-assets/scripts/slotty-settings/extend-slotty-setting.js"
|
||||
SlottySetting.prototype._registerInjection = function () {
|
||||
DIContainer.Register('tensionGenerator', require('tension-generator'));
|
||||
};
|
||||
```
|
||||
:::
|
||||
|
||||
|
||||
## Setup UI Panel
|
||||
|
||||
> To be Added:
|
||||
> - Different UI Layout on Desktop and Mobile
|
||||
> - Which helper/p4f menu can be used
|
||||
### UI Panel Overview
|
||||
|
||||
The UI system supports both desktop and mobile layouts design.
|
||||
|
||||
#### 🖥️ Desktop Layout
|
||||
- Full bottom bar with all controls visible
|
||||
- Horizontal layout maximizing screen width
|
||||
|
||||

|
||||
|
||||
#### 📱 Mobile Layout
|
||||
The mobile interface adapts to both landscape and portrait orientations:
|
||||
|
||||
| Orientation | Preview |
|
||||
|-------------|----------|
|
||||
| Landscape |  |
|
||||
| Portrait |  |
|
||||
|
||||
|
||||
### UI Panel Desktop
|
||||
|
||||
#### Step 1: Setup Prefab Editor
|
||||
|
||||
| Step | Action | image |
|
||||
|------|---------|--------------|
|
||||
| 1. Locate Prefab | Search for `ui-bottom-bar-panel` prefab |  |
|
||||
| 2. Copy Assets | Navigate from `core/editor` directory |  |
|
||||
| 3. Place Assets | Copy / Paste to game assets location |  |
|
||||
|
||||
---
|
||||
|
||||
#### Step 2: Configure Prefabs
|
||||
|
||||
##### Core Prefabs Structure
|
||||
Navigate to the location where the prefabs:
|
||||

|
||||
|
||||
##### Rename Prefabs
|
||||
Rename the copied prefabs by removing unnecessary prefixes:
|
||||
| Prefix to Remove | Original Prefab Name | Final Name |
|
||||
|------------------|----------------------|------------|
|
||||
| `template-new-` | `template-new-ui-bottom-bar-panel` | `ui-bottom-bar-panel` |
|
||||
| `template-` | `template-button-auto-selection` | `button-auto-selection` |
|
||||
|
||||
|
||||
```jsx title="The folder structure is as follows:"
|
||||
assets\game-assets\prefabs
|
||||
```
|
||||
|
||||
|
||||

|
||||
|
||||
#### Customize *`button-auto-selection`* Label
|
||||
|
||||
**Follow Design:**
|
||||
Use the `template-label-auto-selection` to customize the appearance of the label inside the `button-auto-selection` prefab.
|
||||
|
||||
| Component | Description |
|
||||
| -------------------- | ------------------------------------------------- |
|
||||
| **Label Outline** | Add an outline to make the text stand out. |
|
||||
| **Label Shadow** | Add a shadow for better contrast and readability. |
|
||||
| -------------------- | ------------------------------------------------- |
|
||||
|
||||

|
||||
|
||||
#### Customize *`ui-bottom-bar-panel`* Label
|
||||
Use `template-label-title` to customize the `ui-bottom-bar-panel`:
|
||||
:::info
|
||||
*[Follow the same configuration as Button Auto Selection Labels](#customize-button-auto-selection-label)*
|
||||
**Bottom bar labels include a localization component for multi-language support**
|
||||
:::
|
||||
|
||||

|
||||
|
||||
The `FormatText` property controls text formatting behavior for label components:
|
||||
|
||||
| Property | Description | Example |
|
||||
|----------|-------------|---------|
|
||||
| `default` | Initial formatting state | `false` |
|
||||
| `notify` | Formatting update callback | Updates when value changes |
|
||||
|
||||
---
|
||||
#### Step 3: Setup Ui In Main Scenes
|
||||
|
||||
Create new node and configuration in your main scene:
|
||||

|
||||
|
||||
##### Platform Node Spawner Settings
|
||||
|
||||
| Setting | Value | Description |
|
||||
|---------|-------|-------------|
|
||||
| Desktop Toggle | ✓ Enabled | Show prefabs for desktop platform |
|
||||
| Mobile Toggle | ☐ Disabled | Hide prefabs for mobile platform |
|
||||
| Target Prefab | `ui-bottom-bar-panel` | References prefab |
|
||||
|
||||
#### Step 4: Apply Textures
|
||||
|
||||
##### Texture Button Bar
|
||||
✅ Checklist assets completed for bottom UI and button UI text
|
||||
🔗 [Follow is by Complete Assets Structure Guide](http://localhost:3000/docs/category/game-asset-structure):
|
||||

|
||||
|
||||
##### Run the Helper Tool
|
||||
- Open the UI Desktop Helper
|
||||
- Select texture assignment options
|
||||

|
||||
|
||||
##### Verify Results
|
||||
|
||||
*Auto Selection prefab*
|
||||

|
||||
|
||||
*Bottom Bar prefab*
|
||||

|
||||
|
||||
*In game*
|
||||

|
||||

|
||||
|
||||
---
|
||||
|
||||
### UI Panel Mobile
|
||||
|
||||
#### Step 1: Setup Prefab
|
||||
| Step | Action | image |
|
||||
|------|---------|--------------|
|
||||
| 1. Locate Prefab | Search for `mobile-ui` prefab |  |
|
||||
| 2. Place Assets | Copy to game assets location |  |
|
||||
| 3. Locate Prefab | Search for `buy-feature` prefab |  |
|
||||
|
||||
#### Step 2: Rename Prefabs
|
||||
|
||||
```jsx title="The folder structure is as follows:"
|
||||
assets\game-assets\prefabs\mobile
|
||||
```
|
||||
|
||||
Rename the copied prefabs by removing unnecessary prefixes:
|
||||
| Prefix to Remove | Final Name |
|
||||
|------------------|----------------------|
|
||||
| `template-` | |
|
||||
|
||||
#### Step 3: Setup Ui In Main Scenes
|
||||
|
||||
Create new node and configuration in your main scene:
|
||||

|
||||
|
||||
##### Platform Node Spawner Settings
|
||||
|
||||
| Setting | Value | Description |
|
||||
|---------|-------|-------------|
|
||||
| Mobile Toggle | ✓ Enabled | Show prefabs for mobile platform |
|
||||
| Desktop Toggle | ☐ Disabled | Hide prefabs for desktop platform |
|
||||
| Target Prefab | `mobile-ui` | References prefab |
|
||||
|
||||
#### Step 4: Apply Textures
|
||||
|
||||
##### Texture Mobile Ui
|
||||
✅ Checklist assets completed for Mobile UI
|
||||
🔗 [Follow is by Complete Assets Structure Guide](http://localhost:3000/docs/category/game-asset-structure):
|
||||

|
||||
|
||||
##### Run the Helper Tool
|
||||
- Open the UI Mobile Helper
|
||||
- Select texture assignment options
|
||||

|
||||
|
||||
##### Results
|
||||
|
||||
*main ui button added textures*
|
||||
|  |
|
||||
|
||||
|
||||
#### Step 4: Setup Color For Menu Mobile UI
|
||||
|
||||
**Follow Design:**
|
||||
|
||||
| |  |
|
||||
|---------|-------|
|
||||
|
||||
##### Overview
|
||||
The `helper-paint-color-ui-mobile.js` component is a customizable color painter for various UI elements in a MOBILE UI. It allows designers and developers to easily apply theme-based colors across the game interface.
|
||||
|
||||

|
||||
|
||||
|Ordinal number| Properties | Explaination | Example |
|
||||
|--------------|------------|--------------|---------|
|
||||
|0 |**paintColor** |Trigger to repaint UI components | |
|
||||
|1 | **Main Ui Normal Color** |Default color of UI elements |  |
|
||||
|2 | **Main Ui Highlight Color** | Highlight color for selected UI elements |  |
|
||||
|3 | **Toggle State Off Color** | Color of toggle when off |  |
|
||||
|4 | **Toggle State On Color** | Color of toggle when on |  |
|
||||
|5 | **Background Info Page Color** | Info screen background | |
|
||||
|6 | **Background Menu Color** | Menu background color |  |
|
||||
|7 | **Background Point Panel Color** | Background panel for point/balance UI |  |
|
||||
|8 | **Background Bottom Bar Color** | Background bottom bar (show only mobile portrait) |  |
|
||||
|9 | **Button Quit Color** | Quit button color |  |
|
||||
|10 | **Button Cancel Color** | Cancel button color |  |1
|
||||
|11 | **Label Balance Normal Color** | Normal balance label color |  |
|
||||
|12 | **Label Balance Spin Color** | During-spin label color |  |
|
||||
|13 | **Button Plus Minus Auto Color** | Button plus/Minus autoplay |  |
|
||||
|14 | **Label Start Auto Color** | Start autoplay label |  |
|
||||
|15 | **Label Outline Notification** | Outline color + width config |  |
|
||||
|16 | **Total Win Medium Win Color** | Color for medium win effects |  |
|
||||
|
||||
---
|
||||
|
||||
## Setup Background
|
||||
|
||||
> To Be Added:
|
||||
> - show how many background: desktop, mobile, main game, free game, gamble, reel bg, slot panel bg.
|
||||
Background overview:
|
||||
|
||||
## Setup Animation Provider
|
||||
| | Desktop | Mobile |
|
||||
|:-:|--------------|---------|
|
||||
|**Background Landscape**<br/>|<br/>|<br/>|
|
||||
|**Background Portrait**<br/>||<br/>|
|
||||
|
||||
> To Be Added:
|
||||
> - How to run helper / p4f menu
|
||||
> - How to setup static frame / fps
|
||||
**Background landscape** use for Desktop and Mobile landscape.
|
||||
|
||||
**Background portrait** only use for Mobile portrait.
|
||||
|
||||
### 1. Prepare the assets
|
||||
| | Assets | Description |
|
||||
|:-:|--------------|---------|
|
||||
|**Static**<br/>||Static background is necessary for the game|
|
||||
|**Animation**<br/>||Animation background may or may not be present, depending on the game design|
|
||||
|
||||
### 2. Background Landscape
|
||||
|
||||
- **background-container:** must have **orientation-ui-controller** to display on Landscape with the options below.
|
||||
- **background-main-game:** we use sprite frame from prepared assets.
|
||||
|
||||
Both must add component **Widget** with the options below to resize with parent node.
|
||||
|
||||

|
||||
|
||||
### 3. Background Portrait
|
||||
|
||||
- **moible-background-container:**
|
||||
- Add **mobile-portrait-background-ui-controller** to display only on Mobile.
|
||||
- Add **background-mobile-portrait-fullscreen-scaler** to resize with screen resolution.
|
||||
- Add **orientation-ui-controller** to display on Portrait with the options below.
|
||||
|
||||
- **mobile-background-main-game:** we use sprite frame from prepared assets. Must add component **Widget** with the options below to resize with parent node.
|
||||
|
||||

|
||||
|
||||
### 4. Background Animation
|
||||
|
||||
If the game have design animation for background, we will do this step.
|
||||
|
||||
1. Add **animation-provider**: This component contains all **animation** of the game.
|
||||
|
||||
2. Using hepler to generate animation.
|
||||
|
||||

|
||||
|
||||
3. We have the result as below, and continue setup for **spine-animation**.
|
||||
- **Is Loop**: is ✅ because this animation will play through the game.
|
||||
- **Static Sprite Frame**: It will be displayed when the animation has not finished loading.
|
||||
|
||||

|
||||
|
||||
4. Add animation background with component below:
|
||||
|
||||
**Animation background landscape**
|
||||
|
||||
- Add **animation-play-on-anable** with animation name in **Animation Provider**.
|
||||
- Add **background-scaler** resize with screen resolution.
|
||||
|
||||

|
||||
|
||||
**Animation background portrait**
|
||||
|
||||
- **mobile-background-anim-portrait:**
|
||||
- Add **mobile-portrait-background-ui-controller** to display only on **Mobile**.
|
||||
- Add **orientation-ui-controller** to display on Portrait with the options below.
|
||||
- **anim-background-main-game:**
|
||||
- **animation-play-on-anable** with animation name in **Animation Provider**.
|
||||
- **portrait-anim-background-scaler** resize with screen resolution.
|
||||
|
||||

|
||||
|
||||
## Setup Popup Panel
|
||||
|
||||
|
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 16 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/animation-provider.png
Normal file
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 220 KiB |
After Width: | Height: | Size: 195 KiB |
After Width: | Height: | Size: 190 KiB |
After Width: | Height: | Size: 208 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 85 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/bg-setup-animation.png
Normal file
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 13 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/bg-setup-landscape.png
Normal file
After Width: | Height: | Size: 176 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/bg-setup-portrait.png
Normal file
After Width: | Height: | Size: 183 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/bottom-ui-desktop.png
Normal file
After Width: | Height: | Size: 452 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/btn-auto-selection.png
Normal file
After Width: | Height: | Size: 219 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/btn-cancel-game.png
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/btn-quit-game.png
Normal file
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 5.8 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/component-locale.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 144 KiB |
After Width: | Height: | Size: 264 KiB |
After Width: | Height: | Size: 269 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 65 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 23 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/in-scenes-game.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 21 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/menu-landscape.png
Normal file
After Width: | Height: | Size: 270 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/menu-portrait.png
Normal file
After Width: | Height: | Size: 548 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/mobile-ui-prefab.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/note-bug-tension.png
Normal file
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 90 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/option-for-label.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 14 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/rename-prefab.png
Normal file
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 216 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/result-buttom-bar.png
Normal file
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 4.1 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 27 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/search-mobile-ui.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/set-color-menu-ui.png
Normal file
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 25 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/toggle-off.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
docs/02-setup-main-game/img/05-main-scene/toggle-on.png
Normal file
After Width: | Height: | Size: 19 KiB |