feat(battle-node): typed Deal/Swap/Ready bodies + PosIdx
This commit is contained in:
8
SVSim.BattleNode/Protocol/Bodies/DealBody.cs
Normal file
8
SVSim.BattleNode/Protocol/Bodies/DealBody.cs
Normal 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;
|
||||
7
SVSim.BattleNode/Protocol/Bodies/PosIdx.cs
Normal file
7
SVSim.BattleNode/Protocol/Bodies/PosIdx.cs
Normal 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);
|
||||
10
SVSim.BattleNode/Protocol/Bodies/ReadyBody.cs
Normal file
10
SVSim.BattleNode/Protocol/Bodies/ReadyBody.cs
Normal 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;
|
||||
7
SVSim.BattleNode/Protocol/Bodies/SwapResponseBody.cs
Normal file
7
SVSim.BattleNode/Protocol/Bodies/SwapResponseBody.cs
Normal 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;
|
||||
Reference in New Issue
Block a user