This commit is contained in:
CortexCore
2024-11-03 16:38:17 +08:00
parent 056e2cada5
commit 4ba741408d
4693 changed files with 2445 additions and 5443 deletions

View File

@@ -101,7 +101,7 @@ namespace BITKit.Net
BIT4Log.Log<KCPNetServer>($"{Name}:链接{id}超时,已断开");
}
if (server.IsActive() is false || ManualTick) return;
if (server.IsActive() is false) return;
server.Tick();
@@ -150,9 +150,11 @@ namespace BITKit.Net
_timer.Interval = 1000f / TickRate;
_interval = TimeSpan.FromSeconds(1.0 / TickRate);
}
OnStartServer?.Invoke();
server.Start(port);
_timer.Start();
if (ManualTick is false)
_timer.Start();
_isStarted = true;
BIT4Log.Log<KCPNetServer>($"已启动KCP服务器:{port}");
}
@@ -551,14 +553,14 @@ namespace BITKit.Net
{
foreach (var methodInfo in rpcHandle.GetType().GetMethods())
{
var att = methodInfo.GetCustomAttribute<NetRpcAttribute>();
var att = methodInfo.GetCustomAttribute<NetRpcAttribute>(true);
if(att is null)continue;
_rpcMethods.TryAdd(methodInfo.Name, methodInfo);
_rpcHandles.TryAdd(methodInfo.Name, rpcHandle);
}
foreach (var eventInfo in rpcHandle.GetType().GetEvents())
{
var att = eventInfo.GetCustomAttribute<NetRpcAttribute>();
var att = eventInfo.GetCustomAttribute<NetRpcAttribute>(true);
if(att is null)continue;
_rpcEvents.TryAdd(eventInfo.Name, eventInfo);