fix: add .Forget() call and rename paramters to keep coding style consistent

pull/621/head
dvsilch 2024-09-27 23:43:16 +08:00
parent cf19f18662
commit 353f15e94f
1 changed files with 7 additions and 7 deletions

View File

@ -190,34 +190,34 @@ namespace Cysharp.Threading.Tasks
/// </summary> /// </summary>
public static UnityEngine.Events.UnityAction<T> UnityAction<T>(Func<T, UniTaskVoid> asyncAction) public static UnityEngine.Events.UnityAction<T> UnityAction<T>(Func<T, UniTaskVoid> asyncAction)
{ {
return (state) => asyncAction(state); return (state) => asyncAction(state).Forget();
} }
/// <summary> /// <summary>
/// Create async void(UniTaskVoid) UnityAction. /// Create async void(UniTaskVoid) UnityAction.
/// For example: onClick.AddListener(UniTask.UnityAction(async (T1 s1, T2 s2) => { /* */ } )) /// For example: onClick.AddListener(UniTask.UnityAction(async (T1 state1, T2 state2) => { /* */ } ))
/// </summary> /// </summary>
public static UnityEngine.Events.UnityAction<T1, T2> UnityAction<T1, T2>(Func<T1, T2, UniTaskVoid> asyncAction) public static UnityEngine.Events.UnityAction<T1, T2> UnityAction<T1, T2>(Func<T1, T2, UniTaskVoid> asyncAction)
{ {
return (s1, s2) => asyncAction(s1, s2); return (state1, state2) => asyncAction(state1, state2).Forget();
} }
/// <summary> /// <summary>
/// Create async void(UniTaskVoid) UnityAction. /// Create async void(UniTaskVoid) UnityAction.
/// For example: onClick.AddListener(UniTask.UnityAction(async (T1 s1, T2 s2, T3 s3) => { /* */ } )) /// For example: onClick.AddListener(UniTask.UnityAction(async (T1 state1, T2 state2, T3 state3) => { /* */ } ))
/// </summary> /// </summary>
public static UnityEngine.Events.UnityAction<T1, T2, T3> UnityAction<T1, T2, T3>(Func<T1, T2, T3, UniTaskVoid> asyncAction) public static UnityEngine.Events.UnityAction<T1, T2, T3> UnityAction<T1, T2, T3>(Func<T1, T2, T3, UniTaskVoid> asyncAction)
{ {
return (s1, s2, s3) => asyncAction(s1, s2, s3); return (state1, state2, state3) => asyncAction(state1, state2, state3).Forget();
} }
/// <summary> /// <summary>
/// Create async void(UniTaskVoid) UnityAction. /// Create async void(UniTaskVoid) UnityAction.
/// For example: onClick.AddListener(UniTask.UnityAction(async (T1 s1, T2 s2, T3 s3, T4 s4) => { /* */ } )) /// For example: onClick.AddListener(UniTask.UnityAction(async (T1 state1, T2 state2, T3 state3, T4 state4) => { /* */ } ))
/// </summary> /// </summary>
public static UnityEngine.Events.UnityAction<T1, T2, T3, T4> UnityAction<T1, T2, T3, T4>(Func<T1, T2, T3, T4, UniTaskVoid> asyncAction) public static UnityEngine.Events.UnityAction<T1, T2, T3, T4> UnityAction<T1, T2, T3, T4>(Func<T1, T2, T3, T4, UniTaskVoid> asyncAction)
{ {
return (s1, s2, s3, s4) => asyncAction(s1, s2, s3, s4); return (state1, state2, state3, state4) => asyncAction(state1, state2, state3, state4).Forget();
} }
#endif #endif