lawless/client/assets/scripts/scenes/BattleScene.ts

43 行
1.1 KiB
TypeScript

import { _decorator, Component, Button, Label } from 'cc';
import { GameManager } from '../core/GameManager';
const { ccclass, property } = _decorator;
/**
* BattleScene ATB
*/
@ccclass('BattleScene')
export class BattleScene extends Component {
@property({ type: Label })
public reportLabel: Label | null = null;
@property({ type: Button })
public closeButton: Button | null = null;
private _battleId: string = '';
onLoad() {
this.closeButton?.node.on(Button.EventType.CLICK, this.onClose, this);
}
public init(battleId: string) {
this._battleId = battleId;
this.loadReport();
}
private async loadReport() {
// TODO: BattleService/GetBattleReport
if (this.reportLabel) {
this.reportLabel.string = `战斗 ${this._battleId} 战报加载中...`;
}
}
private onClose() {
GameManager.getInstance().switchScene('LobbyScene');
}
onDestroy() {
this.closeButton?.node.off(Button.EventType.CLICK, this.onClose, this);
}
}