Commit 9f6c5c0b authored by limingzhe's avatar limingzhe

fix: debug

parent 6a385fc3
......@@ -370,7 +370,10 @@ cc.Class({
onDestroy() {
this.gameLogic.onDestroy();
this.gameLogic = null;
},
......
......@@ -26,6 +26,9 @@ export default class GameLogic {
m_isPlayingAudio = false;
m_sysIntervalId = null;
timeIdArr = [];
timeIntervalIdArr = [];
constructor(formData, systemOption) {
this.g_systemOption = systemOption;
this.g_imageResList = this.g_systemOption.imageResList;
......@@ -151,9 +154,9 @@ export default class GameLogic {
let a = btn_lion.node.getComponent(dragonBones.ArmatureDisplay)
a.playAnimation(aniName, 1);
setTimeout(() => {
this.timeIdArr.push(setTimeout(() => {
a.playAnimation(aniName, -1);
}, 3200);
}, 3200));
}
......@@ -178,6 +181,7 @@ export default class GameLogic {
currentIdx++;
speakers[currentIdx%num].active = true;
}, 200);
this.timeIntervalIdArr.push(intervalId);
}
btn_speaker.stopAni = ()=>{
......@@ -320,6 +324,8 @@ export default class GameLogic {
}
})
}, 30)
this.timeIntervalIdArr.push(this.m_sysIntervalId);
}
initStar() {
......@@ -428,13 +434,13 @@ export default class GameLogic {
bubb.node.getChildByName("image").active = false;
for(let i=0; i<8; i++) {
_p.push(new Promise((resolve,reject) => {
setTimeout(() => {
this.timeIdArr.push(setTimeout(() => {
if(i>1) {
bubb.node.getChildByName(`bubble_ani (${i})`).active = false;
}
bubb.node.getChildByName(`bubble_ani (${i+1})`).active = true;
resolve()
}, 30 * i);
}, 30 * i));
}))
}
return Promise.all(_p)
......@@ -569,10 +575,10 @@ export default class GameLogic {
this.m_bubblesAll = this.save;
return new Promise((resolve, reject)=>{
setTimeout(() => {
this.timeIdArr.push(setTimeout(() => {
resolve();
this.enableClick("DestroyBubbles")
}, 1100);
}, 1100));
})
}
......@@ -614,12 +620,12 @@ export default class GameLogic {
bubble.move.vX = vArr[count%4].vX
bubble.move.vY = vArr[count%4].vY
count++;
setTimeout(() => {
this.timeIdArr.push(setTimeout(() => {
this.g_cartoon.playAudio("出现")
this.g_cartoon.tweenChange(bubble.node, {scale: this.m_maxScale, x: bubble.move.x, y: bubble.move.y}, 3, _=>{
resolve()
})
}, 200 * index);
}, 200 * index));
})
pAll.push(_p)
}
......@@ -683,9 +689,9 @@ export default class GameLogic {
asyncDelay(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
this.timeIdArr.push(setTimeout(() => {
resolve();
}, time * 1000);
}, time * 1000));
})
}
......@@ -983,4 +989,18 @@ export default class GameLogic {
// console.log(`Click enabled! [${eventName}]`)
}
onDestroy() {
this.timeIdArr.forEach(id => {
clearTimeout(id);
});
this.timeIdArr = [];
this.timeIntervalIdArr.forEach(id => {
clearInterval(id);
});
this.timeIntervalIdArr = [];
}
}
......@@ -4,5 +4,6 @@
"name": "play",
"id": "9af72fd2-44a6-4131-8ea3-3e1b3fa22231",
"version": "2.4.5",
"isNew": false
"isNew": false,
"description": ""
}
\ No newline at end of file
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