From 04ffe31b6a2b2fbcfecc83abb44a8aa233f2e53f Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期一, 02 二月 2026 18:45:57 +0800
Subject: [PATCH] 54 【淘金】切后台淘金完成 时间显示负数
---
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