Commit 9f6c5c0b authored by limingzhe's avatar limingzhe

fix: debug

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