wip
This commit is contained in:
parent
eda727c487
commit
4918923635
2 changed files with 19 additions and 3 deletions
|
@ -148,7 +148,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</div>
|
||||
<div :class="$style.frame">
|
||||
<div :class="$style.frameInner">
|
||||
<MkButton @click="retry">Retry</MkButton>
|
||||
<MkButton @click="surrender">Retry</MkButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -468,8 +468,8 @@ function hold() {
|
|||
game.hold();
|
||||
}
|
||||
|
||||
function retry() {
|
||||
game.gameOver();
|
||||
function surrender() {
|
||||
game.surrender();
|
||||
}
|
||||
|
||||
function restart() {
|
||||
|
|
|
@ -28,6 +28,9 @@ type Log = {
|
|||
} | {
|
||||
frame: number;
|
||||
operation: 'hold';
|
||||
} | {
|
||||
frame: number;
|
||||
operation: 'surrender';
|
||||
};
|
||||
|
||||
export class DropAndFusionGame extends EventEmitter<{
|
||||
|
@ -274,6 +277,15 @@ export class DropAndFusionGame extends EventEmitter<{
|
|||
}
|
||||
}
|
||||
|
||||
public surrender() {
|
||||
this.logs.push({
|
||||
frame: this.frame,
|
||||
operation: 'surrender',
|
||||
});
|
||||
|
||||
this.gameOver();
|
||||
}
|
||||
|
||||
public gameOver() {
|
||||
this.isGameOver = true;
|
||||
if (this.tickRaf) window.cancelAnimationFrame(this.tickRaf);
|
||||
|
@ -393,6 +405,10 @@ export class DropAndFusionGame extends EventEmitter<{
|
|||
this.hold();
|
||||
break;
|
||||
}
|
||||
case 'surrender': {
|
||||
this.surrender();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue