using Microsoft.Extensions.Logging; using RPG.Network.Proto; using RPG.Services.Core.Network; using RPG.Services.Core.Network.Attributes; using RPG.Services.Core.Network.Command; using RPG.Services.Core.Session; using RPG.Services.Gateserver.Session; namespace RPG.Services.Gateserver.Network.Command; internal class GateserverCommandHandler : ServiceCommandHandler { private readonly SessionManager _sessionManager; public GateserverCommandHandler(ILogger logger, ServiceBox services, SessionManager sessionManager) : base(logger, services) { _sessionManager = sessionManager; } [ServiceCommand(ServiceCommandType.BindContainerResult)] public async Task OnBindContainerResult(ServiceCommand command) { CmdBindContainerResult result = CmdBindContainerResult.Parser.ParseFrom(command.Body.Span); if (_sessionManager.TryGet(result.SessionId, out NetworkSession? session)) { PlayerGetTokenScRsp rsp; if (result.Retcode != 0) { rsp = new() { Retcode = 1 }; } else { rsp = new() { Retcode = 0, Msg = "OK", Uid = session.PlayerUid }; } await session.SendAsync(CmdType.CmdPlayerGetTokenScRsp, rsp); } } }