feat(battle-node): typed Deal/Swap/Ready bodies + PosIdx

This commit is contained in:
gamer147
2026-06-01 10:34:44 -04:00
parent 78a6fe93fb
commit 97b9b6fe42
5 changed files with 87 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
using System.Text.Json.Serialization;
namespace SVSim.BattleNode.Protocol.Bodies;
public sealed record DealBody(
[property: JsonPropertyName("self")] IReadOnlyList<PosIdx> Self,
[property: JsonPropertyName("oppo")] IReadOnlyList<PosIdx> Oppo,
[property: JsonPropertyName("resultCode")] int ResultCode = 1) : IMsgBody;

View File

@@ -0,0 +1,7 @@
using System.Text.Json.Serialization;
namespace SVSim.BattleNode.Protocol.Bodies;
public sealed record PosIdx(
[property: JsonPropertyName("pos")] int Pos,
[property: JsonPropertyName("idx")] int Idx);

View File

@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;
namespace SVSim.BattleNode.Protocol.Bodies;
public sealed record ReadyBody(
[property: JsonPropertyName("self")] IReadOnlyList<PosIdx> Self,
[property: JsonPropertyName("oppo")] IReadOnlyList<PosIdx> Oppo,
[property: JsonPropertyName("idxChangeSeed")] int IdxChangeSeed,
[property: JsonPropertyName("spin")] int Spin,
[property: JsonPropertyName("resultCode")] int ResultCode = 1) : IMsgBody;

View File

@@ -0,0 +1,7 @@
using System.Text.Json.Serialization;
namespace SVSim.BattleNode.Protocol.Bodies;
public sealed record SwapResponseBody(
[property: JsonPropertyName("self")] IReadOnlyList<PosIdx> Self,
[property: JsonPropertyName("resultCode")] int ResultCode = 1) : IMsgBody;