System.register(["cc"], function (_export, _context) { "use strict"; var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, director, TweenSystem, PhysicsSystem, PhysicsSystem2D, AnimationManager, sp, Animation, DirectorUtil, _crd; _export("default", void 0); return { setters: [function (_cc) { _cclegacy = _cc.cclegacy; __checkObsolete__ = _cc.__checkObsolete__; __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__; director = _cc.director; TweenSystem = _cc.TweenSystem; PhysicsSystem = _cc.PhysicsSystem; PhysicsSystem2D = _cc.PhysicsSystem2D; AnimationManager = _cc.AnimationManager; sp = _cc.sp; Animation = _cc.Animation; }], execute: function () { _crd = true; _cclegacy._RF.push({}, "0dd04xSWM1G07cwb9c87Tja", "DirectorUtil", undefined); __checkObsolete__(['director']); __checkObsolete__(['TweenSystem']); __checkObsolete__(['PhysicsSystem']); __checkObsolete__(['PhysicsSystem2D']); __checkObsolete__(['AnimationManager']); __checkObsolete__(['sp']); __checkObsolete__(['Animation', 'AnimationState', 'Node']); _export("default", DirectorUtil = class DirectorUtil { /**暂停游戏 */ static pause(config_) { if (this.pause_data.state_b) return; // 暂停定时器 this.pause_data.scheduler_as = director.getScheduler().pauseAllTargets(); // 暂停当前动画 { var anim_system = director.getSystem(AnimationManager.ID); this.pause_data.anim_as.splice(0, this.pause_data.anim_as.length, ...anim_system["_anims"].array); this.pause_data.anim_as.forEach(v1 => { v1.pause(); }); } // 暂停spine动画 { this.pause_data.spine_as = director.getScene().getComponentsInChildren(sp.Skeleton); this.pause_data.spine_as.forEach(v1 => { v1.timeScale = 0; }); } // 暂停龙骨动画 // { //this.pause_data.dragon_bones_as = director.getScene().getComponentsInChildren(dragonBones.ArmatureDisplay); //this.pause_data.dragon_bones_as.forEach(v1 => {v1.timeScale = 0;}); //} // 暂停当前缓动 this.pause_data.tween_target_as = TweenSystem.instance.ActionManager.pauseAllRunningActions(); // 暂停物理系统 { if (PhysicsSystem2D && PhysicsSystem2D.instance.enable) { this.pause_data.physics_2d_b = PhysicsSystem2D.instance.enable; PhysicsSystem2D.instance.enable = false; } if (PhysicsSystem && PhysicsSystem.instance.enable) { this.pause_data.physics_3d_b = PhysicsSystem.instance.enable; PhysicsSystem.instance.enable = false; } } // 恢复排除节点 if (config_) { var _config_$recu_exclude; var exclude_as = []; exclude_as.push(...config_.exclude_as); (_config_$recu_exclude = config_.recu_exclude_as) == null || _config_$recu_exclude.forEach(v1 => { exclude_as.push(...this.recu_node_list(v1)); }); exclude_as.forEach(v1 => { this.resume_node(v1); }); } this.pause_data.state_b = true; } static recu_node_list(node_, result_as) { if (result_as === void 0) { result_as = []; } if (!node_) { return result_as; } result_as.push(node_); node_.children.forEach(v1 => { result_as.push(v1); this.recu_node_list(v1); }); return result_as; } /**恢复游戏 */ static resume() { // 恢复定时器 director.getScheduler().resumeTargets(this.pause_data.scheduler_as); // 恢复动画 this.pause_data.anim_as.forEach(v1 => { if (v1.isPlaying && v1.isPaused) { v1.play(); } }); // 恢复龙骨动画 //this.pause_data.dragon_bones_as.forEach(v1 => { //v1.timeScale = 1; //}); this.pause_data.spine_as.forEach(v1 => { v1.timeScale = 1; }); // 恢复缓动 TweenSystem.instance.ActionManager.resumeTargets(this.pause_data.tween_target_as); // 恢复物理系统 { if (this.pause_data.physics_2d_b) { PhysicsSystem2D.instance.enable = this.pause_data.physics_2d_b; } if (this.pause_data.physics_3d_b) { PhysicsSystem.instance.enable = this.pause_data.physics_3d_b; } } this.pause_data.state_b = false; } /**暂停节点 * -物理系统需手动启用/禁用 */ static pause_node(args1_) { var node_as; if (Array.isArray(args1_)) { node_as = args1_; } else { node_as = [args1_]; } node_as.forEach(v1 => { var _v1$getComponent; // 暂停定时器 director.getScheduler().pauseTarget(v1); // 暂停动画 (_v1$getComponent = v1.getComponent(Animation)) == null || _v1$getComponent.pause(); //暂停spine动画 if (v1.getComponent(sp.Skeleton)) { v1.getComponent(sp.Skeleton).timeScale = 0; } // 暂停龙骨 //if (v1.getComponent(dragonBones.ArmatureDisplay)) { //v1.getComponent(dragonBones.ArmatureDisplay).timeScale = 0; //} // 暂停缓动 TweenSystem.instance.ActionManager.pauseTarget(v1); }); } /**恢复节点 */ static resume_node(args1_) { var node_as; if (Array.isArray(args1_)) { node_as = args1_; } else { node_as = [args1_]; } node_as.forEach(v1 => { var _v1$getComponent2; // 恢复定时器 director.getScheduler().resumeTarget(v1); // 恢复动画 (_v1$getComponent2 = v1.getComponent(Animation)) == null || _v1$getComponent2.resume(); //恢复spine动画 if (v1.getComponent(sp.Skeleton)) { v1.getComponent(sp.Skeleton).timeScale = 1; } //恢复龙骨 //if (v1.getComponent(dragonBones.ArmatureDisplay)) { //v1.getComponent(dragonBones.ArmatureDisplay).timeScale = 1; //} // 恢复缓动 TweenSystem.instance.ActionManager.resumeTarget(v1); }); } // }); //没有用到龙骨 dragon_bones_as:dragonBones.ArmatureDisplay[] DirectorUtil.pause_data = { /**暂停状态 */ state_b: false, /**2d物理系统状态 */ physics_2d_b: false, /**3d物理系统状态 */ physics_3d_b: false, /**定时器对象列表 */ scheduler_as: [], /**动画列表 */ anim_as: [], /**缓动对象列表 */ tween_target_as: [], /**龙骨组件列表 */ //dragon_bones_as:[], spine_as: [] }; _cclegacy._RF.pop(); _crd = false; } }; }); //# sourceMappingURL=a1b3c5a95f69b723730bd0dbf203c64c27bca2ef.js.map