Phase 2 client: N-player HUD, lobby room, and DTO fields

Server:
- PlayerStateDto: add SeatIndex, TeamIndex, IsEliminated
- GameStateDto: add SeatOrder, GameMode
- CreateCustomLobbyResponse / JoinCustomLobbyResponse: add MaxPlayers, GameMode, TeamCount
- GameEngine.ToDto(): populate new fields from GameState / PlayerState
- Handlers: return MaxPlayers, GameMode, TeamCount in lobby create/join ACKs

Client:
- GameScreen.tscn: add TurnOrderStrip HBoxContainer in TopBar
- game_screen.gd: show TurnOrderStrip for >2 player games; _rebuild_turn_order_strip()
  builds per-player chips sorted by seatIndex, highlighting active/eliminated players
- LobbyRoomScreen.tscn: add GameModeLabel, AdditionalPlayersContainer,
  unique_name on FirstTurnSection/FirstTurnBtns
- lobby_room_screen.gd: show game mode + player count; _rebuild_additional_players_panel()
  shows occupied seats and empty waiting slots; hide first-turn buttons for 3+ players;
  _on_guest_joined refreshes full display instead of only updating GuestNameLabel

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-26 00:14:25 -04:00
co-authored by Claude Happy
parent f700fd5de6
commit 00bf788ac8
8 changed files with 190 additions and 26 deletions
+7 -2
View File
@@ -1008,7 +1008,10 @@ public static class GameEngine
Discard : p.Discard.Select(ToCardDto),
ArchSpirit : p.ArchSpirit != null ? ToCardDto(p.ArchSpirit) : null,
CurrentSp : p.CurrentSp,
CurrentSt : p.CurrentSt);
CurrentSt : p.CurrentSt,
SeatIndex : p.SeatIndex,
TeamIndex : p.TeamIndex,
IsEliminated: p.IsEliminated);
});
var boardDto = state.Board is not null ? ToBoardDto(state.Board) : null;
@@ -1021,7 +1024,9 @@ public static class GameEngine
TurnNumber : state.TurnNumber,
StateVersion : state.NextActionSequence,
Players : players,
Board : boardDto);
Board : boardDto,
SeatOrder : state.SeatOrder,
GameMode : state.GameMode);
}
// ── Deck validation ───────────────────────────────────────────────────────
+16 -5
View File
@@ -240,17 +240,23 @@ public sealed record GameForceConcedeResponse(GameStateDto State);
public sealed record CreateCustomLobbyResponse(
Guid LobbyId,
string LobbyName,
CustomRulesDto ActiveRules);
CustomRulesDto ActiveRules,
int MaxPlayers,
string GameMode,
int TeamCount);
public sealed record JoinCustomLobbyResponse(
Guid LobbyId,
string Status, // "WaitingForReady"
string Status, // "WaitingForReady" | "WaitingForPlayers"
CustomRulesDto ActiveRules,
Guid? GameSessionId, // always null; reserved for future use
Guid HostAccountId,
string HostDisplayName,
Guid GuestAccountId,
string GuestDisplayName);
string GuestDisplayName,
int MaxPlayers,
string GameMode,
int TeamCount);
public sealed record LeaveCustomLobbyResponse(Guid LobbyId);
@@ -515,7 +521,9 @@ public sealed record GameStateDto(
int TurnNumber,
int StateVersion, // monotonic; use for client mismatch detection
IEnumerable<PlayerStateDto> Players,
BoardDto? Board); // full board state including tile affinities
BoardDto? Board, // full board state including tile affinities
IEnumerable<string> SeatOrder, // account IDs in seat/turn order; empty = legacy 1v1
string GameMode); // "FFA" | "Teams" | "MultiTeam"
public sealed record PlayerStateDto(
Guid AccountId,
@@ -526,7 +534,10 @@ public sealed record PlayerStateDto(
IEnumerable<CardInstanceDto> Discard, // always visible
CardInstanceDto? ArchSpirit,
int CurrentSp,
int CurrentSt);
int CurrentSt,
int SeatIndex, // 0-based turn order position
int TeamIndex, // same value = allies; FFA = SeatIndex
bool IsEliminated); // true when ArchSpirit has been destroyed
public sealed record CardInstanceDto(
string InstanceId,
@@ -104,7 +104,10 @@ internal sealed class GameCreateCustomLobbyHandler : GameHandlerBase, IMessageHa
new CreateCustomLobbyResponse(
LobbyId : lobby.Id,
LobbyName : lobby.Name,
ActiveRules : ToDto(effective, req.Password != null)));
ActiveRules : ToDto(effective, req.Password != null),
MaxPlayers : lobby.MaxPlayers,
GameMode : lobby.GameMode,
TeamCount : lobby.TeamCount));
}
// Shared helper used by list/join handlers as well.
@@ -176,6 +176,9 @@ internal sealed class GameJoinCustomLobbyHandler : GameHandlerBase, IMessageHand
HostAccountId : lobby.HostAccountId,
HostDisplayName : hostName,
GuestAccountId : accountId,
GuestDisplayName: guestName));
GuestDisplayName: guestName,
MaxPlayers : lobby.MaxPlayers,
GameMode : lobby.GameMode,
TeamCount : lobby.TeamCount));
}
}