Commit f9f78e27 authored by LMZ's avatar LMZ

feat: 重新开始按钮 点不动

parent ded3a0a7
......@@ -912,23 +912,10 @@ export class PlayComponent implements OnInit, OnDestroy {
return;
}
if (this.checkClickTarget(this.leftBox.boxBg)) {
this.clickBox(this.leftBox);
return;
}
if (this.checkClickTarget(this.midBox.boxBg)) {
this.clickBox(this.midBox);
return;
}
if (this.checkClickTarget(this.rightBox.boxBg)) {
this.clickBox(this.rightBox);
return;
}
if (this.checkClickTarget(this.restartBtn.bg)) {
console.log("this.restartBtn.isHide: ", this.restartBtn.isHide);
if (this.restartBtn.isHide) {
return;
}
......@@ -936,6 +923,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.restartBtn.isHide = true;
this.canTouch = false;
console.log(' this.canTouch = false; 3')
this.restartBtn.click(() => {
......@@ -957,9 +945,28 @@ export class PlayComponent implements OnInit, OnDestroy {
});
});
});
return;
}
if (this.checkClickTarget(this.leftBox.boxBg)) {
this.clickBox(this.leftBox);
return;
}
if (this.checkClickTarget(this.midBox.boxBg)) {
this.clickBox(this.midBox);
return;
}
if (this.checkClickTarget(this.rightBox.boxBg)) {
this.clickBox(this.rightBox);
return;
}
}
mapMove(event) {
......@@ -998,7 +1005,12 @@ export class PlayComponent implements OnInit, OnDestroy {
return;
}
if (this.gameover) {
return;
}
this.canTouch = false;
console.log(' this.canTouch = false; 1')
box.click(() => {
......@@ -1074,11 +1086,14 @@ export class PlayComponent implements OnInit, OnDestroy {
});
}
showGameOver() {
console.log(" in showGameOver ");
this.canTouch = false;
console.log(' this.canTouch = false; 2')
this.playAudio('win');
......@@ -1087,7 +1102,6 @@ export class PlayComponent implements OnInit, OnDestroy {
const showCelebrate = () => {
const showPetal = () => {
let petal = new Petal(this.endRenderArr, this.images, this.ctx);
......@@ -1106,6 +1120,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.endRenderArr.push(handClap.bg);
handClap.play(() => {
removeItemFromArr(this.endRenderArr, handClap.bg);
......@@ -1115,13 +1131,14 @@ export class PlayComponent implements OnInit, OnDestroy {
removeItemFromArr(this.endRenderArr, cover);
this.restartBtn.resetStatus();
this.restartBtn.isHide = false;
this.endRenderArr.push(this.restartBtn.bg);
this.restartBtn.bg.x = (this.canvasWidth - this.restartBtn.bg.width) / 2;
this.restartBtn.bg.y = this.canvasHeight - 185 * this.mapScale - this.restartBtn.bg.height;
this.canTouch = true;
this.restartBtn.isHide = 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