From a19acb609721b89419fe55785643a0d4f1959368 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 14 十一月 2025 20:03:47 +0800
Subject: [PATCH] 0312 动态检测战力公式
---
Main/Component/UI/Common/PopupWindowsProcessor.cs | 110 ++++++++++++++++++++++++++++---------------------------
1 files changed, 56 insertions(+), 54 deletions(-)
diff --git a/Main/Component/UI/Common/PopupWindowsProcessor.cs b/Main/Component/UI/Common/PopupWindowsProcessor.cs
index 32e8c29..dd730d9 100644
--- a/Main/Component/UI/Common/PopupWindowsProcessor.cs
+++ b/Main/Component/UI/Common/PopupWindowsProcessor.cs
@@ -1,32 +1,38 @@
-using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 寮圭獥澶勭悊鍣� - 璐熻矗绠$悊娓告垙涓殑寮圭獥闃熷垪锛屾寜椤哄簭鏄剧ず寮圭獥绐楀彛
/// 閬垮厤澶氫釜绐楀彛鍚屾椂寮瑰嚭閫犳垚鐣岄潰娣蜂贡
+/// 鍙湁鍦╤omewin鎵撳紑鐨勬儏鍐典笅鎵嶈Е鍙�
/// </summary>
public class PopupWindowsProcessor : SingletonMonobehaviour<PopupWindowsProcessor>
{
// 寮圭獥闃熷垪锛屽瓨鍌ㄥ緟澶勭悊鐨勫脊绐楄姹�
List<PopupWindow> popupWindowQueue = new List<PopupWindow>();
-
+
// 褰撳墠姝e湪鏄剧ず鐨勫脊绐�
PopupWindow currentWindow;
+ float firstTime = 0; //鎵撳紑HomeWin鏃剁殑鏃堕棿
+ float stayTime;
+ bool homeWinFirstOpened = false; //HomeWin鏄惁绗竴娆℃墦寮�
+
+
// 涓婃寮圭獥鏃堕棿锛岀敤浜庢帶鍒跺脊绐椾箣闂寸殑闂撮殧
float lastTime = 0; //涓婃寮圭獥鏃堕棿
-
+
/// <summary>
/// 娣诲姞涓�涓脊绐楀埌澶勭悊闃熷垪
/// </summary>
/// <param name="name">绐楀彛鍚嶇О</param>
/// <param name="functionId">鍔熻兘ID锛岀敤浜庢寚瀹氱獥鍙g殑鍏蜂綋鍔熻兘鎴栨樉绀烘ā寮�</param>
- public void Add(string name, int functionId = 0)
+ public void Add(string name, bool isNeedHomeWin = true, int functionId = 0)
{
var popupWindow = new PopupWindow()
{
window = name,
+ isNeedHomeWin = isNeedHomeWin,
functionId = functionId,
};
@@ -36,6 +42,7 @@
}
popupWindowQueue.Add(popupWindow);
+ popupWindowQueue.Sort((x, y) => y.isNeedHomeWin.CompareTo(x.isNeedHomeWin));
}
/// <summary>
@@ -43,11 +50,12 @@
/// </summary>
/// <param name="name">绐楀彛鍚嶇О</param>
/// <param name="functionId">鍔熻兘ID</param>
- public void Remove(string name, int functionId = 0)
+ public void Remove(string name, bool isNeedHomeWin = true, int functionId = 0)
{
var popupWindow = new PopupWindow()
{
window = name,
+ isNeedHomeWin = isNeedHomeWin,
functionId = functionId,
};
@@ -56,6 +64,7 @@
popupWindowQueue.Remove(popupWindow);
}
}
+
/// <summary>
/// LateUpdate涓鐞嗗脊绐楅槦鍒楋紝纭繚鍦ㄦ墍鏈夊叾浠栭�昏緫澶勭悊瀹屾瘯鍚庢墠鏄剧ず寮圭獥
@@ -77,11 +86,10 @@
}
// 妫�鏌ユ槸鍚﹀湪鏂版墜寮曞涓�
- // 娉ㄦ剰锛歂ewBieCenter鍦ㄥ綋鍓嶄唬鐮佸簱涓笉瀛樺湪锛屾殏鏃舵敞閲婃帀鐩稿叧妫�鏌�
- // if (NewBieCenter.Instance.inGuiding)
- // {
- // return;
- // }
+ if (NewBieCenter.Instance.inGuiding)
+ {
+ return;
+ }
if (popupWindowQueue.Count == 0)
{
@@ -92,30 +100,48 @@
if (UIManager.Instance.IsOpened<LoadingWin>())
return;
- // 妫�鏌ユ槸鍚﹀瓨鍦ㄥ叏灞忔垨閬僵绐楀彛
- // 娉ㄦ剰锛欵xistAnyFullScreenOrMaskWin鏂规硶鍦ㄥ綋鍓峌IManager涓笉瀛樺湪锛屾殏鏃舵敞閲婃帀鐩稿叧妫�鏌�
- // if (UIManager.Instance.ExistAnyFullScreenOrMaskWin())
- // return;
+ if (!UIManager.Instance.IsOpened<HomeWin>() && popupWindowQueue[0].isNeedHomeWin)
+ return;
- if (currentWindow.window != null)
+ // 杩涘叆娓告垙绗竴娆℃帹閫佸仛寤惰繜澶勭悊
+ if (!homeWinFirstOpened)
+ {
+ firstTime = Time.realtimeSinceStartup;
+ homeWinFirstOpened = true;
+ stayTime = float.Parse(FuncConfigConfig.Get("PopWin").Numerical1);
+ return;
+ }
+ // 绛夊緟x绉�
+ if (Time.realtimeSinceStartup - firstTime < stayTime)
+ return;
+
+ // 鍙湪鈥滄病鏈夋垬鏂椻�濆拰鈥滀富绾挎垬鏂椻�濇椂鍏佽寮圭獥
+ string activeBattleName = BattleManager.Instance.GetActiveBattleName();
+ if (activeBattleName != "" && activeBattleName != "StoryBattleField")
+ return;
+
+ if (UIManager.Instance.IsOpened(popupWindowQueue[0].window))
+ {
+ //褰撳墠妯″紡鍙互鎵撳紑澶氫釜鐩稿悓绐楀彛锛屽鍔犻槻鑼�
+ return;
+ }
+
+ if (UIManager.Instance.ExistAnyFullScreenOrMaskWin(popupWindowQueue[0].window))
+ return;
+
+ if (currentWindow != null && currentWindow.window != null)
{
//鍒ゆ柇涓婁竴涓帹閫佹槸鍚﹀叧闂�
UIBase ui = UIManager.Instance.GetUI(currentWindow.window);
if (ui != null && ui.IsActive())
return;
+ }
- currentWindow = popupWindowQueue[0];
- popupWindowQueue.RemoveAt(0);
- UIManager.Instance.OpenWindow(currentWindow.window, currentWindow.functionId);
- Debug.LogFormat("鎺ㄩ�佺獥鍙� " + currentWindow.window);
- }
- else
- {
- currentWindow = popupWindowQueue[0];
- popupWindowQueue.RemoveAt(0);
- UIManager.Instance.OpenWindow(currentWindow.window, currentWindow.functionId);
- Debug.LogFormat("鎺ㄩ�佺獥鍙� " + currentWindow.window);
- }
+ currentWindow = popupWindowQueue[0];
+ popupWindowQueue.RemoveAt(0);
+ UIManager.Instance.OpenWindow(currentWindow.window, currentWindow.functionId);
+ Debug.LogFormat("鎺ㄩ�佺獥鍙� " + currentWindow.window);
+
lastTime = Time.realtimeSinceStartup;
}
@@ -123,39 +149,15 @@
/// 寮圭獥缁撴瀯浣擄紝鐢ㄤ簬琛ㄧず涓�涓緟澶勭悊鐨勫脊绐楄姹�
/// 鍖呭惈绐楀彛鍚嶇О鍜屽姛鑳絀D锛岄�氳繃杩欎袱涓瓧娈靛彲浠ュ敮涓�鏍囪瘑涓�涓脊绐楄姹�
/// </summary>
- public struct PopupWindow
+ public class PopupWindow
{
// 绐楀彛鍚嶇О
public string window;
-
+
// 鍔熻兘ID锛岀敤浜庢寚瀹氱獥鍙g殑鍏蜂綋鍔熻兘鎴栨樉绀烘ā寮�
public int functionId;
- public static bool operator ==(PopupWindow lhs, PopupWindow rhs)
- {
- return lhs.window == rhs.window && lhs.functionId == rhs.functionId;
- }
-
- public static bool operator !=(PopupWindow lhs, PopupWindow rhs)
- {
- return lhs.window != rhs.window || lhs.functionId != rhs.functionId;
- }
-
- // 娣诲姞GetHashCode鍜孍quals鏂规硶浠ョ‘淇濈粨鏋勪綋鍙互姝g‘姣旇緝
- public override bool Equals(object obj)
- {
- if (obj is PopupWindow)
- {
- PopupWindow other = (PopupWindow)obj;
- return this.window == other.window && this.functionId == other.functionId;
- }
- return false;
- }
-
- public override int GetHashCode()
- {
- return window.GetHashCode() ^ functionId.GetHashCode();
- }
+ public bool isNeedHomeWin;
}
}
\ No newline at end of file
--
Gitblit v1.8.0