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 { }; }