refactor(battle-node): unify IMatchingBridge.RegisterBattle signature

Single RegisterBattle(p1, p2?, type) with contract validation throws on
invalid combinations (Pvp requires both; Bot requires p2==null; Scripted
accepts either). PendingBattle carries Type + P1 + nullable P2. Handler
+ controller adapt; v1.2 behaviour preserved because Scripted is the
only type used today (Phase 2 adds Pvp, Phase 3 adds Bot).
This commit is contained in:
gamer147
2026-06-01 20:00:52 -04:00
parent acd0997cfb
commit d665f88067
8 changed files with 111 additions and 37 deletions

View File

@@ -3,8 +3,8 @@ using SVSim.BattleNode.Bridge;
namespace SVSim.BattleNode.Sessions;
/// <summary>
/// Sparse pre-connect record: viewer id + the per-battle MatchContext snapshot. Enough to
/// validate the incoming WS connect, resolve the viewer, and seed the BattleSession with the
/// player-half lifecycle data. Full BattleSession is created on connect.
/// Sparse pre-connect record. Carries the battle type + one or two players. The
/// WebSocket handler reads this to validate the incoming WS connect and to
/// construct the right participants.
/// </summary>
public sealed record PendingBattle(string BattleId, long ViewerId, MatchContext Context);
public sealed record PendingBattle(string BattleId, BattleType Type, BattlePlayer P1, BattlePlayer? P2);