123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- export class GameLogicMgr {
- private static _inst: GameLogicMgr;
- public static get inst(): GameLogicMgr {
- if (this._inst == null) {
- this._inst = new GameLogicMgr();
- this._inst.init();
- }
- return this._inst;
- }
- isGamePause: boolean = false;
- switch(){
- this.isGamePause = !this.isGamePause;
- //@ts-ignore
- dragonBones.timeScale = this.isGamePause ? 0 : 1;
- }
- init(){
- //@ts-ignore
- let aniMgr = cc.director.getAnimationManager();
-
- if(!CC_EDITOR){
- aniMgr._oldUpdate = aniMgr.update;
- aniMgr.update = function(dt){
- if(GameLogicMgr.inst.isGamePause) return;
- aniMgr._oldUpdate(dt);
- }
- }
- }
- };
- export class GameLogic extends cc.Component {
- logicId:number;
- update(dt: number): void {
- if(GameLogicMgr.inst.isGamePause) return;
- this.gameUpdate(dt);
- }
- gameUpdate(dt:number): void {
- };
- }
|