123456789101112131415161718192021222324252627282930313233343536373839 |
- import { _decorator, EventTouch} from 'cc';
- import { BaseExp } from '../core/base/BaseExp';
- import { uiMgr } from '../core/manager/UIManager';
- import { Constants } from '../data/Constants';
- import { Game } from '../game/Game';
- const { ccclass, property } = _decorator;
- //暂停游戏
- @ccclass('PauseUI')
- export class PauseUI extends BaseExp {
- public show(...args: any[]){
- this.hasAnim = true;
- this.closeOnBlank = false;
- Game.I.isPause = true;
- uiMgr.getPageComponent(Constants.mainUIs.main)?.playOrStopBGM(false);
- }
- /**
- * 按钮点击事件
- * @param event 事件
- * @param param 参数
- */
- override onBtnClicked(event:EventTouch, customEventData:any) {
- super.onBtnClicked(event,customEventData);
- let btnName = event.target.name;
- if(btnName === 'back_main_btn'){//返回首页
- Game.I.isGameOver = true;
- uiMgr.pop(Constants.mainUIs.main);
- uiMgr.getPageComponent(Constants.mainUIs.main)?.playBGM();
- }else if(btnName === 'continue_btn'){
- uiMgr.hide(Constants.popUIs.pauseUI,()=>{
- Game.I.isPause = false;
- uiMgr.getPageComponent(Constants.mainUIs.main)?.playOrStopBGM(true);
- });
- }
- }
- }
|