From b54023f3a378e71a0e890cc6fafd7f4504037837 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 20 五月 2025 15:07:30 +0800
Subject: [PATCH] ui开关与否的接口支持

---
 Main/UI/UIManager.cs |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/Main/UI/UIManager.cs b/Main/UI/UIManager.cs
index 7a86a36..dd7a2fe 100644
--- a/Main/UI/UIManager.cs
+++ b/Main/UI/UIManager.cs
@@ -241,6 +241,52 @@
         // 濡傛灉涓嶅瓨鍦紝杩斿洖null
         return null;
     }
+
+    public List<T> GetUIList<T>() where T : UIBase
+    {
+        List<T> uiList = new List<T>();
+
+        // 鑾峰彇UI绫诲瀷鍚嶇О
+        string uiName = typeof(T).Name;
+        if (string.IsNullOrEmpty(uiName))
+        {
+            // 璁板綍閿欒鏃ュ織
+            Debug.LogError("UI鍚嶇О涓虹┖");
+            return uiList;
+        }
+
+        // 灏濊瘯浠庡瓧鍏镐腑鑾峰彇UI瀹炰緥鍒楄〃
+        uiDict.TryGetValue(uiName, out uiList);
+
+        return uiList;
+    }
+
+    public bool IsOpenedInList<T>() where T : UIBase
+    {
+        List<T> uiList = GetUIList<T>();
+
+        foreach (T ui in uiList)
+        {
+            if (ui.IsActive())
+            {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    public bool IsOpened<T>() where T : UIBase
+    {
+        T ui = GetUI<T>();
+
+        if (null != ui)
+        {
+            return ui.IsActive();
+        }
+
+        return false;
+    }
     
     // 鑾峰彇鎸囧畾绫诲瀷鐨勬墍鏈塙I瀹炰緥
     public List<T> GetAllUI<T>() where T : UIBase
@@ -538,6 +584,12 @@
         // 鑾峰彇UI绫诲瀷鍚嶇О
         string uiName = typeof(T).Name;
         
+        CloseWindow(uiName);
+        
+    }
+
+    public void CloseWindow(string uiName)
+    {
         // 妫�鏌I鏄惁瀛樺湪
         if (!uiDict.ContainsKey(uiName) || uiDict[uiName].Count == 0)
         {

--
Gitblit v1.8.0