import { _decorator, director, PhysicsSystem2D } from 'cc';
import { ModulerBase } from '../../GameFrameWork/ModulerBase';
import { GameInfo } from '../../../GameInfo';
const { ccclass, property } = _decorator;

@ccclass('Pause')
export class Pause extends ModulerBase {
    protected onStart() {
        this.onBtnClick("_back", this._onBtnBack, this);
        this.onBtnClick("_continue", this._onContinue, this);
        this.onBtnClick("_btnPause", this._onPause, this)
    }
    //暂停
    private _onPause() {
        GameInfo.Instance.setIsGameOver(true);
        director.pause();
        this.getNode("_pause").active = true;
    }
    //返回开始场景
    private _onBtnBack() {
        this.getNode("_pause").active = false;
        director.loadScene("StartScene", () => {
            director.resume();
            GameInfo.Instance.setIsGameOver(false);
        });
    }
    //继续游戏
    private _onContinue() {
        this.getNode("_pause").active = false;
        director.resume();
        GameInfo.Instance.setIsGameOver(false)
    }
}


