Commit 11b9a26c authored by limingzhe's avatar limingzhe

fix: debug

parent bf32a77e
...@@ -168,18 +168,27 @@ cc.Class({ ...@@ -168,18 +168,27 @@ cc.Class({
const BtnStart = cc.find('Canvas/bg/BtnStart'); const BtnStart = cc.find('Canvas/bg/BtnStart');
addBtnListener(BtnStart, async () => { addBtnListener(BtnStart, async () => {
await asyncTweenTo(BtnStart, 0.1, { opacity: 0 }); await asyncTweenTo(BtnStart, 0.1, { opacity: 0 });
if (this.isDestroy) {
return;
}
BtnStart.active = false; BtnStart.active = false;
this.gameStart(); this.gameStart();
}, this.playAudio.bind(this, 'btn')); }, this.playAudio.bind(this, 'btn'));
const BtnRestart = cc.find('Canvas/bg/BtnRestart'); const BtnRestart = cc.find('Canvas/bg/BtnRestart');
addBtnListener(BtnRestart, async () => { addBtnListener(BtnRestart, async () => {
await asyncTweenTo(BtnRestart, 0.1, { opacity: 0 }); await asyncTweenTo(BtnRestart, 0.1, { opacity: 0 });
if (this.isDestroy) {
return;
}
BtnRestart.active = false; BtnRestart.active = false;
this.gameStart(); this.gameStart();
}, this.playAudio.bind(this, 'btn')); }, this.playAudio.bind(this, 'btn'));
const BtnSpeaker = cc.find('Canvas/bg/BtnSpeaker'); const BtnSpeaker = cc.find('Canvas/bg/BtnSpeaker');
addBtnListener(BtnSpeaker, async () => { addBtnListener(BtnSpeaker, async () => {
await this.playQuestionAudio(); await this.playQuestionAudio();
if (this.isDestroy) {
return;
}
}); });
const bg = cc.find('Canvas/bg'); const bg = cc.find('Canvas/bg');
...@@ -289,8 +298,14 @@ cc.Class({ ...@@ -289,8 +298,14 @@ cc.Class({
}; };
this.createStars(); this.createStars();
await this.showGuns(); await this.showGuns();
if (this.isDestroy) {
return;
}
await this.playQuestionAudio(); await this.playQuestionAudio();
if (this.isDestroy) {
return;
}
this.startShowBalls(); this.startShowBalls();
}, },
...@@ -395,6 +410,9 @@ cc.Class({ ...@@ -395,6 +410,9 @@ cc.Class({
} }
const location = event.getLocation(); const location = event.getLocation();
await this.shootTarget(ball, location, true); await this.shootTarget(ball, location, true);
if (this.isDestroy) {
return;
}
if (!answer.rightAnswer) { if (!answer.rightAnswer) {
this.targetLaugh(ball); this.targetLaugh(ball);
return; return;
...@@ -407,14 +425,26 @@ cc.Class({ ...@@ -407,14 +425,26 @@ cc.Class({
this.gameNextFlag = true; this.gameNextFlag = true;
this.stopShowBalls(); this.stopShowBalls();
await asyncDelay(0.5); await asyncDelay(0.5);
if (this.isDestroy) {
return;
}
await this.showStar(); await this.showStar();
if (this.isDestroy) {
return;
}
this._status.currentRightNumber = 0; this._status.currentRightNumber = 0;
this._status.currentQuestionIdx++; this._status.currentQuestionIdx++;
if (this.isEndGame()) { if (this.isEndGame()) {
this.onGameEnd(); this.onGameEnd();
} else { } else {
await asyncDelay(1.5); await asyncDelay(1.5);
if (this.isDestroy) {
return;
}
await this.playQuestionAudio(); await this.playQuestionAudio();
if (this.isDestroy) {
return;
}
this.startShowBalls(); this.startShowBalls();
} }
this.gameNextFlag = false; this.gameNextFlag = false;
......
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