32 lines
953 B
TypeScript
32 lines
953 B
TypeScript
import { _decorator, Component, Label, Node } from 'cc';
|
|
import BEConnector from '../API/BEConnector';
|
|
import { GameManager } from '../Manager/GameManager';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('ConfirmPanel')
|
|
export class ConfirmPanel extends Component {
|
|
@property(Label) ticketWaringText: Label = null;
|
|
|
|
protected onEnable(): void {
|
|
this.ticketWaringText.string = `To continue playing, you will be deducted ${BEConnector.getTicketCanBeMinus()} ticket`;
|
|
}
|
|
|
|
onClickYesButton() {
|
|
if (BEConnector.canRelive()) {
|
|
BEConnector.checkGameScoreTicket()
|
|
.then(() => {
|
|
GameManager.instance.gameRelive();
|
|
})
|
|
.catch(() => {
|
|
GameManager.instance.gameOver();
|
|
});
|
|
} else {
|
|
BEConnector.postMessage();
|
|
}
|
|
}
|
|
|
|
onClickNoButton() {
|
|
this.node.setActive(false);
|
|
}
|
|
}
|