This commit is contained in:
CortexCore
2024-06-08 10:07:40 +08:00
parent ccc9957809
commit b9731c20a1
11 changed files with 231 additions and 44 deletions

View File

@@ -108,16 +108,15 @@ namespace BITKit.Net.Kcp
_server.ClientCommand(id, command);
}
public UniTask<T> GetFromServer<T>(string addressablePath = Constant.System.Internal)
public UniTask<T> GetFromServer<T>(T command = default)
{
return _server.GetFromServer<T>(addressablePath);
return _serverInstance.GetFromServer(command);
}
public UniTask<T> GetFromClient<T>(int id, string addressablePath = Constant.System.Internal)
public UniTask<T> GetFromClient<T>(int id, T command = default)
{
return _server.GetFromClient<T>(id, addressablePath);
return _serverInstance.GetFromClient(id, command);
}
public void AddRpcHandle(object rpcHandle)
{
_server.AddRpcHandle(rpcHandle);
@@ -128,6 +127,16 @@ namespace BITKit.Net.Kcp
_server.AddCommandListener(handle);
}
public void AddCommandListener<T>(Func<T, T> func)
{
_serverInstance.AddCommandListener(func);
}
public void RemoveCommandListener<T>(Func<T, T> func)
{
_serverInstance.RemoveCommandListener(func);
}
public void RemoveCommandListener<T>(Action<T> handle)
{
_server.RemoveCommandListener(handle);