Eintoo/GameServer/Server/Hotfix/Outter/Authentication/Account/TimeOut/AccountInfoTimeOuterComponentSystem.cs
2025-03-19 18:16:39 +08:00

39 lines
966 B
C#

using Fantasy.Entitas.Interface;
namespace Hotfix;
public static class AccountInfoTimeOuterComponentSystem
{
public static void TimeOut(this AccountInfoTimeOuterComponent self,int time)
{
var scene = self.Scene;
var parentRunTimeId = self.Parent.RuntimeId;
self.TimeId = scene.TimerComponent.Net.OnceTimer(time, () =>
{
if (parentRunTimeId != self.Parent.RuntimeId)
{
return;
}
self.TimeId = 0;
AuthenticationHelper.RemoveCacheAccountInfo(scene,self.Key);
});
}
}
public class AccountInfoTimeOuterComponentDestroySystem : DestroySystem<AccountInfoTimeOuterComponent>
{
protected override void Destroy(AccountInfoTimeOuterComponent self)
{
if (self.TimeId != 0)
{
self.Scene.TimerComponent.Net.Remove(self.TimeId);
}
self.TimeId = 0;
self.Key = string.Empty;
}
}