38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { _decorator, Component, Label, Node } from 'cc';
|
|
import BEConnector from '../../../Scripts/BEConnector';
|
|
import { GameplayController, GameState } from '../../../Scripts/GameplayController';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('GameOverPanel')
|
|
export class GameOverPanel extends Component {
|
|
@property(Label) private topScore: Label = null;
|
|
@property(Label) private yourScore: Label = null;
|
|
|
|
|
|
protected onEnable(): void {
|
|
let currentScore = GameplayController.Instance().score;
|
|
this.topScore.string = BEConnector.instance.maxScore.toString();
|
|
this.yourScore.string = currentScore.toString();
|
|
this.scheduleOnce(this.endGame,60);
|
|
}
|
|
|
|
onClickYesButton(){
|
|
let confirmPanel = this.node.getChildByName("ConfirmPanel");
|
|
confirmPanel.active = true;
|
|
}
|
|
|
|
onClickNoButton(){
|
|
GameplayController.Instance().ChangeGameState(GameState.EndGame);
|
|
}
|
|
|
|
protected onDisable(): void {
|
|
this.unschedule(this.endGame);
|
|
}
|
|
|
|
private endGame(){
|
|
GameplayController.Instance().ChangeGameState(GameState.EndGame);
|
|
}
|
|
}
|
|
|
|
|