diff --git a/SCHALE.GameServer/Controllers/Api/GatewayController.cs b/SCHALE.GameServer/Controllers/Api/GatewayController.cs index 9f9684f..e9ee76a 100644 --- a/SCHALE.GameServer/Controllers/Api/GatewayController.cs +++ b/SCHALE.GameServer/Controllers/Api/GatewayController.cs @@ -59,7 +59,7 @@ namespace SCHALE.GameServer.Controllers.Api var payload = (JsonSerializer.Deserialize(payloadStr, requestType) as RequestPacket)!; - var rsp = protocolHandlerFactory.Invoke(protocol, [payload]); + var rsp = protocolHandlerFactory.Invoke(protocol, payload); if (rsp is null) { logger.LogDebug("{Protocol} {Payload:j}", payload.Protocol, payloadStr); diff --git a/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/ProtocolHandlerFactory.cs b/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/ProtocolHandlerFactory.cs index 42244df..073c58c 100644 --- a/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/ProtocolHandlerFactory.cs +++ b/SCHALE.GameServer/Controllers/Api/ProtocolHandlers/ProtocolHandlerFactory.cs @@ -18,7 +18,7 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers public interface IProtocolHandlerFactory { - public ResponsePacket? Invoke(Protocol protocol, params object?[]? args); + public ResponsePacket? Invoke(Protocol protocol, RequestPacket? req); public MethodInfo? GetProtocolHandler(Protocol protocol); public Type? GetRequestPacketTypeByProtocol(Protocol protocol); public void RegisterInstance(Type t, object? inst); @@ -62,14 +62,14 @@ namespace SCHALE.GameServer.Controllers.Api.ProtocolHandlers } } - public ResponsePacket? Invoke(Protocol protocol, params object?[]? args) + public ResponsePacket? Invoke(Protocol protocol, RequestPacket? req) { var handler = GetProtocolHandler(protocol); if (handler is null) return null; handlerInstances.TryGetValue(handler.DeclaringType!, out var inst); - return (ResponsePacket?)handler.Invoke(inst, args); + return (ResponsePacket?)handler.Invoke(inst, [req]); } public MethodInfo? GetProtocolHandler(Protocol protocol)