From e6269ae16fea2462c32705ce0fbe7e4f3bf364a4 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期三, 24 十二月 2025 18:51:46 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts

---
 Main/System/Battle/BaseBattleWin.cs |  176 ++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 110 insertions(+), 66 deletions(-)

diff --git a/Main/System/Battle/BaseBattleWin.cs b/Main/System/Battle/BaseBattleWin.cs
index 8d514ed..a71b94e 100644
--- a/Main/System/Battle/BaseBattleWin.cs
+++ b/Main/System/Battle/BaseBattleWin.cs
@@ -1,4 +1,5 @@
-锘縰sing UnityEngine;
+锘縰sing System.Collections.Generic;
+using UnityEngine;
 using UnityEngine.UI;
 
 /// <summary>
@@ -185,8 +186,6 @@
         battleField.OnRoundChange += OnRoundChange;
         OnRoundChange(battleField.round, battleField.turnMax); // 绔嬪嵆鎵ц涓�娆′互鏄剧ず鍒濆鍥炲悎
     }
-
-
     /// <summary>
     /// 璺宠繃鎴樻枟
     /// </summary>
@@ -201,87 +200,132 @@
     {
         if (null == battleField)
             return true;
-        // 妫�鏌ユ槸鍚︿负姘镐箙鐗规潈鍗$帺瀹�
+
         bool hasForeverPrivilege = InvestModel.Instance.IsInvested(InvestModel.foreverCardType);
-
         string battleFieldName = battleField.ToString();
-        if (!hasForeverPrivilege && !FuncOpen.Instance.IsFuncOpen(BattleManager.Instance.passFuncId))
-        {
-            if (battleFieldName != BattleConst.StoryBossBattleField)
-            {
-                //绛夌骇杈惧埌20绾у悗瑙i攣鎴栧紑閫氱粓韬壒鏉冭В閿�
-                SysNotifyMgr.Instance.ShowTip("BattlePass2");
-            }
-            else
-            {
-                FuncOpen.Instance.ProcessorFuncErrorTip(BattleManager.Instance.passFuncId);
-            }
+
+        // 妫�鏌ュ姛鑳藉紑鍚姸鎬�
+        if (!IsPassOpen(hasForeverPrivilege, battleFieldName))
             return false;
-        }
 
-        int passRound = BattleManager.Instance.defaultPassRound;
-        var name = battleField.ToString();
-
-
-        if (hasForeverPrivilege)
+        // 鑾峰彇閰嶇疆鐨勫洖鍚堥檺鍒�
+        int configRoundLimit = GetRequiredPassRound(hasForeverPrivilege, battleFieldName);
+        int nowRound = battleField.round > 0 ? battleField.round : 1;
+        if (nowRound >= configRoundLimit + 1)
         {
-            // 姘镐箙鐗规潈鍗$帺瀹堕�昏緫
-            if (BattleConst.FieldNameToIndex.ContainsKey(name))
+            return true;
+        }
+        ShowSkipWaitTip(configRoundLimit, battleFieldName, hasForeverPrivilege);
+        return false;
+    }
+
+    private bool IsPassOpen(bool hasForeverPrivilege, string battleFieldName)
+    {
+        // 鎷ユ湁姘镐箙鐗规潈鍗★紝鏃犺鍔熻兘寮�鍚檺鍒�
+        if (hasForeverPrivilege)
+            return true;
+
+        int passFuncId = BattleManager.Instance.passFuncId;
+        // 妫�鏌ュ姛鑳絀D鏄惁寮�鍚�
+        if (FuncOpen.Instance.IsFuncOpen(passFuncId))
+            return true;
+
+        if (!FuncOpenLVConfig.HasKey(passFuncId))
+            return true;
+        int lv = FuncOpenLVConfig.Get(passFuncId).LimitLV;
+        SysNotifyMgr.Instance.ShowTip("BattlePass2", lv);
+        return false;
+    }
+
+    private int GetRequiredPassRound(bool hasForeverPrivilege, string battleFieldName)
+    {
+        // 鍒濆鍖栭粯璁ゅ��
+        int resultRound = BattleManager.Instance.defaultPassRound;
+
+        // 灏濊瘯鑾峰彇鏅�氶厤缃紙瑕嗙洊榛樿鍊硷級
+        if (BattleConst.FieldNameToIndex.TryGetValue(battleFieldName, out int index))
+        {
+            if (BattleManager.Instance.passDict.TryGetValue(index, out int normalRound))
             {
-                int index = BattleConst.FieldNameToIndex[name];
-                if (BattleManager.Instance.foreverPrivilegePassDict.ContainsKey(index))
-                {
-                    passRound = BattleManager.Instance.foreverPrivilegePassDict[index];
-                }
-                else
-                {
-                    // 鏈厤缃殑鎴樺満绫诲瀷锛屼娇鐢ㄦ櫘閫氱帺瀹惰鍒�
-                    if (BattleManager.Instance.passDict.ContainsKey(index))
-                    {
-                        passRound = BattleManager.Instance.passDict[index];
-                    }
-                    // 鍚﹀垯浣跨敤榛樿閰嶇疆
-                }
+                resultRound = normalRound;
             }
-            // 濡傛灉鎴樺満绫诲瀷涓嶅湪 FieldNameToIndex 涓紝浣跨敤榛樿閰嶇疆
         }
         else
         {
-            // 鏅�氱帺瀹堕�昏緫
-            if (BattleConst.FieldNameToIndex.ContainsKey(name))
-            {
-                int index = BattleConst.FieldNameToIndex[name];
-                if (BattleManager.Instance.passDict.ContainsKey(index))
-                {
-                    passRound = BattleManager.Instance.passDict[index];
-                }
-                // 鍚﹀垯浣跨敤榛樿閰嶇疆
-            }
-            // 濡傛灉鎴樺満绫诲瀷涓嶅湪 FieldNameToIndex 涓紝浣跨敤榛樿閰嶇疆
+            // 濡傛灉杩炵储寮曢兘鎵句笉鍒帮紝鐩存帴杩斿洖榛樿鍊硷紝鏃犻渶鍚庣画鍒ゆ柇
+            return resultRound;
         }
 
-        if (passRound != 0)
+        // 濡傛灉娌℃湁鐗规潈锛岀洿鎺ヨ繑鍥炴櫘閫氶厤缃�
+        if (!hasForeverPrivilege)
+            return resultRound;
+
+        // 鍒ゆ柇鐗规潈鏄惁鐢熸晥
+        bool isPrivilegeEffective = true;
+
+        // 鐗规畩瑙勫垯锛氫富绾緽OSS闇�瑕佽揪鍒版寚瀹氱珷鑺傦紝鐗规潈鎵嶇敓鏁�
+        if (battleFieldName == BattleConst.StoryBossBattleField)
         {
-            int nowRound = battleField.round;
-            int realPassRound = passRound + 1;  // 閰嶇疆鏄秴杩噚鍥炲悎鍙互璺�,鎰忓懗鐫�x+1鍥炲悎鍙互璺�
-            if (nowRound < realPassRound)
+            if (IsStoryBossChapterLimited())
             {
-                if (battleFieldName != BattleConst.StoryBossBattleField)
-                {
-                    //%s0鍥炲悎鍚庡彲璺宠繃锛屽紑閫氱粓韬壒鏉冪珛鍗宠烦杩�
-                    SysNotifyMgr.Instance.ShowTip("BattlePass1", realPassRound - nowRound);
-                }
-                else
-                {
-                    SysNotifyMgr.Instance.ShowTip("BattlePass", realPassRound - nowRound);
-                }
-
-                return false;
+                isPrivilegeEffective = false;
             }
         }
-        return true;
+
+        if (isPrivilegeEffective)
+        {
+            var vipDict = BattleManager.Instance.foreverPrivilegePassDict;
+            // 鍙湁褰撶壒鏉冭〃閲屾樉寮忛厤缃簡璇ユ垬鍦猴紝鎵嶈繘琛岃鐩�
+            if (vipDict.TryGetValue(index, out int vipRound))
+            {
+                resultRound = vipRound;
+            }
+        }
+
+        return resultRound;
     }
 
+    private void ShowSkipWaitTip(int configRoundLimit, string battleFieldName, bool hasForeverPrivilege)
+    {
+        int waitRound = Mathf.Max(configRoundLimit - battleField.round + 1, 0);
+
+        // 涓荤嚎BOSS鎴樺満鐗规畩鎻愮ず
+        if (battleFieldName == BattleConst.StoryBossBattleField)
+        {
+            if (!hasForeverPrivilege || IsStoryBossChapterLimited())
+            {
+                SysNotifyMgr.Instance.ShowTip("BattlePass3", waitRound, BattleManager.Instance.passChapterID);
+            }
+            else
+            {
+                SysNotifyMgr.Instance.ShowTip("BattlePass", waitRound);
+            }
+        }
+        // 鍏朵粬鎴樺満鎻愮ず
+        else
+        {
+            if (hasForeverPrivilege)
+            {
+                SysNotifyMgr.Instance.ShowTip("BattlePass", waitRound);
+            }
+            else
+            {
+                SysNotifyMgr.Instance.ShowTip("BattlePass1", waitRound);
+            }
+
+        }
+    }
+
+    /// <summary>
+    /// 妫�鏌ヤ富绾緽OSS鏄惁鍙楀埌绔犺妭闄愬埗
+    /// </summary>
+    private bool IsStoryBossChapterLimited()
+    {
+        long currentProgress = PlayerDatas.Instance.baseData.ExAttr2;
+        int nowChapterID = (int)(currentProgress / 10000);
+
+        return nowChapterID <= BattleManager.Instance.passChapterID;
+    }
 
     /// <summary>
     /// 鏀瑰彉閫熷害

--
Gitblit v1.8.0