From 614597ff71a8de4c3c1fb889db285ca2513cc7b3 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 29 七月 2025 00:56:09 +0800
Subject: [PATCH] 0312 去掉表默认的多线程引用,小游戏不支持多线程;特效分离出UI特效;增加按钮组的控制;特效增加池管理

---
 Main/System/Message/WaitCallBack.cs |  298 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 149 insertions(+), 149 deletions(-)

diff --git a/Main/System/Message/WaitCallBack.cs b/Main/System/Message/WaitCallBack.cs
index 6137ec6..8174851 100644
--- a/Main/System/Message/WaitCallBack.cs
+++ b/Main/System/Message/WaitCallBack.cs
@@ -2,168 +2,168 @@
 using System.Collections.Generic;
 using UnityEngine;
 
+/// <summary>
+/// 寤惰繜鍑犵鎵ц浜嬩欢
+/// </summary>
+public class WaitCallBack : MonoBehaviour
+{
+    internal float waitTime = 2.0f;
+
+    public bool doOnAwake = false;
     /// <summary>
-    /// 寤惰繜鍑犵鎵ц浜嬩欢
+    /// 鏃堕棿鍒拌揪鍥炶皟
     /// </summary>
-    public class WaitCallBack : MonoBehaviour
+    public Action<Component> OnCompelete;
+    /// <summary>
+    /// 姣忓抚鍥炶皟
+    /// </summary>
+    public Action<Component> OnWait;
+
+    internal static Dictionary<GameObject, WaitCallBack> waitDic = new Dictionary<GameObject, WaitCallBack>();
+
+    private float m_Time = 0;
+
+    private bool start = false;
+
+    private Component m_Comp;
+
+    private void Awake()
     {
-        internal float waitTime = 2.0f;
-
-        public bool doOnAwake = false;
-        /// <summary>
-        /// 鏃堕棿鍒拌揪鍥炶皟
-        /// </summary>
-        public Action<Component> OnCompelete;
-        /// <summary>
-        /// 姣忓抚鍥炶皟
-        /// </summary>
-        public Action<Component> OnWait;
-
-        internal static Dictionary<GameObject, WaitCallBack> waitDic = new Dictionary<GameObject, WaitCallBack>();
-
-        private float m_Time = 0;
-
-        private bool start = false;
-
-        private Component m_Comp;
-
-        private void Awake()
+        if (doOnAwake)
         {
-            if (doOnAwake)
-            {
-                Play();
-            }
-        }
-
-        private void OnDisable()
-        {
-            Stop();
-        }
-
-        private void Update()
-        {
-            if (start)
-            {
-                m_Time += Time.deltaTime;
-                if (m_Time >= waitTime)
-                {
-                    Stop();
-                    if (OnCompelete != null)
-                        OnCompelete(m_Comp);
-                }
-                if (OnWait != null && start)
-                    OnWait(m_Comp);
-            }
-        }
-
-        internal void Play()
-        {
-            start = true;
-        }
-
-        internal void Restart()
-        {
-            m_Time = 0;
             Play();
         }
-
-        internal void Stop()
-        {
-            m_Time = 0;
-            start = false;
-        }
-
-        internal void Pause()
-        {
-            start = false;
-        }
-
-        private void OnDestroy()
-        {
-            if (waitDic.ContainsKey(gameObject))
-            {
-                waitDic.Remove(gameObject);
-            }
-        }
-
-        internal void AddWaitDic(Component go)
-        {
-            m_Comp = go;
-            waitDic.Add(go.gameObject, this);
-        }
     }
 
-    public static class Helper
+    private void OnDisable()
     {
-        public static void DoWaitStart(this Component go)
-        {
-            if (GetWait(go) == null)
-                return;
-            GetWait(go).Play();
-        }
+        Stop();
+    }
 
-        public static void OnWaitCompelete(this Component go, Action<Component> func)
+    private void Update()
+    {
+        if (start)
         {
-            WaitCallBack wait = GetWait(go);
-            if (wait == null)
-                return;
-            wait.OnCompelete = func;
-        }
-
-        public static void OnWait(this Component go, Action<Component> func)
-        {
-            WaitCallBack wait = GetWait(go);
-            if (wait == null)
-                return;
-            wait.OnWait = func;
-        }
-
-        public static void DoWaitRestart(this Component go)
-        {
-            if (GetWait(go) == null)
-                return;
-            GetWait(go).Restart();
-        }
-
-        public static void DoWaitStop(this Component go)
-        {
-            if (GetWait(go) == null)
-                return;
-            GetWait(go).Stop();
-        }
-
-        public static void DoWaitPause(this Component go)
-        {
-            if (GetWait(go) == null)
-                return;
-            GetWait(go).Pause();
-        }
-
-        public static WaitCallBack GetWait(Component go)
-        {
-            WaitCallBack wait = null;
-            if (go == null)
-                return null;
-            WaitCallBack.waitDic.TryGetValue(go.gameObject, out wait);
-            if (wait == null)
+            m_Time += Time.deltaTime;
+            if (m_Time >= waitTime)
             {
-                wait = go.GetComponent<WaitCallBack>();
-                if (wait == null)
-                {
-                    wait = go.gameObject.AddComponent<WaitCallBack>();
-                }
-                wait.AddWaitDic(go);
+                Stop();
+                if (OnCompelete != null)
+                    OnCompelete(m_Comp);
             }
-            return wait;
-        }
-
-        public static void SetWait(this Component comp, float time)
-        {
-            WaitCallBack wait = GetWait(comp);
-            if (wait != null)
-            {
-                wait.waitTime = time;
-            }
+            if (OnWait != null && start)
+                OnWait(m_Comp);
         }
     }
 
+    internal void Play()
+    {
+        start = true;
+    }
+
+    internal void Restart()
+    {
+        m_Time = 0;
+        Play();
+    }
+
+    internal void Stop()
+    {
+        m_Time = 0;
+        start = false;
+    }
+
+    internal void Pause()
+    {
+        start = false;
+    }
+
+    private void OnDestroy()
+    {
+        if (waitDic.ContainsKey(gameObject))
+        {
+            waitDic.Remove(gameObject);
+        }
+    }
+
+    internal void AddWaitDic(Component go)
+    {
+        m_Comp = go;
+        waitDic.Add(go.gameObject, this);
+    }
+}
+
+public static class Helper
+{
+    public static void DoWaitStart(this Component go)
+    {
+        if (GetWait(go) == null)
+            return;
+        GetWait(go).Play();
+    }
+
+    public static void OnWaitCompelete(this Component go, Action<Component> func)
+    {
+        WaitCallBack wait = GetWait(go);
+        if (wait == null)
+            return;
+        wait.OnCompelete = func;
+    }
+
+    public static void OnWait(this Component go, Action<Component> func)
+    {
+        WaitCallBack wait = GetWait(go);
+        if (wait == null)
+            return;
+        wait.OnWait = func;
+    }
+
+    public static void DoWaitRestart(this Component go)
+    {
+        if (GetWait(go) == null)
+            return;
+        GetWait(go).Restart();
+    }
+
+    public static void DoWaitStop(this Component go)
+    {
+        if (GetWait(go) == null)
+            return;
+        GetWait(go).Stop();
+    }
+
+    public static void DoWaitPause(this Component go)
+    {
+        if (GetWait(go) == null)
+            return;
+        GetWait(go).Pause();
+    }
+
+    public static WaitCallBack GetWait(Component go)
+    {
+        WaitCallBack wait = null;
+        if (go == null)
+            return null;
+        WaitCallBack.waitDic.TryGetValue(go.gameObject, out wait);
+        if (wait == null)
+        {
+            wait = go.GetComponent<WaitCallBack>();
+            if (wait == null)
+            {
+                wait = go.gameObject.AddComponent<WaitCallBack>();
+            }
+            wait.AddWaitDic(go);
+        }
+        return wait;
+    }
+
+    public static void SetWait(this Component comp, float time)
+    {
+        WaitCallBack wait = GetWait(comp);
+        if (wait != null)
+        {
+            wait.waitTime = time;
+        }
+    }
+}
+

--
Gitblit v1.8.0