refactor: convert component structs to record structs

This commit is contained in:
hypercross 2026-07-20 17:15:17 +08:00
parent e1fb197474
commit 343bcd5b2e
7 changed files with 7 additions and 7 deletions

View File

@ -7,7 +7,7 @@ namespace Game.Blackjack;
/// One entity per card. /// One entity per card.
/// </summary> /// </summary>
[MessagePackObject] [MessagePackObject]
public struct Card public record struct Card
{ {
[Key(0)] public Suit Suit; [Key(0)] public Suit Suit;
[Key(1)] public Rank Rank; [Key(1)] public Rank Rank;

View File

@ -8,7 +8,7 @@ namespace Game.Blackjack;
/// representing that the hand holds this card. /// representing that the hand holds this card.
/// </summary> /// </summary>
[MessagePackObject] [MessagePackObject]
public struct Holds : IRelationship public record struct Holds : IRelationship
{ {
[Key(0)] public Entity Source { get; set; } [Key(0)] public Entity Source { get; set; }
[Key(1)] public Entity Target { get; set; } [Key(1)] public Entity Target { get; set; }

View File

@ -8,7 +8,7 @@ namespace Game.Blackjack;
/// representing that the card is in the deck. /// representing that the card is in the deck.
/// </summary> /// </summary>
[MessagePackObject] [MessagePackObject]
public struct InDeck : IRelationship public record struct InDeck : IRelationship
{ {
[Key(0)] public Entity Source { get; set; } [Key(0)] public Entity Source { get; set; }
[Key(1)] public Entity Target { get; set; } [Key(1)] public Entity Target { get; set; }

View File

@ -6,7 +6,7 @@ namespace Game.Blackjack;
/// Global game state stored on the singleton entity. /// Global game state stored on the singleton entity.
/// </summary> /// </summary>
[MessagePackObject] [MessagePackObject]
public struct GameState public record struct GameState
{ {
[Key(0)] public GamePhase Phase; [Key(0)] public GamePhase Phase;
[Key(1)] public RoundResult Result; [Key(1)] public RoundResult Result;

View File

@ -6,7 +6,7 @@ namespace Game.TicTacToe;
/// Identifies a board position. One entity per cell. /// Identifies a board position. One entity per cell.
/// </summary> /// </summary>
[MessagePackObject] [MessagePackObject]
public struct Cell public record struct Cell
{ {
[Key(0)] public int Row; [Key(0)] public int Row;
[Key(1)] public int Col; [Key(1)] public int Col;

View File

@ -7,7 +7,7 @@ namespace Game.TicTacToe;
/// Only present on cells that have been claimed. /// Only present on cells that have been claimed.
/// </summary> /// </summary>
[MessagePackObject] [MessagePackObject]
public struct Mark public record struct Mark
{ {
[Key(0)] public Player Player; [Key(0)] public Player Player;
} }

View File

@ -6,7 +6,7 @@ namespace Game.TicTacToe;
/// Global game state stored on the singleton entity. /// Global game state stored on the singleton entity.
/// </summary> /// </summary>
[MessagePackObject] [MessagePackObject]
public struct GameState public record struct GameState
{ {
[Key(0)] public Player CurrentPlayer; [Key(0)] public Player CurrentPlayer;
[Key(1)] public GameStatus Status; [Key(1)] public GameStatus Status;