only display exit confirmation while player is alive

This commit is contained in:
Sajad Hashemian
2025-02-17 14:23:37 +01:00
parent 3d3ad3cece
commit edac371b55
+6 -4
View File
@@ -52,11 +52,13 @@ export class OptionsMenu extends LitElement implements Layer {
private hasWinner = false;
private onExitButtonClick() {
const isConfirmed = confirm("Are you sure you want to exit the game?");
if (isConfirmed) {
window.location.reload();
const isAlive = this.game.myPlayer()?.isAlive();
if (isAlive) {
const isConfirmed = confirm("Are you sure you want to exit the game?");
if (!isConfirmed) return;
}
window.location.reload();
}
createRenderRoot() {