From 8c46bc3e9de02cd5aa8d399bbc3e852fe0bfaefc Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期六, 21 三月 2026 01:30:37 +0800
Subject: [PATCH] 0312 模型初始化加载优化
---
Main/Component/UI/Common/PopupWindowsProcessor.cs | 68 ++++++++++++++++++++++++++++------
1 files changed, 56 insertions(+), 12 deletions(-)
diff --git a/Main/Component/UI/Common/PopupWindowsProcessor.cs b/Main/Component/UI/Common/PopupWindowsProcessor.cs
index dd730d9..c63eaea 100644
--- a/Main/Component/UI/Common/PopupWindowsProcessor.cs
+++ b/Main/Component/UI/Common/PopupWindowsProcessor.cs
@@ -27,12 +27,13 @@
/// </summary>
/// <param name="name">绐楀彛鍚嶇О</param>
/// <param name="functionId">鍔熻兘ID锛岀敤浜庢寚瀹氱獥鍙g殑鍏蜂綋鍔熻兘鎴栨樉绀烘ā寮�</param>
- public void Add(string name, bool isNeedHomeWin = true, int functionId = 0)
+ public void Add(string name, bool isNeedHomeWin = true, string battleFieldName = "", int functionId = 0)
{
var popupWindow = new PopupWindow()
{
window = name,
isNeedHomeWin = isNeedHomeWin,
+ battleFieldName = battleFieldName,
functionId = functionId,
};
@@ -42,7 +43,36 @@
}
popupWindowQueue.Add(popupWindow);
- popupWindowQueue.Sort((x, y) => y.isNeedHomeWin.CompareTo(x.isNeedHomeWin));
+ popupWindowQueue.Sort((x, y) =>
+ {
+ // 1. 棣栧厛鎸� isNeedHomeWin 鎺掑簭 (true 鎺掑湪鍓嶉潰)
+ int homeWinCompare = y.isNeedHomeWin.CompareTo(x.isNeedHomeWin);
+ if (homeWinCompare != 0)
+ return homeWinCompare;
+
+ // 2. 鑾峰彇鍚勮嚜鐨� WinOrder (閫氳繃 WinName 鏌ユ壘閰嶇疆琛�)
+ int xOrder = GetWinOrder(x.window);
+ int yOrder = GetWinOrder(y.window);
+ int orderCompare = xOrder.CompareTo(yOrder);
+ if (orderCompare != 0)
+ return orderCompare;
+
+ // 3. WinOrder 鐩稿悓鏃讹紝鎸� ID 鎺掑簭 (ID 灏忕殑鎺掑墠闈�)
+ return x.functionId.CompareTo(y.functionId);
+ });
+ }
+
+ private int GetWinOrder(string winName)
+ {
+ var allConfigs = PopWinOrderConfig.GetValues();
+ foreach (var config in allConfigs)
+ {
+ if (config.WinName == winName)
+ {
+ return config.WinOrder;
+ }
+ }
+ return int.MinValue;
}
/// <summary>
@@ -100,9 +130,6 @@
if (UIManager.Instance.IsOpened<LoadingWin>())
return;
- if (!UIManager.Instance.IsOpened<HomeWin>() && popupWindowQueue[0].isNeedHomeWin)
- return;
-
// 杩涘叆娓告垙绗竴娆℃帹閫佸仛寤惰繜澶勭悊
if (!homeWinFirstOpened)
{
@@ -114,19 +141,35 @@
// 绛夊緟x绉�
if (Time.realtimeSinceStartup - firstTime < stayTime)
return;
-
- // 鍙湪鈥滄病鏈夋垬鏂椻�濆拰鈥滀富绾挎垬鏂椻�濇椂鍏佽寮圭獥
+
+ // 鍙湪鈥滄病鏈夋垬鏂椻�濆拰鈥滀富绾挎垬鏂椻�濆拰鈥滆嚜宸辩殑鎴樺満鈥濇椂鍏佽寮圭獥
string activeBattleName = BattleManager.Instance.GetActiveBattleName();
- if (activeBattleName != "" && activeBattleName != "StoryBattleField")
+ // 鏌ユ壘闃熷垪涓涓�涓彲浠ュ脊鍑虹殑寮圭獥
+ PopupWindow targetPopup = null;
+ int targetIndex = -1;
+ for (int i = 0; i < popupWindowQueue.Count; i++)
+ {
+ var popup = popupWindowQueue[i];
+ if (activeBattleName == "" || activeBattleName == "StoryBattleField" || activeBattleName == popup.battleFieldName)
+ {
+ if (popup.isNeedHomeWin && !UIManager.Instance.IsOpened<HomeWin>())
+ continue;
+ targetPopup = popup;
+ targetIndex = i;
+ break;
+ }
+ }
+
+ if (targetPopup == null)
return;
- if (UIManager.Instance.IsOpened(popupWindowQueue[0].window))
+ if (UIManager.Instance.IsOpened(targetPopup.window))
{
//褰撳墠妯″紡鍙互鎵撳紑澶氫釜鐩稿悓绐楀彛锛屽鍔犻槻鑼�
return;
}
- if (UIManager.Instance.ExistAnyFullScreenOrMaskWin(popupWindowQueue[0].window))
+ if (UIManager.Instance.ExistAnyFullScreenOrMaskWin(targetPopup.window))
return;
if (currentWindow != null && currentWindow.window != null)
@@ -137,8 +180,8 @@
return;
}
- currentWindow = popupWindowQueue[0];
- popupWindowQueue.RemoveAt(0);
+ currentWindow = targetPopup;
+ popupWindowQueue.RemoveAt(targetIndex);
UIManager.Instance.OpenWindow(currentWindow.window, currentWindow.functionId);
Debug.LogFormat("鎺ㄩ�佺獥鍙� " + currentWindow.window);
@@ -158,6 +201,7 @@
public int functionId;
public bool isNeedHomeWin;
+ public string battleFieldName;
}
}
\ No newline at end of file
--
Gitblit v1.8.0