Merge pull request 'Close #4: add list-bet-option template' (#12) from feature/add-list-bet-option-template into master

Reviewed-on: dev-tech/ts-table-game-template#12
Reviewed-by: Le Hoang Nam <nam.le@noreply.localhost>
This commit is contained in:
Le Hoang Nam 2025-06-11 18:35:30 +08:00
commit de54306c46
15 changed files with 4312 additions and 0 deletions

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "5dfb07e0-d394-4993-857e-1c08a27738a1",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "8490c2f5-e3a2-40a8-9b2d-793ed0c74eb1",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
{
"ver": "1.3.2",
"uuid": "dc38c4b9-5372-4f4c-af06-57a7558043f0",
"importer": "prefab",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "c77dad7f-9228-4531-a275-7bfab716675f",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "8f0d2e7e-6e89-4ceb-9c28-dd20095e18ba",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,21 @@
import getDecorators from "inversify-inject-decorators";
import { Chip } from "../../../chip/scripts/chip";
import { container } from "../../../plugins/core";
import { RequestChangeBetOption } from "../system/request-change-bet-option";
const { ccclass, property } = cc._decorator;
const { lazyInject } = getDecorators(container);
@ccclass
export default class BetOptionOnClick extends cc.Component
{
@property(RequestChangeBetOption)
private requestChangeBetOption: RequestChangeBetOption = null;
@property(Chip)
private chip: Chip = null;
private onClick(): void
{
this.requestChangeBetOption.request(this.chip.getChipValue());
}
}

View File

@ -0,0 +1,10 @@
{
"ver": "1.1.0",
"uuid": "3e0a4e6d-2d3e-4e24-acaf-4b5a7cc894ea",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -0,0 +1,32 @@
import getDecorators from "inversify-inject-decorators";
import { container } from "../../../plugins/core";
const { ccclass, property } = cc._decorator;
const { lazyInject } = getDecorators(container);
@ccclass
export class ListBetOptionComponent extends cc.Component
{
private isShow: boolean = false;
@property(cc.Node)
private nodeContainer: cc.Node = null;
protected onLoad(): void
{
this.hide();
}
private show(): void
{
if (this.isShow == true) return;
this.isShow = true;
this.nodeContainer.active = true;
}
private hide(): void
{
if (this.isShow == false) return;
this.isShow = false;
this.nodeContainer.active = false;
}
}

View File

@ -0,0 +1,10 @@
{
"ver": "1.1.0",
"uuid": "b97b1fa5-3f92-4ad8-b2e1-8122e3d44c98",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "4a0e5978-9cec-4078-b874-08e87223482e",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,18 @@
import getDecorators from "inversify-inject-decorators";
import { BetOptionController, container, CONTROLLER } from "../../../plugins/core";
const { ccclass, property } = cc._decorator;
const { lazyInject } = getDecorators(container, false);
@ccclass
export class RequestChangeBetOption extends cc.Component
{
@lazyInject(CONTROLLER.BetOption)
private betOptionController: BetOptionController;
public request(value): void
{
this.betOptionController.changeBetOption(value);
}
}

View File

@ -0,0 +1,10 @@
{
"ver": "1.1.0",
"uuid": "d6167141-9f81-4e6d-9b8d-02d8f644a0aa",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -0,0 +1,55 @@
import getDecorators from "inversify-inject-decorators";
import { Chip } from "../../../chip/scripts/chip";
import { container, GAME_VIEW, ListBetOptionModel, MODEL, SelectedBetOptionModel } from "../../../plugins/core";
const { ccclass, property } = cc._decorator;
const { lazyInject } = getDecorators(container, false);
@ccclass
export class UpdateListBetOptionOnDataChange extends cc.Component implements Core.View.ComponentView
{
@lazyInject(GAME_VIEW.BetOption)
private gameViewBetOption: Core.View.GameView;
@lazyInject(MODEL.ListBetOption)
private listBetOptionModel: ListBetOptionModel;
@lazyInject(MODEL.SelectedBetOption)
private selectedBetOptionModel: SelectedBetOptionModel;
@property(Chip)
private selectedChip: Chip = null;
@property(Chip)
private listBetOptionChip: Chip[] = [];
protected onLoad(): void
{
this.gameViewBetOption.addComponent(this);
}
public render()
{
this.updateListBetOptionValue();
}
public updateListBetOptionValue(): void
{
this.selectedChip.setChipValue(this.selectedBetOptionModel.selectedBetOption);
var listChipSelect = [];
this.listBetOptionModel.listBetOption.forEach(betOption =>
{
if (betOption != this.selectedBetOptionModel.selectedBetOption)
{
listChipSelect.push(betOption);
}
});
var minLength = Math.min(this.listBetOptionChip.length, listChipSelect.length);
for (let index = 0; index < minLength; index++)
{
var betOption = listChipSelect[index];
this.listBetOptionChip[index].setChipValue(betOption);
}
}
}

View File

@ -0,0 +1,10 @@
{
"ver": "1.1.0",
"uuid": "cc3d7615-0d8e-4fb0-9c94-e033503b3e5e",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}