1
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
|
||||
"GUID:9354affc93e0f3e4a904785e7d4c0f59",
|
||||
"GUID:c56f2ae4d67b9b947a600c84225206a2",
|
||||
"GUID:296866320aab85a42a0403bf684bac59"
|
||||
"GUID:296866320aab85a42a0403bf684bac59",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
@@ -103,14 +103,19 @@ namespace BITKit.Net
|
||||
_netProviderImplementation.AddCommandListener(handle);
|
||||
}
|
||||
|
||||
public void AddCommandListener<T>(Func<T, T> func)
|
||||
public void RemoveCommandListener<T>(Action<T> handle)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_netProviderImplementation.RemoveCommandListener(handle);
|
||||
}
|
||||
|
||||
public void RemoveCommandListener<T>(Func<T, T> func)
|
||||
public void AddCommandListener<T>(Func<T, UniTask<T>> func)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_netProviderImplementation.AddCommandListener(func);
|
||||
}
|
||||
|
||||
public void RemoveCommandListener<T>(Func<T, UniTask<T>> func)
|
||||
{
|
||||
_netProviderImplementation.RemoveCommandListener(func);
|
||||
}
|
||||
public void SendRT(string rpcName, params object[] pars)
|
||||
{
|
||||
@@ -189,6 +194,11 @@ namespace BITKit.Net
|
||||
{
|
||||
_netServerImplementation1.AddCommandListenerWithId(handle);
|
||||
}
|
||||
|
||||
public void KickClient(int id)
|
||||
{
|
||||
_netServerImplementation1.KickClient(id);
|
||||
}
|
||||
}
|
||||
|
||||
public class GameNetProvider : MonoBehaviour
|
||||
|
@@ -115,14 +115,19 @@ namespace BITKit.Net.Kcp
|
||||
_netProviderImplementation.AddCommandListener(handle);
|
||||
}
|
||||
|
||||
public void AddCommandListener<T>(Func<T, T> func)
|
||||
public void RemoveCommandListener<T>(Action<T> handle)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_netProviderImplementation.RemoveCommandListener(handle);
|
||||
}
|
||||
|
||||
public void RemoveCommandListener<T>(Func<T, T> func)
|
||||
public void AddCommandListener<T>(Func<T, UniTask<T>> func)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
_netProviderImplementation.AddCommandListener(func);
|
||||
}
|
||||
|
||||
public void RemoveCommandListener<T>(Func<T, UniTask<T>> func)
|
||||
{
|
||||
_netProviderImplementation.RemoveCommandListener(func);
|
||||
}
|
||||
public void SendRT(string rpcName, params object[] pars)
|
||||
{
|
||||
|
@@ -1,133 +0,0 @@
|
||||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace BITKit.Net.Kcp
|
||||
{
|
||||
[Serializable]
|
||||
public class MonoKcpClientSingleton : INetProvider,INetClient
|
||||
{
|
||||
private bool _manualTick;
|
||||
private INetClient _netClientImplementation => MonoKcpClient.Singleton;
|
||||
private INetProvider _netProviderImplementation => MonoKcpClient.Singleton;
|
||||
|
||||
public event Action OnStartConnect
|
||||
{
|
||||
add => _netClientImplementation.OnStartConnect += value;
|
||||
remove => _netClientImplementation.OnStartConnect -= value;
|
||||
}
|
||||
|
||||
public event Action OnConnected
|
||||
{
|
||||
add => _netClientImplementation.OnConnected += value;
|
||||
remove => _netClientImplementation.OnConnected -= value;
|
||||
}
|
||||
|
||||
public event Action OnDisconnected
|
||||
{
|
||||
add => _netClientImplementation.OnDisconnected += value;
|
||||
remove => _netClientImplementation.OnDisconnected -= value;
|
||||
}
|
||||
|
||||
public event Action OnConnectedFailed
|
||||
{
|
||||
add => _netClientImplementation.OnConnectedFailed += value;
|
||||
remove => _netClientImplementation.OnConnectedFailed -= value;
|
||||
}
|
||||
|
||||
public bool IsConnected => _netClientImplementation.IsConnected;
|
||||
|
||||
public bool ManualTick
|
||||
{
|
||||
get => _netClientImplementation.ManualTick;
|
||||
set => _netClientImplementation.ManualTick = value;
|
||||
}
|
||||
|
||||
public int Ping => _netClientImplementation.Ping;
|
||||
|
||||
public int Id => _netClientImplementation.Id;
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
_netClientImplementation.Disconnect();
|
||||
}
|
||||
|
||||
public UniTask<bool> Connect(string address = "localhost", ushort port = 27014)
|
||||
{
|
||||
return _netClientImplementation.Connect(address, port);
|
||||
}
|
||||
|
||||
public void SendServerMessage(string message)
|
||||
{
|
||||
_netClientImplementation.SendServerMessage(message);
|
||||
}
|
||||
|
||||
public void ServerCommand<T>(T command = default)
|
||||
{
|
||||
_netProviderImplementation.ServerCommand(command);
|
||||
}
|
||||
|
||||
public void AllClientCommand<T>(T command = default)
|
||||
{
|
||||
_netProviderImplementation.AllClientCommand(command);
|
||||
}
|
||||
|
||||
public void ClientCommand<T>(int id, T command)
|
||||
{
|
||||
_netProviderImplementation.ClientCommand(id, command);
|
||||
}
|
||||
|
||||
public UniTask<T> GetFromServer<T>(T command = default)
|
||||
{
|
||||
return _netProviderImplementation.GetFromServer<T>(command);
|
||||
}
|
||||
|
||||
public UniTask<T> GetFromClient<T>(int id, T command = default)
|
||||
{
|
||||
return _netProviderImplementation.GetFromClient<T>(id, command);
|
||||
}
|
||||
public void AddRpcHandle(object rpcHandle)
|
||||
{
|
||||
_netProviderImplementation.AddRpcHandle(rpcHandle);
|
||||
}
|
||||
|
||||
public void AddCommandListener<T>(Action<T> handle)
|
||||
{
|
||||
_netProviderImplementation.AddCommandListener(handle);
|
||||
}
|
||||
|
||||
public void AddCommandListener<T>(Func<T, T> func)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void RemoveCommandListener<T>(Func<T, T> func)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public void SendRT(string rpcName, params object[] pars)
|
||||
{
|
||||
_netProviderImplementation.SendRT(rpcName, pars);
|
||||
}
|
||||
|
||||
public void SendTargetRT(int id, string rpcName, params object[] pars)
|
||||
{
|
||||
_netProviderImplementation.SendTargetRT(id, rpcName, pars);
|
||||
}
|
||||
|
||||
public void SendAllRT(string rpcName, params object[] pars)
|
||||
{
|
||||
_netProviderImplementation.SendAllRT(rpcName, pars);
|
||||
}
|
||||
|
||||
public void Tick()
|
||||
{
|
||||
_netProviderImplementation.Tick();
|
||||
}
|
||||
|
||||
public void HandShake()
|
||||
{
|
||||
_netProviderImplementation.HandShake();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85f2774aa6284284686cd562b03c654b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -74,7 +74,12 @@ namespace BITKit.Net.Kcp
|
||||
{
|
||||
_netServerImplementation.AddCommandListenerWithId(handle);
|
||||
}
|
||||
|
||||
|
||||
public void KickClient(int id)
|
||||
{
|
||||
_netServerImplementation.KickClient(id);
|
||||
}
|
||||
|
||||
[BIT]
|
||||
private void EditorStartServer()
|
||||
{
|
||||
@@ -127,12 +132,12 @@ namespace BITKit.Net.Kcp
|
||||
_server.AddCommandListener(handle);
|
||||
}
|
||||
|
||||
public void AddCommandListener<T>(Func<T, T> func)
|
||||
public void AddCommandListener<T>(Func<T,UniTask<T>> func)
|
||||
{
|
||||
_serverInstance.AddCommandListener(func);
|
||||
}
|
||||
|
||||
public void RemoveCommandListener<T>(Func<T, T> func)
|
||||
public void RemoveCommandListener<T>(Func<T,UniTask<T>> func)
|
||||
{
|
||||
_serverInstance.RemoveCommandListener(func);
|
||||
}
|
||||
|
Reference in New Issue
Block a user