Add BoardShape to custom lobby rules with 'Default' (auto by player count)
- CustomLobby: add BoardShapeOverride (null/"Default" → AutoShape at game start)
- CustomRulesOverride: add optional BoardShape string field for lobby creation/update
- CustomRulesDto: add BoardShape field exposed to clients ("Default" | shape name)
- GameCreateCustomLobbyHandler: store + pass BoardShapeOverride; ToDto gains
optional boardShape param so shape is reflected in the creation response
- GameGetLobbyHandler / GameJoinCustomLobbyHandler / GameListCustomLobbiesHandler
/ GameListActiveLobbiesHandler: all pass lobby.BoardShapeOverride to ToDto
- GameUpdateLobbyRulesHandler: store BoardShapeOverride when rules are edited
- GameLobbyReadyHandler: resolve boardShape — use explicit override when set,
otherwise fall back to BoardShapeGenerator.AutoShape(playerCount)
- EF migration AddBoardShapeOverride: adds board_shape_override column
Valid BoardShape values: null | "Default" | "Rectangle" | "Cross" |
"Triangular" | "RadialStar" | "HexRing"
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:
@@ -205,8 +205,12 @@ internal sealed class GameLobbyReadyHandler : GameHandlerBase, IMessageHandler
|
||||
.Where(r => r.IsCustomDefault)
|
||||
.FirstOrDefaultAsync(ct);
|
||||
|
||||
// Auto-select board shape when the lobby doesn't specify one explicitly.
|
||||
var boardShape = BoardShapeGenerator.AutoShape(playerCount);
|
||||
// Resolve board shape: use lobby override if explicitly set (not null/"Default"),
|
||||
// otherwise auto-select based on player count.
|
||||
var boardShape = !string.IsNullOrEmpty(lobby.BoardShapeOverride)
|
||||
&& lobby.BoardShapeOverride != "Default"
|
||||
? lobby.BoardShapeOverride
|
||||
: BoardShapeGenerator.AutoShape(playerCount);
|
||||
|
||||
// Build effective rules: lobby override → admin custom-default → hard-coded default.
|
||||
var rules = new GameRules
|
||||
|
||||
Reference in New Issue
Block a user