using Fantasy.Async; using Fantasy.Entitas; using Fantasy.Network; namespace Hotfix; public static class EntityTimeOutHelper { public static bool CheckInterval(this Entity self, int interval) { var entityTimeOut = self.GetComponent(); if (entityTimeOut == null) { entityTimeOut = self.AddComponent(); entityTimeOut.SetInterval(interval); } return entityTimeOut.CheckInterval(); } public static void SetTimeout(this Entity self, long timeout,Func? callback = null) { var entityTimeOut = self.GetComponent(); if (entityTimeOut == null) { entityTimeOut = self.AddComponent(); } entityTimeOut.TimeOut(timeout,callback); } public static bool IsHasTimeout(this Entity self) { return self.GetComponent() != null; } }