项目中,我有一个A节点。A节点 active 在 onLoad 方法中置为 false 了。而且给A节点添加了触摸方法。 切换标签回来后,active 还是 false。但是节点触摸方法却可以调用了。这是为什么?
这是一个 bug,你用的是哪个版本?
v1.2.0
请问有什么临时的解决方案吗?
这个问题在新版本中已经修复了,可以等一下 1.2.2,也可以尝试下面的改写:
cc.game.pause = function () {
if (this._paused) return;
this._paused = true;
// Pause audio engine
if (cc.audioEngine) {
_isMusicPlaying = cc.audioEngine.isMusicPlaying();
cc.audioEngine.stopAllEffects();
cc.audioEngine.pauseMusic();
}
// Pause main loop
if (this._intervalId)
window.cancelAnimationFrame(this._intervalId);
this._intervalId = 0;
};
cc.game.resume = function () {
if (!this._paused) return;
this._paused = false;
// Resume audio engine
if (cc.audioEngine && _isMusicPlaying) {
cc.audioEngine.resumeMusic();
}
// Resume main loop
this._runMainLoop();
};
恩。谢谢!!