43 行
1.1 KiB
TypeScript
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);
|
||
}
|
||
}
|