feat(ui): redesign modern game dashboard and add 2k/4k full-screen fluid scaling

This commit is contained in:
2026-09-17 12:59:30 +00:00
parent 84c28addfe
commit 258b1a9cb1
4 changed files with 357 additions and 34 deletions
+31
View File
@@ -784,6 +784,36 @@ def test_plant_shop_and_deck_selection():
record("GameEngine.renderSeedSelectionUI implemented", "PASS" if "renderSeedSelectionUI(" in game_code else "FAIL")
record("Shop plants nursery population implemented in updateShopUI", "PASS" if "shop-plants-grid" in game_code and "PLANT_CATALOGUE" in game_code else "FAIL")
def test_modern_dashboard_and_fullscreen():
print("\n--- 11c. Modern Dashboard & 2K/4K Fullscreen Responsive ---")
html_path = os.path.join(GAME_DIR, "index.html")
with open(html_path, "r", encoding="utf-8") as f:
html_code = f.read()
css_path = os.path.join(GAME_DIR, "css/style.css")
with open(css_path, "r", encoding="utf-8") as f:
css_code = f.read()
game_js_path = os.path.join(GAME_DIR, "js/game.js")
with open(game_js_path, "r", encoding="utf-8") as f:
game_code = f.read()
dashboard_checks = [
("Fullscreen button present in top nav", 'id="btn-fullscreen"' in html_code),
("Modern dashboard class and structure present", "modern-dashboard" in html_code and "modern-header" in html_code),
("Hero profile widget present on dashboard", 'id="start-hero-profile"' in html_code and 'id="hero-profile-name"' in html_code),
("Hero stat pills (coins, level, score) present", 'id="hero-stat-coins"' in html_code and 'id="hero-stat-level"' in html_code and 'id="hero-stat-score"' in html_code),
("Fluid 2K/4K scaling CSS rules present", "min(98vw" in css_code and "aspect-ratio: 900 / 644" in css_code),
("Fullscreen CSS rules present", ":fullscreen #game-wrapper" in css_code and ":fullscreen #game-container" in css_code),
("Fullscreen API handler and toggle in game.js", "btn-fullscreen" in game_code and "requestFullscreen" in game_code),
("Fullscreen hotkey KeyF supported in game.js", "KeyF" in game_code),
("Hero profile sync in updateProfileUI", "heroName" in game_code and "heroCoins" in game_code and "heroLevel" in game_code),
("Start hero profile click opens auth modal", "startHeroProfile" in game_code and "btnAuthOpen.click()" in game_code),
]
for name, cond in dashboard_checks:
record(name, "PASS" if cond else "FAIL")
def main():
print("==================================================")
print("🌱 PLANTS VS. ZOMBIES — AUTONOMOUS TEST SUITE 🌱")
@@ -801,6 +831,7 @@ def main():
test_campaign_system()
test_feedback_and_layout_system()
test_plant_shop_and_deck_selection()
test_modern_dashboard_and_fullscreen()
test_http_endpoint()
passed = sum(1 for r in TEST_RESULTS if r["status"] == "PASS")