From 51b0f6ed9f4e1d3bb6f8144470b46908c7699a96 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 11 五月 2026 16:20:37 +0800
Subject: [PATCH] Merge branch 'master' into h5version
---
Main/Utility/UniTaskExtension.cs | 38 ++++++++++++++++++++++++++++++++------
1 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/Main/Utility/UniTaskExtension.cs b/Main/Utility/UniTaskExtension.cs
index 58ff6bd..cab6e65 100644
--- a/Main/Utility/UniTaskExtension.cs
+++ b/Main/Utility/UniTaskExtension.cs
@@ -4,14 +4,14 @@
public static class UniTaskExtension
{
- public static void DelayFrame(this GameObject go, Action action)
+ public static void DelayFrame(this GameObject go, Action action)
{
- DelayFrameInternal(1, action);
+ DelayFrameInternal(1, action).Forget();
}
- public static void DelayFrame(this Component cmp, Action action)
+ public static void DelayFrame(this Component cmp, Action action)
{
- DelayFrameInternal(1, action);
+ DelayFrameInternal(1, action).Forget();
}
private async static UniTask DelayFrameInternal(int frame, Action action)
@@ -22,11 +22,37 @@
public static void DelayFrames(this Component cmp, int frames, Action action)
{
- DelayFrameInternal(frames, action);
+ DelayFrameInternal(frames, action).Forget();
}
public static void DelayFrames(this GameObject go, int frames, Action action)
{
- DelayFrameInternal(frames, action);
+ DelayFrameInternal(frames, action).Forget();
+ }
+
+ public static void DelayFrame(Action action)
+ {
+ DelayFrameInternal(1, action).Forget();
+ }
+
+ public static void DelayTime(this GameObject go, float time, Action action)
+ {
+ DelayTimeInternal(time, action).Forget();
+ }
+
+ public static void DelayTime(this Component cmp, float time, Action action)
+ {
+ DelayTimeInternal(time, action).Forget();
+ }
+
+ private async static UniTask DelayTimeInternal(float time, Action action)
+ {
+ if (time <= 0f)
+ {
+ action?.Invoke();
+ return;
+ }
+ await UniTask.Delay(TimeSpan.FromSeconds(time));
+ action?.Invoke();
}
}
\ No newline at end of file
--
Gitblit v1.8.0