squidGame/tgx-games-client/assets/level1/Script/settlementView.ts

81 lines
1.9 KiB
TypeScript
Raw Permalink Normal View History

2025-02-21 10:45:46 +08:00
import { _decorator, Button, Component, instantiate, Label, Node } from "cc";
import {IRewardData} from "db://assets/module_basic/shared/protocols/public/arean/AreanTypeDef";
import {RewardItem} from "db://assets/module_arean/ui_common_reward/RewardItem";
import { areanMgr } from "../../module_arean/scripts/AreanManager";
import { AreanNetMgr } from "../../module_arean/scripts/AreanNetMgr";
const { ccclass, property } = _decorator;
@ccclass('settlementView')
export class settlementView extends Component {
@property(Node)
spineRole: Node;
@property(Button)
btnContinue: Button;
@property(Button)
btnExit: Button;
@property(Label)
rankLabel: Label;
@property(Node)
danTips: Node;
@property(Node)
starNode: Node;
@property(Node)
rewardNode: Node;
private _curRank: number = 0;
private _curDanInfo: any = null;
public setData(rank: number) {
this._curRank = rank;
this.rankLabel.string = rank + "";
let role = areanMgr.BattleView.seatRole[areanMgr.BattleView.getLocalPlayerId()];
let newNode = new Node();
if (role) {
newNode = instantiate(role.node);
newNode.active = true;
newNode.setScale(1, 1);
newNode.setPosition(0, 0);
newNode.setParent(this.spineRole);
role.roleNode.getChildByName("effectNode").removeAllChildren();
}
}
// 更新段位
closeWin() {
this.node.removeFromParent();
}
exitGame() {
AreanNetMgr.inst.sendMsg_exit();
}
/** 展示奖励 */
public updateRewards(items : IRewardData[]) : void{
let len = items.length;
for (let i = 0; i < len; i++) {
let data = items[0];
let node = this.rewardNode.getChildByName(`RewardItem_${i + 1}`);
node.active = true;
node.getComponent(RewardItem).initData(data);
}
}
}