* chore: add battleground UI task tracker (2026-03-28) * feat(#142): add [NonSerialized] battleground runtime state to CardModel * feat(#143): add LoadArtCrop and LoadCardRaw (RawImage) to ImageCache * feat(#148): add GameStateManager singleton and GameState/SeatState POCOs * feat(#138): add BattlegroundController scene orchestrator * feat(#139): add LifeTrackerWidget, CommanderDamageRow, PoisonCounter * feat(#140): add PhaseTrackerWidget and PhaseStepButton * feat(#141): add TurnOrderBar and TurnOrderPill * feat(#142): add CardZone and CardView battlefield zone components * feat(#143): add CommanderZoneWidget with art crop, cast counter, and tax display * feat(#144): add TokenModel POCO, TokenPanelController, and TokenRowView * chore: mark issues 1-8 as complete in task tracker * feat(#146): add StackZoneController, StackItemView, and ManaPoolDisplay * feat(#147 #150 #151): add LobbySetupModal, ZoneViewerModal, EliminationHandler; add Play Live button to SimulationController * feat(#151): add Play Live button to SimulationController * feat(#149): add GameWebSocketClient with reconnect, ping, and main-thread dispatch * fix: add PostGameAction to ApiClient + update TODO.md all issues complete - ApiClient.cs: add PostGameAction() wrapper → POST /api/game/action (fixes compile error in HumanActionBar.cs) - TODO.md: mark issues #145, #146, #147, #149, #150, #151 as ✅ all 14 battleground issues now committed * feat(game): add routes/game.py + wire lab_api + fix GameWebSocketClient game_id URL - routes/game.py: POST /api/game/start, POST /api/game/action (new) - lab_api.py: import + register game_router - GameWebSocketClient.cs: read game_id from PlayerPrefs, build ws://{host}/ws/game/{game_id} — fixes URL mismatch with ws_game.py * fix(lobby): wire OnConfirm to POST /api/game/start, save game_id to PlayerPrefs - OnConfirm() now calls ApiClient.PostGameStart() with 4-seat config - On success: saves BattleSeats + GameId + WsUrl to PlayerPrefs, loads Battleground scene - On failure: shows inline error label (red), re-enables Confirm button - Added StartGameRequest/Response POCOs matching routes/game.py schema - Added _errorLabel [SerializeField] for user-facing error feedback
6.3 KiB
6.3 KiB
Battleground UI — Task Tracker
Created: 2026-03-28
Updated: 2026-03-29 — all 14 issues complete Branch:feat/battleground-ui
All issues below are part of the 4-player Commander Battleground Unity 3D UI build. Build in the numbered order — each step is independently testable before the next.
Build Order Checklist
| # | Issue | Script(s) | Needs Backend? | Status |
|---|---|---|---|---|
| 1 | #138 — Battleground.unity scene + 4-seat layout | BattlegroundController.cs, GameStateManager.cs |
No | ✅ |
| 2 | #139 — LifeTrackerWidget + CommanderDamageRow + Poison | LifeTrackerWidget.cs, CommanderDamageRow.cs, PoisonCounter.cs |
No | ✅ |
| 3 | #140 — PhaseTrackerWidget + PhaseStepButton | PhaseTrackerWidget.cs, PhaseStepButton.cs |
No | ✅ |
| 4 | #141 — TurnOrderBar + TurnOrderPill | TurnOrderBar.cs, TurnOrderPill.cs |
No | ✅ |
| 5 | #142 — CardZone + CardView | CardZone.cs, CardView.cs + CardModel runtime fields |
ImageCache only | ✅ |
| 6 | #143 — CommanderZoneWidget | CommanderZoneWidget.cs + ImageCache.LoadArtCrop() |
ImageCache only | ✅ |
| 7 | #144 — Token System | TokenModel.cs, TokenPanelController.cs, TokenRowView.cs |
No | ✅ |
| 8 | #146 — StackZoneController + ManaPoolDisplay | StackZoneController.cs, ManaPoolDisplay.cs |
No (events only) | ✅ |
| 9 | #147 — LobbySetupModal + ZoneViewerModal | LobbySetupModal.cs, ZoneViewerModal.cs |
/api/decks, /api/game/start |
✅ |
| 10 | #148 — GameStateManager + GameState POCOs | GameStateManager.cs, GameState.cs |
No | ✅ |
| 11 | #149 — GameWebSocketClient | GameWebSocketClient.cs |
Yes — /ws/game |
✅ |
| 12 | #145 — HumanActionBar | HumanActionBar.cs, ApiClient.PostGameAction() |
Yes — /api/game/action |
✅ |
| 13 | #150 — EliminationHandler + Grayscale Shader | EliminationHandler.cs, EliminatedGrayscale ShaderGraph |
No | ✅ |
| 14 | #151 — SimulationController: Play Live button | SimulationController.cs (modify) |
No | ✅ |
All Files Committed
Assets/Scripts/UI/Battleground/ (new folder)
- ✅
BattlegroundController.cs— scene orchestrator, seat rotations, event subscriptions - ✅
GameStateManager.cs— singleton event hub - ✅
LifeTrackerWidget.cs— life +/- with history + danger flash - ✅
CommanderDamageRow.cs— 4-pip commander damage tracker per seat - ✅
PoisonCounter.cs— 10-pip poison tracker - ✅
PhaseTrackerWidget.cs— 13-step phase strip, Space key debug advance - ✅
PhaseStepButton.cs— individual phase pill (color + scale) - ✅
TurnOrderBar.cs— animated seat border slider - ✅
TurnOrderPill.cs— per-seat pill with name, life, eliminated state - ✅
CardZone.cs— zone container (add/remove/clear CardView children) - ✅
CardView.cs— card visual (art, tapped rotation, face-down, summoning sick) - ✅
CommanderZoneWidget.cs— art crop, cast count, tax (+2 per cast) - ✅
TokenPanelController.cs— token creation panel - ✅
TokenRowView.cs— token row (qty, tap, counters, delete) - ✅
StackZoneController.cs— LIFO stack display, hidden when empty - ✅
StackItemView.cs— individual stack item row - ✅
ManaPoolDisplay.cs— 6-pip mana display, hides zero labels - ✅
LobbySetupModal.cs— 4-seat lobby config, loads decks from API, POSTs to /api/game/start - ✅
ZoneViewerModal.cs— fullscreen graveyard/exile viewer with search filter - ✅
HumanActionBar.cs— priority-gated action buttons + targeting mode - ✅
EliminationHandler.cs— overlay + grayscale material on elimination
Assets/Scripts/Models/
- ✅
GameState.cs—GameState+SeatStatePOCOs - ✅
TokenModel.cs— token data model - ✅
CardModel.cs— modified: added[NonSerialized]runtime state +BattleZoneenum
Assets/Scripts/Services/
- ✅
ImageCache.cs— modified: addedLoadCard(RawImage)+LoadArtCrop(name, RawImage) - ✅
GameWebSocketClient.cs— WS connect/reconnect, ping, ConcurrentQueue main-thread dispatch - ✅
ApiClient.cs— modified: addedPostGameAction()+PostGameStart()
Assets/Scenes/
- ✅
Battleground.unity— new scene
Assets/Materials/
- ✅
EliminatedGrayscale— URP Shader Graph
Modified Existing Files
- ✅
SimulationController.cs— Play Live button +OnPlayLive()+BuildSeatsJson() - ✅
MainMenuController.cs— Play Live nav button
Backend Endpoints Required
These Python routes must exist before end-to-end testing:
| Endpoint | Used By | Status |
|---|---|---|
GET /api/decks |
LobbySetupModal |
verify |
POST /api/game/start |
LobbySetupModal |
verify |
POST /api/game/action |
HumanActionBar |
verify |
WS /ws/game |
GameWebSocketClient |
verify (PR #107) |
Architecture Notes
GameStateManageris the singleton event hub — all UI widgets subscribe to its events, never pollGameWebSocketClientreceives server push messages and routes them toGameStateManager.ApplyServerEvent()- Canvas mode: Screen Space — Camera (not World Space) for crisp TMP rendering
- Seat rotation: AI panels rotated -90°, 180°, 90° via
localEulerAnglesso text/buttons face the right direction - Backend WS: connect to
ws://localhost:8080/ws/game(configurable viaPlayerPrefs["ServerUrl"]) - Space key in Play Mode advances the phase strip for isolated testing without WebSocket