Add level selection menu and persistence

Introduce a level selection UI and persistence for unlocked levels. Adds CSS styles and HTML markup for a floating level menu, and JS to load/save highest unlocked level to localStorage (key: mirror-game-highest-unlocked-level). Implements functions to render/toggle the menu, unlock levels on finish, and navigate to arbitrary levels via goToLevel. nextLevel now delegates to goToLevel, and setup calls loadUnlockedLevels() and setupLevelMenu() so the menu reflects progress immediately.
This commit is contained in:
Sysy's
2026-03-31 14:10:37 +02:00
parent 34d213d5f4
commit 90a0de0429
3 changed files with 190 additions and 7 deletions

View File

@@ -15,6 +15,16 @@
<button class="win-button" onclick="nextLevel()">Next Level</button>
</div>
<aside class="level-menu-shell">
<button id="level-menu-toggle" class="level-menu-toggle" type="button" aria-expanded="false" aria-controls="level-menu-panel">
Levels
</button>
<div id="level-menu-panel" class="level-menu-panel" hidden>
<h2>Choose Level</h2>
<div id="level-menu-list" class="level-menu-list"></div>
</div>
</aside>
<script>
atOptions = {
'key' : '72b6ba1a1c26b9671167b66063c7e699',