mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
升级YooAsset->2.1.1、UniTask->2.5.4
升级YooAsset->2.1.1、UniTask->2.5.4
This commit is contained in:
@@ -81,6 +81,16 @@ namespace Cysharp.Threading.Tasks
|
||||
return factory();
|
||||
}
|
||||
|
||||
public static UniTask Create(Func<CancellationToken, UniTask> factory, CancellationToken cancellationToken)
|
||||
{
|
||||
return factory(cancellationToken);
|
||||
}
|
||||
|
||||
public static UniTask Create<T>(T state, Func<T, UniTask> factory)
|
||||
{
|
||||
return factory(state);
|
||||
}
|
||||
|
||||
public static UniTask<T> Create<T>(Func<UniTask<T>> factory)
|
||||
{
|
||||
return factory();
|
||||
@@ -137,11 +147,19 @@ namespace Cysharp.Threading.Tasks
|
||||
return () => asyncAction(cancellationToken).Forget();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// helper of create add UniTaskVoid to delegate.
|
||||
/// </summary>
|
||||
public static Action Action<T>(T state, Func<T, UniTaskVoid> asyncAction)
|
||||
{
|
||||
return () => asyncAction(state).Forget();
|
||||
}
|
||||
|
||||
#if UNITY_2018_3_OR_NEWER
|
||||
|
||||
/// <summary>
|
||||
/// Create async void(UniTaskVoid) UnityAction.
|
||||
/// For exampe: onClick.AddListener(UniTask.UnityAction(async () => { /* */ } ))
|
||||
/// For example: onClick.AddListener(UniTask.UnityAction(async () => { /* */ } ))
|
||||
/// </summary>
|
||||
public static UnityEngine.Events.UnityAction UnityAction(Func<UniTaskVoid> asyncAction)
|
||||
{
|
||||
@@ -150,13 +168,22 @@ namespace Cysharp.Threading.Tasks
|
||||
|
||||
/// <summary>
|
||||
/// Create async void(UniTaskVoid) UnityAction.
|
||||
/// For exampe: onClick.AddListener(UniTask.UnityAction(FooAsync, this.GetCancellationTokenOnDestroy()))
|
||||
/// For example: onClick.AddListener(UniTask.UnityAction(FooAsync, this.GetCancellationTokenOnDestroy()))
|
||||
/// </summary>
|
||||
public static UnityEngine.Events.UnityAction UnityAction(Func<CancellationToken, UniTaskVoid> asyncAction, CancellationToken cancellationToken)
|
||||
{
|
||||
return () => asyncAction(cancellationToken).Forget();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create async void(UniTaskVoid) UnityAction.
|
||||
/// For example: onClick.AddListener(UniTask.UnityAction(FooAsync, Argument))
|
||||
/// </summary>
|
||||
public static UnityEngine.Events.UnityAction UnityAction<T>(T state, Func<T, UniTaskVoid> asyncAction)
|
||||
{
|
||||
return () => asyncAction(state).Forget();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user