34 lines
877 B
C#
34 lines
877 B
C#
using Fantasy;
|
|
using Fantasy.Entitas.Interface;
|
|
|
|
namespace Hotfix;
|
|
|
|
public static class AccountTimeOuterComponentSystem
|
|
{
|
|
|
|
public static void TimeOut(this AccountTimeOuterComponent self, long timer)
|
|
{
|
|
var scene = self.Scene;
|
|
self.TimeId = scene.TimerComponent.Net.OnceTimer(timer, () =>
|
|
{
|
|
|
|
var account = self.Parent as Account;
|
|
self.TimeId = 0;
|
|
AuthenticationHelper.RemoveCacheAccount(scene, account.Username.GetHashCode());
|
|
});
|
|
}
|
|
}
|
|
|
|
public class AccountTimeOuterComponentDestroySystem : DestroySystem<AccountTimeOuterComponent>
|
|
{
|
|
protected override void Destroy(AccountTimeOuterComponent self)
|
|
{
|
|
if (self.TimeId != 0)
|
|
{
|
|
self.Scene.TimerComponent.Net.Remove(self.TimeId);
|
|
}
|
|
self.TimeId = 0;
|
|
self.UserCode = 0;
|
|
}
|
|
}
|