From 34a4f474022df36e754597e772167a5e20837550 Mon Sep 17 00:00:00 2001 From: Jarvis Date: Sat, 21 Feb 2026 11:08:06 +0000 Subject: [PATCH] Add zero state, disconnected overlay, game over confetti, and debug panel - Zero state: bouncing dice + message when no game exists - Disconnected: greyed overlay after 3 consecutive fetch failures, with retry countdown - Game over: gold banner with winner name + confetti animation, detected from log ('WINS!') or single remaining player - Debug panel: Ctrl+Shift+D toggles hidden panel with buttons to test all four states (zero, playing, gameover, disconnected, reset) - Also fixed player panel to use p.number for current-turn matching and property ownership display --- site/game-state.json | 239 +++++++++--------- site/index.html | 558 +++++++++++++++++++++++++++++++++---------- 2 files changed, 547 insertions(+), 250 deletions(-) diff --git a/site/game-state.json b/site/game-state.json index f7647f1..04e3428 100644 --- a/site/game-state.json +++ b/site/game-state.json @@ -3,8 +3,8 @@ { "name": "alice", "number": 1, - "money": 624, - "location": 21, + "money": 919, + "location": 25, "inJail": false, "jailTurns": 0, "doublesCount": 0, @@ -13,8 +13,8 @@ { "name": "bob", "number": 2, - "money": 1229, - "location": 23, + "money": 1292, + "location": 37, "inJail": false, "jailTurns": 0, "doublesCount": 0, @@ -23,15 +23,15 @@ { "name": "charlie", "number": 3, - "money": -12, - "location": 24, - "inJail": false, + "money": 320, + "location": 40, + "inJail": true, "jailTurns": 0, "doublesCount": 0, "getOutOfJailFreeCards": 1 } ], - "currentPlayer": 3, + "currentPlayer": 2, "squares": [ { "id": 0, @@ -96,7 +96,7 @@ "id": 8, "name": "Vermont ave. (L)", "type": "property", - "owner": null, + "owner": 3, "mortgaged": false, "group": "lightblue", "cost": 100, @@ -370,150 +370,149 @@ ], "log": [ { - "text": "roll is 6, 5", + "text": "charlie's turn \u2014 $320 on Electric Co.", "player": "charlie", - "timestamp": "2026-02-21 11:01:40" + "timestamp": "2026-02-21 11:03:37" }, { - "text": "Passed GO \u2014 collected $200", + "text": "roll is 4, 6", "player": "charlie", - "timestamp": "2026-02-21 11:01:40" + "timestamp": "2026-02-21 11:03:38" }, { - "text": "Landed on Income Tax", + "text": "Landed on Chance ii", "player": "charlie", - "timestamp": "2026-02-21 11:01:41" + "timestamp": "2026-02-21 11:03:39" }, { - "text": "alice's turn \u2014 $289 on Just Visiting", - "player": "alice", - "timestamp": "2026-02-21 11:01:47" - }, - { - "text": "Trade completed between alice and bob", - "player": null - }, - { - "text": "alice's turn \u2014 $484 on Just Visiting", - "player": "alice", - "timestamp": "2026-02-21 11:01:58" - }, - { - "text": "roll is 3, 2", - "player": "alice", - "timestamp": "2026-02-21 11:01:59" - }, - { - "text": "Landed on Pennsylvania RR", - "player": "alice", - "timestamp": "2026-02-21 11:01:59" - }, - { - "text": "bob's turn \u2014 $1279 on Electric Co.", - "player": "bob", - "timestamp": "2026-02-21 11:02:00" - }, - { - "text": "roll is 1, 5", - "player": "bob", - "timestamp": "2026-02-21 11:02:02" - }, - { - "text": "Landed on Tennessee ave. (O)", - "player": "bob", - "timestamp": "2026-02-21 11:02:02" - }, - { - "text": "Paid $14 rent to alice", - "player": "bob" - }, - { - "text": "charlie's turn \u2014 $78 on Income Tax", - "player": "charlie", - "timestamp": "2026-02-21 11:02:04" - }, - { - "text": "roll is 6, 5", - "player": "charlie", - "timestamp": "2026-02-21 11:02:05" - }, - { - "text": "Landed on Pennsylvania RR", - "player": "charlie", - "timestamp": "2026-02-21 11:02:05" - }, - { - "text": "Paid $50 rent to alice", + "text": "Go Back 3 Spaces", "player": "charlie" }, { - "text": "alice's turn \u2014 $548 on Pennsylvania RR", + "text": "Landed on New York ave. (O)", + "player": "charlie", + "timestamp": "2026-02-21 11:03:41" + }, + { + "text": "alice's turn \u2014 $912 on States ave. (V)", "player": "alice", - "timestamp": "2026-02-21 11:02:07" - }, - { - "text": "roll is 5, 1", - "player": "alice", - "timestamp": "2026-02-21 11:02:08" - }, - { - "text": "Landed on Kentucky ave. (R)", - "player": "alice", - "timestamp": "2026-02-21 11:02:09" - }, - { - "text": "bob's turn \u2014 $1265 on Tennessee ave. (O)", - "player": "bob", - "timestamp": "2026-02-21 11:02:10" - }, - { - "text": "roll is 1, 1", - "player": "bob", - "timestamp": "2026-02-21 11:02:11" - }, - { - "text": "Landed on Free Parking", - "player": "bob", - "timestamp": "2026-02-21 11:02:11" - }, - { - "text": "bob's turn \u2014 $1265 on Free Parking", - "player": "bob", - "timestamp": "2026-02-21 11:02:13" + "timestamp": "2026-02-21 11:03:42" }, { "text": "roll is 1, 2", - "player": "bob", - "timestamp": "2026-02-21 11:02:14" + "player": "alice", + "timestamp": "2026-02-21 11:03:43" }, { - "text": "Landed on Indiana ave. (R)", + "text": "Landed on St. James pl. (O)", + "player": "alice", + "timestamp": "2026-02-21 11:03:43" + }, + { + "text": "Paid $14 rent to bob", + "player": "alice" + }, + { + "text": "bob's turn \u2014 $1113 on Pennsylvania RR", "player": "bob", - "timestamp": "2026-02-21 11:02:14" + "timestamp": "2026-02-21 11:03:45" + }, + { + "text": "roll is 5, 1", + "player": "bob", + "timestamp": "2026-02-21 11:03:46" + }, + { + "text": "Landed on Kentucky ave. (R)", + "player": "bob", + "timestamp": "2026-02-21 11:03:47" }, { "text": "Paid $36 rent to alice", "player": "bob" }, { - "text": "charlie's turn \u2014 $28 on Pennsylvania RR", + "text": "charlie's turn \u2014 $320 on New York ave. (O)", "player": "charlie", - "timestamp": "2026-02-21 11:02:16" + "timestamp": "2026-02-21 11:03:48" + }, + { + "text": "roll is 6, 5", + "player": "charlie", + "timestamp": "2026-02-21 11:03:50" + }, + { + "text": "Landed on GO TO JAIL!", + "player": "charlie", + "timestamp": "2026-02-21 11:03:50" + }, + { + "text": "alice's turn \u2014 $934 on St. James pl. (O)", + "player": "alice", + "timestamp": "2026-02-21 11:03:51" }, { "text": "roll is 5, 4", - "player": "charlie", - "timestamp": "2026-02-21 11:02:17" + "player": "alice", + "timestamp": "2026-02-21 11:03:52" }, { - "text": "Landed on Illinois ave. (R)", - "player": "charlie", - "timestamp": "2026-02-21 11:02:18" + "text": "Landed on B&O RR", + "player": "alice", + "timestamp": "2026-02-21 11:03:52" }, { - "text": "Paid $40 rent to alice", - "player": "charlie" + "text": "Paid $50 rent to bob", + "player": "alice" + }, + { + "text": "bob's turn \u2014 $1127 on Kentucky ave. (R)", + "player": "bob", + "timestamp": "2026-02-21 11:03:54" + }, + { + "text": "bob's turn \u2014 $1127 on Kentucky ave. (R)", + "player": "bob", + "timestamp": "2026-02-21 11:04:04" + }, + { + "text": "roll is 6, 6", + "player": "bob", + "timestamp": "2026-02-21 11:04:05" + }, + { + "text": "Landed on Community Chest iii", + "player": "bob", + "timestamp": "2026-02-21 11:04:06" + }, + { + "text": "Bank Error in Your Favor.", + "player": "bob" + }, + { + "text": "bob's turn \u2014 $1327 on Community Chest iii", + "player": "bob", + "timestamp": "2026-02-21 11:04:09" + }, + { + "text": "roll is 2, 2", + "player": "bob", + "timestamp": "2026-02-21 11:04:10" + }, + { + "text": "Landed on Park place (D)", + "player": "bob", + "timestamp": "2026-02-21 11:04:10" + }, + { + "text": "Paid $35 rent to alice", + "player": "bob" + }, + { + "text": "bob's turn \u2014 $1292 on Park place (D)", + "player": "bob", + "timestamp": "2026-02-21 11:04:12" } ], - "lastUpdated": "2026-02-21T11:02:22.605328+00:00" + "lastUpdated": "2026-02-21T11:04:14.993563+00:00" } \ No newline at end of file diff --git a/site/index.html b/site/index.html index 9a82e8d..6c016b6 100644 --- a/site/index.html +++ b/site/index.html @@ -111,6 +111,69 @@ h1 { color: #fff; font-size: 1.5em; text-align: center; } } .board-center .subtitle { font-size: 0.35em; color: #888; letter-spacing: 0; margin-top: 8px; font-weight: normal; } +/* ===== ZERO STATE ===== */ +.zero-state { + display: flex; flex-direction: column; align-items: center; justify-content: center; + min-height: 80vh; text-align: center; gap: 20px; padding: 40px; +} +.zero-state .dice { font-size: 5em; animation: dice-bounce 2s ease-in-out infinite; } +@keyframes dice-bounce { + 0%, 100% { transform: translateY(0) rotate(0deg); } + 50% { transform: translateY(-20px) rotate(15deg); } +} +.zero-state h2 { color: #fff; font-size: 2em; } +.zero-state p { color: #888; font-size: 1.1em; max-width: 400px; line-height: 1.5; } + +/* ===== DISCONNECTED OVERLAY ===== */ +.disconnected-overlay { + position: fixed; inset: 0; background: rgba(0,0,0,0.7); + display: flex; align-items: center; justify-content: center; + z-index: 1000; backdrop-filter: blur(3px); +} +.disconnected-overlay .message { + background: #16213e; border: 2px solid #e74c3c; border-radius: 12px; + padding: 40px; text-align: center; max-width: 400px; +} +.disconnected-overlay .icon { font-size: 3em; margin-bottom: 15px; } +.disconnected-overlay h3 { color: #e74c3c; margin-bottom: 10px; } +.disconnected-overlay p { color: #888; font-size: 0.9em; } +.disconnected-overlay .retry { color: #555; font-size: 0.8em; margin-top: 15px; } +body.greyed-out .container { filter: grayscale(80%) brightness(0.5); pointer-events: none; } + +/* ===== GAME OVER ===== */ +.game-over-banner { + position: fixed; top: 0; left: 0; right: 0; + background: linear-gradient(135deg, #ffd700, #ff8c00); + color: #1a1a2e; text-align: center; padding: 20px; + font-size: 1.5em; font-weight: bold; z-index: 500; + box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5); + animation: banner-slide 0.5s ease-out; +} +@keyframes banner-slide { from { transform: translateY(-100%); } to { transform: translateY(0); } } +.game-over-banner .winner { font-size: 1.4em; } +.game-over-banner .sub { font-size: 0.5em; font-weight: normal; color: #333; } +body.game-over .container { padding-top: 100px; } + +/* Confetti canvas */ +#confetti-canvas { + position: fixed; inset: 0; z-index: 499; pointer-events: none; +} + +/* ===== DEBUG PANEL ===== */ +.debug-panel { + position: fixed; bottom: 10px; right: 10px; background: #0d1117; + border: 1px solid #30363d; border-radius: 8px; padding: 12px; + font-size: 0.75em; z-index: 2000; display: none; +} +.debug-panel.visible { display: block; } +.debug-panel h4 { color: #58a6ff; margin-bottom: 8px; } +.debug-panel button { + display: block; width: 100%; margin: 4px 0; padding: 6px 10px; + background: #21262d; border: 1px solid #30363d; color: #c9d1d9; + border-radius: 4px; cursor: pointer; text-align: left; font-size: 1em; +} +.debug-panel button:hover { background: #30363d; } + @media (max-width: 600px) { .board-wrapper { width: 95vw; height: 95vw; } .square { font-size: 0.4em; } @@ -121,7 +184,17 @@ h1 { color: #fff; font-size: 1.5em; text-align: center; } -
+ + + + + + + + + + + + + + + + +
+

๐Ÿ”ง Debug States

+ + + + + +
+