1
0

Solitaire: Man kann jetzt gewinnen

This commit is contained in:
2025-03-13 20:52:32 +01:00
parent 44c7f4cf4a
commit fe8060f22a

View File

@ -416,6 +416,19 @@
</div> </div>
</div> </div>
<div class="modal" id="winModal">
<div class="modal-content">
<h2>Glückwunsch!</h2>
<p>Du hast das Spiel gewonnen!</p>
<p style="margin-top: 10px;">Dein finaler Punktestand: <span id="finalScore">0</span></p>
<p style="margin-top: 5px;">Zeit: <span id="finalTime">0:00</span> - Züge: <span id="finalMoves">0</span></p>
<div class="modal-buttons">
<button onclick="newGame()">Neues Spiel</button>
<button onclick="showHighscores()">Highscores</button>
</div>
</div>
</div>
<script> <script>
// Spielvariablen // Spielvariablen
let score = 0; let score = 0;
@ -994,6 +1007,20 @@
newGame(); newGame();
} }
function showWinModal(finalScore) {
const modal = document.getElementById('winModal');
document.getElementById('finalScore').textContent = finalScore;
const minutes = Math.floor(gameTime / 60);
const seconds = gameTime % 60;
document.getElementById('finalTime').textContent =
`${minutes}:${seconds.toString().padStart(2, '0')}`;
document.getElementById('finalMoves').textContent = moves;
modal.classList.add('show');
}
// Spiel initialisieren // Spiel initialisieren
newGame(); newGame();
showRules(); // Zeige Spielregeln beim Start showRules(); // Zeige Spielregeln beim Start