Commit 8510c2f9 authored by yu's avatar yu

1

parent b35ff84d
...@@ -92,6 +92,11 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -92,6 +92,11 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
pg.event.on('npc_voice_play_voice_end', () => { pg.event.on('npc_voice_play_voice_end', () => {
})
pg.event.on('layer_right_show_excellent_end', () => {
this.coin += 3;
pg.event.emit('layer_coin_show_coin', 3) //1 2 3硬币数量
this.roundOver = false;
}) })
pg.event.emit('npc_layer_back_init', this.data) pg.event.emit('npc_layer_back_init', this.data)
...@@ -100,7 +105,12 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -100,7 +105,12 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
this.replay(); this.replay();
}) })
pg.event.on('layer_coin_show_coin_end', () => { pg.event.on('layer_coin_show_coin_end', () => {
let over = GameJigsaw.getIns().addPage();
if(!over){
this.gameOver();
}else{
this.nextPage(); this.nextPage();
}
}) })
} }
replay() { replay() {
...@@ -368,27 +378,13 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -368,27 +378,13 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
if (this.roundOver) return; if (this.roundOver) return;
this.roundOver = true; this.roundOver = true;
let audio = GameJigsaw.getIns().getCurrentPage().audio; let audio = GameJigsaw.getIns().getCurrentPage().audio;
let over = GameJigsaw.getIns().addPage();
pg.audio.playAudioByUrl(audio).then(async () => { pg.audio.playAudioByUrl(audio).then(async () => {
await asyncDelay(1); await asyncDelay(0.5);
if (!over) {
pg.event.emit("gameOver");
} else {
pg.event.once('layer_right_show_excellent_end', () => {
this.coin += 3;
pg.event.emit('layer_coin_show_coin', this.coin) //1 2 3硬币数量
this.roundOver = false;
})
pg.event.emit("layer_right_show_excellent"); pg.event.emit("layer_right_show_excellent");
}
}); });
} }
gameOver() { gameOver() {
pg.event.emit('layer_ending_show', { coin: this.coin }) pg.event.emit('layer_ending_show', { coin: this.coin })
} }
......
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