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 | 111 +++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 78 insertions(+), 33 deletions(-)
diff --git a/Main/Manager/UIManager.cs b/Main/Manager/UIManager.cs
index d650c52..eed236b 100644
--- a/Main/Manager/UIManager.cs
+++ b/Main/Manager/UIManager.cs
@@ -177,7 +177,7 @@
}
// 鑾峰彇灞傜骇瀵瑰簲鐨凾ransform
- private Transform GetTransForLayer(UILayer layer)
+ public Transform GetTransForLayer(UILayer layer)
{
// 灏濊瘯浠庣紦瀛樹腑鑾峰彇Transform
if (layerTransformCache.TryGetValue(layer, out Transform trans))
@@ -313,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
@@ -591,7 +657,7 @@
// 璁剧疆UI鐨勬帓搴忛『搴�
ui.SetSortingOrder(sortingOrder);
// 鏇存柊褰撳墠鏈�楂樻帓搴忛『搴�
- currentHighestSortingOrder += ui.uiLayer == UILayer.Static ? 55/*杩欓噷鏄鑹�+鐗规晥涔嬩笂鐨勫眰绾�*/ : 10;
+ currentHighestSortingOrder += ui.uiLayer == UILayer.Static ? 155/*杩欓噷鏄鑹�+鐗规晥涔嬩笂鐨勫眰绾�*/ : 10;
// Debug.Log(ui.uiName + " order is " + sortingOrder + " " + currentHighestSortingOrder);
}
@@ -605,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)
@@ -668,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();
@@ -818,6 +872,10 @@
{
tempStack.Push(tempUI);
}
+ else
+ {
+ break;
+ }
}
// 灏嗕复鏃舵爤涓殑UI閲嶆柊鍘嬪叆鏍堜腑
@@ -902,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