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

43 行
1.1 KiB
TypeScript

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

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);
}
}