feat: highscore dialog and list

This commit is contained in:
Martin Prokoph
2025-08-01 20:24:14 +02:00
parent 93c0ee5f95
commit d10313ea76
9 changed files with 72 additions and 8 deletions

View File

@@ -52,11 +52,11 @@ public class Tetris {
public static void stopGame() {
SoundUtil.stopMusic("/music/theme.wav");
HighScores.addScore(space.getScore());
if (gravityTask != null) gravityTask.cancel();
timer.purge();
if (ui.getMenuPanel() instanceof ScoreMenu) ((ScoreMenu) ui.getMenuPanel()).gameOver();
ui.transferFocus();
if (HighScores.scores.values().stream().noneMatch(hs -> hs > space.getScore())) ui.showHighscoreDialog(space.getScore());
}
public static void updateScore(int score) {