Commit d2330e49 authored by liujiangnan's avatar liujiangnan

fix: 主动释放

parent f7f058c2
...@@ -14,6 +14,13 @@ cc.Class({ ...@@ -14,6 +14,13 @@ cc.Class({
this.initSize(); this.initSize();
}, },
// 生命周期
onDestroy() {
if(this.timeA){
clearTimeout(this.timeA);
}
},
_imageResList: null, _imageResList: null,
_audioResList: null, _audioResList: null,
_animaResList: null, _animaResList: null,
...@@ -329,6 +336,7 @@ cc.Class({ ...@@ -329,6 +336,7 @@ cc.Class({
this.playEffect('jumpAll'); this.playEffect('jumpAll');
}, },
timeA: null,
nextQuestion() { nextQuestion() {
const box = cc.find('Canvas/bg/box'); const box = cc.find('Canvas/bg/box');
box.children.forEach(child => { box.children.forEach(child => {
...@@ -340,7 +348,7 @@ cc.Class({ ...@@ -340,7 +348,7 @@ cc.Class({
this.status.currentQuestionIdx++; this.status.currentQuestionIdx++;
if (this.status.currentQuestionIdx < this.data.question_arr.length) { if (this.status.currentQuestionIdx < this.data.question_arr.length) {
setTimeout(() => { this.timeA = setTimeout(() => {
this.jumpToQuestion(this.status.currentQuestionIdx); this.jumpToQuestion(this.status.currentQuestionIdx);
}, 0.1 * 1000); }, 0.1 * 1000);
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment