mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
[+] 接入ET8服务端
[+] 接入ET8服务端
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
|
||||
namespace ET
|
||||
{
|
||||
[EntitySystemOf(typeof(SessionAcceptTimeoutComponent))]
|
||||
[FriendOf(typeof(SessionAcceptTimeoutComponent))]
|
||||
public static partial class SessionAcceptTimeoutComponentHelper
|
||||
{
|
||||
[Invoke(TimerInvokeType.SessionAcceptTimeout)]
|
||||
public class SessionAcceptTimeout: ATimer<SessionAcceptTimeoutComponent>
|
||||
{
|
||||
protected override void Run(SessionAcceptTimeoutComponent self)
|
||||
{
|
||||
try
|
||||
{
|
||||
self.Parent.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error($"move timer error: {self.Id}\n{e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[EntitySystem]
|
||||
private static void Awake(this SessionAcceptTimeoutComponent self)
|
||||
{
|
||||
self.Timer = self.Fiber().TimerComponent.NewOnceTimer(self.Fiber().TimeInfo.ServerNow() + 5000, TimerInvokeType.SessionAcceptTimeout, self);
|
||||
}
|
||||
|
||||
[EntitySystem]
|
||||
private static void Destroy(this SessionAcceptTimeoutComponent self)
|
||||
{
|
||||
self.Fiber().TimerComponent?.Remove(ref self.Timer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user