Removed CancelAfterSlim(bool ignoreTimeScale), changed to CancelAfterSlim(DelayType delayType)

pull/115/head
neuecc 2020-06-25 22:35:35 +09:00
parent 0a447e43b0
commit ab76098895
2 changed files with 5 additions and 4 deletions

View File

@ -36,6 +36,7 @@ namespace Cysharp.Threading.Tasks
UniTaskScheduler.PublishUnobservedTaskException(ex); UniTaskScheduler.PublishUnobservedTaskException(ex);
} }
cts.Cancel(); cts.Cancel();
cts.Dispose();
} }
public static (UniTask, CancellationTokenRegistration) ToUniTask(this CancellationToken cancellationToken) public static (UniTask, CancellationTokenRegistration) ToUniTask(this CancellationToken cancellationToken)

View File

@ -9,15 +9,15 @@ namespace Cysharp.Threading.Tasks
{ {
public static class CancellationTokenSourceExtensions public static class CancellationTokenSourceExtensions
{ {
public static void CancelAfterSlim(this CancellationTokenSource cts, int millisecondsDelay, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update) public static void CancelAfterSlim(this CancellationTokenSource cts, int millisecondsDelay, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)
{ {
var delay = UniTask.Delay(millisecondsDelay, ignoreTimeScale, delayTiming, cts.Token); var delay = UniTask.Delay(millisecondsDelay, delayType, delayTiming, cts.Token);
CancelAfterCore(cts, delay).Forget(); CancelAfterCore(cts, delay).Forget();
} }
public static void CancelAfterSlim(this CancellationTokenSource cts, TimeSpan delayTimeSpan, bool ignoreTimeScale = false, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update) public static void CancelAfterSlim(this CancellationTokenSource cts, TimeSpan delayTimeSpan, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming delayTiming = PlayerLoopTiming.Update)
{ {
var delay = UniTask.Delay(delayTimeSpan, ignoreTimeScale, delayTiming, cts.Token); var delay = UniTask.Delay(delayTimeSpan, delayType, delayTiming, cts.Token);
CancelAfterCore(cts, delay).Forget(); CancelAfterCore(cts, delay).Forget();
} }