Commit bf32a77e authored by limingzhe's avatar limingzhe

fix: debug

parent 01f8c8f7
...@@ -258,7 +258,13 @@ cc.Class({ ...@@ -258,7 +258,13 @@ cc.Class({
.start(); .start();
await asyncDelay(0.6); await asyncDelay(0.6);
if (isDestroy) {
return;
}
await asyncTweenTo(starBig, 0.8, { scale: 0 }, { easing: 'quadOut' }); await asyncTweenTo(starBig, 0.8, { scale: 0 }, { easing: 'quadOut' });
if (this.isDestroy) {
return;
}
await this.playAudioSync('question'); await this.playAudioSync('question');
}, },
...@@ -283,7 +289,7 @@ cc.Class({ ...@@ -283,7 +289,7 @@ cc.Class({
}; };
this.createStars(); this.createStars();
await this.showGuns(); await this.showGuns();
await this.playQuestionAudio(); await this.playQuestionAudio();
this.startShowBalls(); this.startShowBalls();
}, },
...@@ -485,6 +491,9 @@ cc.Class({ ...@@ -485,6 +491,9 @@ cc.Class({
} }
this.speakerBlink(); this.speakerBlink();
await playAudioByUrlSync(currentQuestion.questionAudio); await playAudioByUrlSync(currentQuestion.questionAudio);
if (this.isDestroy) {
return;
}
this.speakerStopBlink(); this.speakerStopBlink();
}, },
...@@ -525,6 +534,9 @@ cc.Class({ ...@@ -525,6 +534,9 @@ cc.Class({
asyncTweenTo(Water, 0.1, { angle: -angle }); asyncTweenTo(Water, 0.1, { angle: -angle });
await asyncTweenTo(Gun, 0.1, { angle: angle, scaleY: 0.95 }); await asyncTweenTo(Gun, 0.1, { angle: angle, scaleY: 0.95 });
if (this.isDestroy) {
return;
}
let startPos = exchangeNodePos(bg, Muzzle); let startPos = exchangeNodePos(bg, Muzzle);
bullet.x = startPos.x; bullet.x = startPos.x;
bullet.y = startPos.y; bullet.y = startPos.y;
...@@ -543,6 +555,10 @@ cc.Class({ ...@@ -543,6 +555,10 @@ cc.Class({
scaleX: Between(0.5, 1, bullet.height / flySide.mag()) scaleX: Between(0.5, 1, bullet.height / flySide.mag())
}); });
if (this.isDestroy) {
return;
}
bullet.setAnchorPoint(0.5, 1); bullet.setAnchorPoint(0.5, 1);
bullet.x = targetPos.x; bullet.x = targetPos.x;
bullet.y = targetPos.y; bullet.y = targetPos.y;
...@@ -562,7 +578,13 @@ cc.Class({ ...@@ -562,7 +578,13 @@ cc.Class({
.start(); .start();
await this.playAudioSync('right'); await this.playAudioSync('right');
if (this.isDestroy) {
return;
}
await playAudioByUrlSync(node.audio); await playAudioByUrlSync(node.audio);
if (this.isDestroy) {
return;
}
node.removeFromParent(); node.removeFromParent();
}, },
...@@ -572,10 +594,19 @@ cc.Class({ ...@@ -572,10 +594,19 @@ cc.Class({
let offsetX = RandomInt(20, 50) * 2 * (RandomInt(2) - 0.5); let offsetX = RandomInt(20, 50) * 2 * (RandomInt(2) - 0.5);
let offsetY = RandomInt(20, 50) * 2 * (RandomInt(2) - 0.5); let offsetY = RandomInt(20, 50) * 2 * (RandomInt(2) - 0.5);
await asyncTweenBy(node, 0.05, { x: offsetX, y: offsetY }); await asyncTweenBy(node, 0.05, { x: offsetX, y: offsetY });
if (this.isDestroy) {
return;
}
offsetX = RandomInt(20, 50) * 2 * (RandomInt(2) - 0.5); offsetX = RandomInt(20, 50) * 2 * (RandomInt(2) - 0.5);
offsetY = RandomInt(20, 50) * 2 * (RandomInt(2) - 0.5); offsetY = RandomInt(20, 50) * 2 * (RandomInt(2) - 0.5);
await asyncTweenBy(node, 0.05, { x: offsetX, y: offsetY }); await asyncTweenBy(node, 0.05, { x: offsetX, y: offsetY });
if (this.isDestroy) {
return;
}
await asyncTweenTo(node, 0.05, { x: x }); await asyncTweenTo(node, 0.05, { x: x });
if (this.isDestroy) {
return;
}
}, },
playAudio(audioName, cb, value = 0.8) { playAudio(audioName, cb, value = 0.8) {
...@@ -602,5 +633,6 @@ cc.Class({ ...@@ -602,5 +633,6 @@ cc.Class({
onDestroy() { onDestroy() {
this.stopShowBalls(); this.stopShowBalls();
this.isDestroy = true;
}, },
}); });
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