NanDaEnvironmentalProtection/Assets/Plugins/UniTask/Runtime/UnityAsyncExtensions.uGUI.cs

858 lines
31 KiB
C#

#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#if !UNITY_2019_1_OR_NEWER || UNITASK_UGUI_SUPPORT
using System;
using System.Threading;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
namespace Cysharp.Threading.Tasks
{
public static partial class UnityAsyncExtensions
{
public static AsyncUnityEventHandler GetAsyncEventHandler(this UnityEvent unityEvent, CancellationToken cancellationToken)
{
return new AsyncUnityEventHandler(unityEvent, cancellationToken, false);
}
public static UniTask OnInvokeAsync(this UnityEvent unityEvent, CancellationToken cancellationToken)
{
return new AsyncUnityEventHandler(unityEvent, cancellationToken, true).OnInvokeAsync();
}
public static IUniTaskAsyncEnumerable<AsyncUnit> OnInvokeAsAsyncEnumerable(this UnityEvent unityEvent, CancellationToken cancellationToken)
{
return new UnityEventHandlerAsyncEnumerable(unityEvent, cancellationToken);
}
public static AsyncUnityEventHandler<T> GetAsyncEventHandler<T>(this UnityEvent<T> unityEvent, CancellationToken cancellationToken)
{
return new AsyncUnityEventHandler<T>(unityEvent, cancellationToken, false);
}