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/Manager/UIManager.cs | 120 ++++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 85 insertions(+), 35 deletions(-)
diff --git a/Main/Manager/UIManager.cs b/Main/Manager/UIManager.cs
index 5be6bdd..eed236b 100644
--- a/Main/Manager/UIManager.cs
+++ b/Main/Manager/UIManager.cs
@@ -131,17 +131,22 @@
layerTransformCache.Add(UILayer.Loading, loadingTrans);
}
+ public Transform GetUIRoot()
+ {
+ return uiRoot;
+ }
+
#endregion
#region 杈呭姪鏂规硶
-
+
// 鑾峰彇UI灞傜骇瀵瑰簲鐨勫熀纭�鎺掑簭椤哄簭
public static int GetBaseSortingOrderForLayer(UILayer layer)
{
// 灏濊瘯浠庣紦瀛樹腑鑾峰彇鎺掑簭椤哄簭
if (layerSortingOrderCache.TryGetValue(layer, out int order))
return order;
-
+
// 濡傛灉缂撳瓨涓病鏈夛紝浣跨敤鍘熸潵鐨勬柟娉曡绠楀苟缂撳瓨缁撴灉
int result;
switch (layer)
@@ -165,14 +170,14 @@
result = BASE_SORTING_ORDER * 10;
break;
}
-
+
// 灏嗙粨鏋滃瓨鍏ョ紦瀛�
layerSortingOrderCache[layer] = result;
return result;
}
// 鑾峰彇灞傜骇瀵瑰簲鐨凾ransform
- private Transform GetTransForLayer(UILayer layer)
+ public Transform GetTransForLayer(UILayer layer)
{
// 灏濊瘯浠庣紦瀛樹腑鑾峰彇Transform
if (layerTransformCache.TryGetValue(layer, out Transform trans))
@@ -308,6 +313,72 @@
return false;
}
+
+ public bool IsOpened(string uiName)
+ {
+ UIBase ui = GetUI(uiName);
+
+ if (null != ui)
+ {
+ return ui.IsActive();
+ }
+
+ return false;
+ }
+
+ // 妫�鏌ユ槸鍚﹀瓨鍦ㄤ换浣曞叏灞忔垨閬僵绐楀彛, 鏈塻creenMask 鍗冲彲浠h〃鍏ㄥ睆
+ public bool ExistAnyFullScreenOrMaskWin(string excludeUIName)
+ {
+ var exist = false;
+ foreach (var uiList in uiDict.Values)
+ {
+ // 閬嶅巻璇ョ被鍨嬬殑鎵�鏈塙I瀹炰緥
+ foreach (var ui in uiList)
+ {
+ // 鍒锋柊UI
+ if (ui.IsActive() && ui.name != excludeUIName)
+ {
+ if (ui.screenMask != null)
+ {
+ exist = true;
+ break;
+ }
+ }
+ }
+ }
+
+ return exist;
+ }
+
+ //鍦ㄦ鐣岄潰涓婃湁娌′换浣曞叏灞忔垨閬僵绐楀彛
+ public bool ExistAnyFullScreenOrMaskWinAbove(string uiName)
+ {
+ var ui = GetUI(uiName);
+ if (ui == null || !ui.IsActive())
+ {
+ // 濡傛灉UI涓嶅瓨鍦ㄦ垨鏈墦寮�锛岄粯璁や负鏈夎鎸′綇
+ return true;
+ }
+
+ foreach (var uiBase in uiStack)
+ {
+ if (uiBase == null)
+ {
+ continue;
+ }
+ if (uiBase.name == uiName)
+ {
+ break;
+ }
+ if (uiBase.IsActive() && uiBase.screenMask != null)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
// 鑾峰彇鎸囧畾绫诲瀷鐨勬墍鏈塙I瀹炰緥
public List<T> GetAllUI<T>() where T : UIBase
@@ -600,28 +671,16 @@
private UIBase GetLastSupportParentChildRelationUI()
{
- List<UIBase> tempList = new List<UIBase>();
- UIBase target = null;
-
- while (target == null && uiStack.Count > 0)
+ foreach (var uiBase in uiStack)
{
- UIBase uiBase = uiStack.Pop();
-
- if (uiBase != null && uiBase.supportParentChildRelation && !uiBase.isMainUI)
+ if (uiBase != null && uiBase.supportParentChildRelation)
{
- target = uiBase;
+ return uiBase;
}
-
- tempList.Add(uiBase);
}
- for (int i = tempList.Count - 1; i >= 0; i--)
- {
- uiStack.Push(tempList[i]);
- }
-
- return target;
+ return null;
}
public UIBase OpenWindow(string uiName, int functionOrder = 0)
@@ -663,8 +722,8 @@
returnValue.gameObject.SetActive(true);
- // 鑷姩璁剧疆鐖剁骇UI锛堝鏋滄湭鎸囧畾涓旀敮鎸佺埗瀛愬叧绯伙級
- if (returnValue.supportParentChildRelation && uiStack.Count > 0)
+ // 鑷姩璁剧疆鐖剁骇UI, 濡傛灉鍕鹃�変簡ismainui 鍒欎笉闇�瑕佹壘鐖剁骇UI
+ if (returnValue.supportParentChildRelation && uiStack.Count > 0 && !returnValue.isMainUI)
{
// 鑾峰彇鏍堥《UI
parentUI = GetLastSupportParentChildRelationUI();
@@ -813,6 +872,10 @@
{
tempStack.Push(tempUI);
}
+ else
+ {
+ break;
+ }
}
// 灏嗕复鏃舵爤涓殑UI閲嶆柊鍘嬪叆鏍堜腑
@@ -897,19 +960,6 @@
}
}
- public void ReturnMainUI()
- {
- List<UIBase> allUI = new List<UIBase>(uiStack);
-
- for (int i = 0; i < allUI.Count; i++)
- {
- UIBase uiBase = allUI[i];
- if (!uiBase.isMainUI && uiBase.uiLayer < UILayer.System)
- {
- CloseWindow(uiBase);
- }
- }
- }
/// <summary>
/// 鍏抽棴鎵�鏈塙I
--
Gitblit v1.8.0