From 5190ec19a39140e37eeaf27aec2a3d38a69a5a2a Mon Sep 17 00:00:00 2001 From: Gabriel Franco Date: Thu, 10 Sep 2026 12:16:15 -0300 Subject: [PATCH] feat(frontend): add in-match orchestrator and multiplayer scoreboard New multiplayerMatch.ts (MultiplayerMatch class) drives one round: syncs ThemeGuessGame/OpponentView to a round:start payload, relays local category assignments as round:progress, forwards opponent round:progress to OpponentView, drives timerHud's countdown (submitting the local color map as round:submit at expiry), and renders a two-column scoreboard on round:reveal via computeMatchResult. ThemeGuessGame gains an optional onCategoryAssigned?(id, hex) constructor callback, invoked as the last step of applyColor. timerHud's TimerHudOptions gains an optional onExpire?() callback on the countdown variant, fired once when endsAt passes. resultView.ts gains renderMultiplayerResult() for the two-column you/opponent scoreboard + winner banner (equal overall -> explicit draw). index.html/style.css: additive #mp-scoreboard/#mp-winner-banner/#mp-you-*/ #mp-opponent-* markup and .mp-* styles; existing single-player result markup untouched aside from adding id="solo-score-meter-wrap" so it can be toggled off during a multiplayer reveal. --- frontend/index.html | 23 ++- frontend/src/game/ThemeGuessGame.ts | 12 +- frontend/src/game/multiplayerMatch.ts | 229 ++++++++++++++++++++++++++ frontend/src/game/resultView.ts | 44 ++++- frontend/src/game/timerHud.ts | 8 +- frontend/src/style.css | 46 ++++++ 6 files changed, 357 insertions(+), 5 deletions(-) create mode 100644 frontend/src/game/multiplayerMatch.ts diff --git a/frontend/index.html b/frontend/index.html index 57524cd..b83dda0 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -156,7 +156,7 @@