Fix N-player game.ready: per-player ready tracking and deck deserialization

- GameReadyHandler: change `else` → `else if (P2)` so Player 3+ no
  longer incorrectly marks PlayerTwoReady; additional players now track
  their own IsReady flag inside AdditionalPlayersJson on the session.
  All-ready check now waits for P1 + P2 + all additional players.
- GameLobbyReadyHandler.StartGameAsync: add PropertyNameCaseInsensitive
  when deserializing AdditionalPlayersJson → prevents Guid.Empty deck IDs
  caused by camelCase/PascalCase mismatch between join and ready handlers.
- SessionAdditionalPlayer: add IsReady property to support per-player
  ready tracking in the N-player game.ready flow.

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 10:08:19 -04:00
co-authored by Claude Happy
parent 7fd5beb172
commit cabadfc647
2 changed files with 30 additions and 4 deletions
@@ -177,7 +177,9 @@ internal sealed class GameLobbyReadyHandler : GameHandlerBase, IMessageHandler
// Additional players (seats 2+).
var additionalPlayers = string.IsNullOrEmpty(lobby.AdditionalPlayersJson)
? new List<AdditionalLobbyPlayer>()
: JsonSerializer.Deserialize<List<AdditionalLobbyPlayer>>(lobby.AdditionalPlayersJson) ?? new();
: JsonSerializer.Deserialize<List<AdditionalLobbyPlayer>>(
lobby.AdditionalPlayersJson,
new JsonSerializerOptions { PropertyNameCaseInsensitive = true }) ?? new();
// Build the full ordered player list: [P1, P2, P3, ...].
var allPlayerIds = new List<Guid> { playerOneId, playerTwoId };