50 lines
2.2 KiB
TypeScript
50 lines
2.2 KiB
TypeScript
/************************************************************************************
|
|
|
|
* FileName : UICommonReward.ts
|
|
* Description :
|
|
* Version : v1.0.0
|
|
* CreateTime : 2024-12-11 21:36:15
|
|
* Author :
|
|
* Copyright (c) 2024
|
|
* ==============================================================
|
|
* Method Description:
|
|
*
|
|
* ==============================================================
|
|
************************************************************************************/
|
|
import {GameUILayers} from "db://assets/scripts/GameUILayers";
|
|
import {tgx_class} from "db://assets/core_tgx/base/ModuleContext";
|
|
import {ModuleDef} from "db://assets/scripts/ModuleDef";
|
|
import {tgxAudioMgr, tgxUIController} from "db://assets/core_tgx/tgx";
|
|
import {Layout_UICommonReward} from "db://assets/module_arean/ui_common_reward/Layout_UICommonReward";
|
|
import { instantiate,Node } from "cc";
|
|
import {RewardItem} from "db://assets/module_arean/ui_common_reward/RewardItem";
|
|
import { EMusicDefine } from "../../module_basic/scripts/MusicDefine";
|
|
import {IRewardData} from "../../../../tgx-games-server/src/shared/protocols/public/arean/AreanTypeDef";
|
|
@tgx_class(ModuleDef.Arean)
|
|
export class UICommonReward extends tgxUIController{
|
|
constructor() {
|
|
super("res/Prefebs/Common/CommonReward", GameUILayers.POPUP,Layout_UICommonReward)
|
|
}
|
|
|
|
protected onCreated(params: IRewardData[]) {
|
|
let layout = this.layout as Layout_UICommonReward;
|
|
this.onButtonEvent(layout.closeBtn,()=>{
|
|
tgxAudioMgr.inst.playCommonBtn(EMusicDefine.EFFECT_CLOSE);
|
|
this.close();
|
|
})
|
|
this._initList(params);
|
|
}
|
|
|
|
private _initList(params:IRewardData[]) : void {
|
|
let layout : Layout_UICommonReward = this.layout as Layout_UICommonReward;
|
|
layout.content.destroyAllChildren();
|
|
let len = params.length;
|
|
for (let i : number = 0; i < len; i++) {
|
|
let element = params[i];
|
|
let node : Node = instantiate(layout.itemCell);
|
|
layout.content.addChild(node);
|
|
node.active = true;
|
|
node.getComponent(RewardItem).initData(element)
|
|
}
|
|
}
|
|
} |