From 09bc892c7283df8757a07b646d5af21ddaa263d1 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期四, 06 十一月 2025 18:22:34 +0800
Subject: [PATCH] 164 天子的考验-客户端

---
 Main/Utility/UniTaskExtension.cs |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/Main/Utility/UniTaskExtension.cs b/Main/Utility/UniTaskExtension.cs
index 58ff6bd..2ff6255 100644
--- a/Main/Utility/UniTaskExtension.cs
+++ b/Main/Utility/UniTaskExtension.cs
@@ -4,12 +4,12 @@
 
 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);
     }
 
-	public static void DelayFrame(this Component cmp, Action action)
+    public static void DelayFrame(this Component cmp, Action action)
     {
         DelayFrameInternal(1, action);
     }
@@ -29,4 +29,30 @@
     {
         DelayFrameInternal(frames, action);
     }
+
+    public static void DelayFrame(Action action)
+    {
+        DelayFrameInternal(1, action);
+    }
+
+    public static void DelayTime(this GameObject go, float time, Action action)
+    {
+        DelayTimeInternal(time, action);
+    }
+
+    public static void DelayTime(this Component cmp, float time, Action action)
+    {
+        DelayTimeInternal(time, action);
+    }
+
+    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