pinball/assets/_Game/Scripts/UI/ConfirmPanel.ts

32 lines
953 B
TypeScript
Raw Normal View History

2024-03-26 00:28:59 -07:00
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 {
2024-05-07 03:20:37 -07:00
this.ticketWaringText.string = `To continue playing, you will be deducted ${BEConnector.getTicketCanBeMinus()} ticket`;
2024-03-26 00:28:59 -07:00
}
onClickYesButton() {
2024-05-07 03:20:37 -07:00
if (BEConnector.canRelive()) {
BEConnector.checkGameScoreTicket()
2024-03-26 00:28:59 -07:00
.then(() => {
GameManager.instance.gameRelive();
})
.catch(() => {
GameManager.instance.gameOver();
});
} else {
2024-05-07 03:20:37 -07:00
BEConnector.postMessage();
2024-03-26 00:28:59 -07:00
}
}
onClickNoButton() {
2024-05-07 03:20:37 -07:00
this.node.setActive(false);
2024-03-26 00:28:59 -07:00
}
}