| | |
| | | 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;
|
| | | }
|
| | | |
| | | // 获取指定类型的所有UI实例
|
| | | public List<T> GetAllUI<T>() where T : UIBase
|
| | | {
|
| | |
| | | // 获取UI类型名称
|
| | | string uiName = typeof(T).Name;
|
| | |
|
| | | CloseWindow(uiName);
|
| | | |
| | | }
|
| | |
|
| | | public void CloseWindow(string uiName)
|
| | | {
|
| | | // 检查UI是否存在
|
| | | if (!uiDict.ContainsKey(uiName) || uiDict[uiName].Count == 0)
|
| | | {
|