Files
sor/Server/src/SOR.Database/Entities/Game/BoardTemplate.cs
T
4924f61483 Implement board template builder — Phase 1 admin panel
- New BoardTemplate entity (TilesJson/StartingZonesJson as jsonb)
- BoardTemplateIdOverride on CustomLobby, BoardTemplateId on GameRuleSet
- EF migration AddBoardTemplates + applied to pg-forge-01
- Admin list page: /game/board-templates (toggle enable, edit, delete)
- Admin builder: paint canvas (22-affinity palette, drag support),
  zone edit mode (per-player-count seat assignment, erase), tile flags modal
- NavMenu: Board Templates link under Game submenu
- GameRules: BoardShape default changed to "Default"

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>
2026-03-27 20:49:32 -04:00

38 lines
1.5 KiB
C#

namespace SOR.Database.Entities.Game;
/// <summary>
/// An admin-defined board layout assignable to custom lobbies or ranked matches.
///
/// TilesJson: JSON array of tile objects: {"x":0,"y":0,"b1":2,"b2":0,"ao":false}
/// b1/b2 are integer values of the Affinity enum; ao = AffinityOverrideable.
/// Tiles absent from the array default to Void+Void, ao=false.
///
/// StartingZonesJson: JSON object keyed by player-count string, value is a map of
/// seat-index string → array of "x,y" coordinate strings.
/// Example: {"2":{"0":["0,0","1,0"],"1":["8,8","7,8"]},"3":{...}}
///
/// AffinityOverrideable: when StartingRandomTilePct > 0 for a game rule, only tiles
/// with this flag may have their affinity randomized; locked tiles stay fixed as designed.
/// </summary>
public sealed class BoardTemplate
{
public Guid Id { get; set; } = Guid.NewGuid();
public string Name { get; set; } = string.Empty;
public int Width { get; set; } = 8;
public int Height { get; set; } = 8;
public string TilesJson { get; set; } = "[]";
public string StartingZonesJson { get; set; } = "{}";
public bool IsEnabled { get; set; } = true;
public bool IsAvailableForRanked { get; set; } = false;
public bool IsAvailableForCustom { get; set; } = true;
public int MinPlayers { get; set; } = 2;
public int MaxPlayers { get; set; } = 2;
public DateTimeOffset CreatedAt { get; set; }
public DateTimeOffset UpdatedAt { get; set; }
}