TH1/Unity/Assets/Scripts/Core/Helper/ETCancelationTokenHelper.cs
2025-07-17 18:26:28 +08:00

22 lines
522 B
C#

namespace ET
{
public static class ETCancelationTokenHelper
{
public static async ETTask CancelAfter(this ETCancellationToken self, Fiber fiber, long afterTimeCancel)
{
if (self.IsCancel())
{
return;
}
await fiber.Root.GetComponent<TimerComponent>().WaitAsync(afterTimeCancel);
if (self.IsCancel())
{
return;
}
self.Cancel();
}
}
}