refactor(battle-node): extract InitNetworkHandler

This commit is contained in:
gamer147
2026-06-03 14:04:58 -04:00
parent 73d2c4e1b8
commit 7c36933c06
2 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
using SVSim.BattleNode.Lifecycle;
using SVSim.BattleNode.Protocol;
namespace SVSim.BattleNode.Sessions.Dispatch.Handlers;
internal sealed class InitNetworkHandler : IFrameHandler
{
public IReadOnlyList<DispatchRoute> Handle(FrameDispatchContext ctx)
{
if (ctx.SenderPhase != BattleSessionPhase.AwaitingInitNetwork)
return Array.Empty<DispatchRoute>();
var routes = new List<DispatchRoute>
{
new(ctx.From, BattleFrames.BuildAck(NetworkBattleUri.InitNetwork), true),
};
ctx.SenderPhase = BattleSessionPhase.AwaitingInitBattle;
return routes;
}
}