From 4779ce18e856a5e9156de41c2c7f610f7ddb2755 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 21 十月 2025 17:59:02 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts

---
 Main/System/HeroUI/HeroGiftEatWin.cs               |    2 
 Main/System/HeroUI/HeroUIManager.OnTeam.cs         |   78 ++++++++++++------
 Main/System/Arena/ArenaBattleVictoryWin.cs         |    5 +
 Main/System/Battle/BattleField/ArenaBattleField.cs |    8 +
 Main/System/Arena/ArenaBattleFailWin.cs            |    4 +
 Main/System/HeroUI/HeroUIManager.Reborn.cs         |    2 
 Main/System/Battle/BattleField/BattleField.cs      |    2 
 Main/System/HeroUI/HeroLVBreakWin.cs               |    2 
 Main/System/Main/PlayerMainDate.cs                 |    2 
 Main/System/Hero/HeroInfo.Properties.cs            |    2 
 Main/System/HeroUI/HeroPosWin.cs                   |   27 ++++++
 Main/System/Hero/HeroManager.cs                    |    4 
 Main/System/NewBieGuidance/NewBieCenter.cs         |   41 ++++++++-
 Main/System/Team/TeamBase.cs                       |    1 
 Main/System/HeroUI/HeroTrainWin.cs                 |    6 
 Main/System/HeroUI/HeroUIManager.cs                |    4 +
 16 files changed, 141 insertions(+), 49 deletions(-)

diff --git a/Main/System/Arena/ArenaBattleFailWin.cs b/Main/System/Arena/ArenaBattleFailWin.cs
index 4f5dcfc..1018955 100644
--- a/Main/System/Arena/ArenaBattleFailWin.cs
+++ b/Main/System/Arena/ArenaBattleFailWin.cs
@@ -12,6 +12,7 @@
     [SerializeField] TextEx txtEnemyName;
     [SerializeField] TextEx txtMyScore;
     [SerializeField] TextEx txtEnemyScore;
+     [SerializeField] TextEx txtFuncName;
     [SerializeField] ScrollerController scroller;
     JsonData jsonData;
     string guid;
@@ -67,6 +68,9 @@
         txtEnemyName.text = UIHelper.ServerStringTrim(info.PlayerName);
         txtMyScore.text = Language.Get("Arena17", atkAddScore);
         txtEnemyScore.text = Language.Get("Arena21", defDecScore);
+
+        int funcId = ArenaManager.Instance.funcId;
+        txtFuncName.text = FuncOpenLVConfig.HasKey(funcId) ? FuncOpenLVConfig.Get(funcId).Name : string.Empty;
     }
     List<Item> showItems = new List<Item>();
     void CreateScroller()
diff --git a/Main/System/Arena/ArenaBattleVictoryWin.cs b/Main/System/Arena/ArenaBattleVictoryWin.cs
index 1cf0f76..d16965a 100644
--- a/Main/System/Arena/ArenaBattleVictoryWin.cs
+++ b/Main/System/Arena/ArenaBattleVictoryWin.cs
@@ -76,7 +76,7 @@
     [SerializeField] TextEx txtEnemyName;
     [SerializeField] TextEx txtMyScore;
     [SerializeField] TextEx txtEnemyScore;
-
+    [SerializeField] TextEx txtFuncName;
     [SerializeField] ScrollerController scroller;
     JsonData jsonData;
     string guid;
@@ -126,6 +126,9 @@
         txtEnemyName.text = UIHelper.ServerStringTrim(info.PlayerName);
         txtMyScore.text = Language.Get("Arena17", atkAddScore);
         txtEnemyScore.text = Language.Get("Arena21", defDecScore);
+
+        int funcId = ArenaManager.Instance.funcId;
+        txtFuncName.text = FuncOpenLVConfig.HasKey(funcId) ? FuncOpenLVConfig.Get(funcId).Name : string.Empty;
     }
 
     List<Item> showItems = new List<Item>();
diff --git a/Main/System/Battle/BattleField/ArenaBattleField.cs b/Main/System/Battle/BattleField/ArenaBattleField.cs
index c4556b8..1d92dae 100644
--- a/Main/System/Battle/BattleField/ArenaBattleField.cs
+++ b/Main/System/Battle/BattleField/ArenaBattleField.cs
@@ -87,10 +87,14 @@
 
     public override void WhaleFall()
     {
-        UIManager.Instance.CloseWindow<ArenaBattleWin>();
         AutoFightModel.Instance.isPause = false;
         Destroy();
-        UIManager.Instance.OpenWindow<ArenaWin>();
+        // 鍒囧嚭鎴樻枟鐣岄潰涓嶅脊婕旀鍦虹晫闈� 
+        if (UIManager.Instance.IsOpened<ArenaBattleWin>())
+        {
+            UIManager.Instance.CloseWindow<ArenaBattleWin>();
+            UIManager.Instance.OpenWindow<ArenaWin>();
+        }
     }
 
 
diff --git a/Main/System/Battle/BattleField/BattleField.cs b/Main/System/Battle/BattleField/BattleField.cs
index c89cd53..01f1573 100644
--- a/Main/System/Battle/BattleField/BattleField.cs
+++ b/Main/System/Battle/BattleField/BattleField.cs
@@ -562,7 +562,7 @@
     //鏆傚仠鐨勫師鍥犳湁寰堝锛岄渶瑕佹鏌ュ悇绉嶇姸鎬�
     bool CanResumeGame()
     {
-        if (UIManager.Instance.IsOpened<NewBieWin>())
+        if (NewBieCenter.Instance.IsPauseStoryBattleState())
         {
             return false;
         }
diff --git a/Main/System/Hero/HeroInfo.Properties.cs b/Main/System/Hero/HeroInfo.Properties.cs
index 3e160b0..7014c79 100644
--- a/Main/System/Hero/HeroInfo.Properties.cs
+++ b/Main/System/Hero/HeroInfo.Properties.cs
@@ -107,7 +107,7 @@
 
 
     long tmpFightPower = 0;
-    public long CalculatePower(bool forceRefresh = true)
+    public long CalculateFightPower(bool forceRefresh = true)
     {
         if (forceRefresh || tmpFightPower == 0)
         { 
diff --git a/Main/System/Hero/HeroManager.cs b/Main/System/Hero/HeroManager.cs
index 28036d5..49ef7bd 100644
--- a/Main/System/Hero/HeroManager.cs
+++ b/Main/System/Hero/HeroManager.cs
@@ -116,8 +116,8 @@
 
         heroList.Sort((a, b) =>
         {
-            long power1 = a.CalculatePower(false);
-            long power2 = b.CalculatePower(false);
+            long power1 = a.CalculateFightPower(false);
+            long power2 = b.CalculateFightPower(false);
 
             if (power1 == power2)
             {
diff --git a/Main/System/HeroUI/HeroGiftEatWin.cs b/Main/System/HeroUI/HeroGiftEatWin.cs
index df50c3a..70ffe29 100644
--- a/Main/System/HeroUI/HeroGiftEatWin.cs
+++ b/Main/System/HeroUI/HeroGiftEatWin.cs
@@ -128,7 +128,7 @@
         HeroUIManager.Instance.selectHeroGuidForGiftFuncForSuccessWin = HeroUIManager.Instance.selectHeroGuidForGiftFunc;
         HeroUIManager.Instance.heroBeforeGiftIDList = new List<int>(hero.talentIDList);
         HeroUIManager.Instance.heroBeforeGiftLevelList = new List<int>(hero.talentLvList);
-        HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculatePower(false));
+        HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculateFightPower(false));
 
         //璁剧疆涓瓑寰呭洖澶嶇殑鏍囪瘑 鏄剧ず鎴愬姛鐣岄潰
         HeroUIManager.Instance.waitResponse = new WaitHeroFuncResponse()
diff --git a/Main/System/HeroUI/HeroLVBreakWin.cs b/Main/System/HeroUI/HeroLVBreakWin.cs
index 9677eea..fcc9d6d 100644
--- a/Main/System/HeroUI/HeroLVBreakWin.cs
+++ b/Main/System/HeroUI/HeroLVBreakWin.cs
@@ -106,7 +106,7 @@
             var pack = new CB232_tagCSHeroBreak();
             pack.ItemIndex = (ushort)hero.itemHero.gridIndex;
             GameNetSystem.Instance.SendInfo(pack);
-            HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculatePower(false));
+            HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculateFightPower(false));
             CloseWindow();
             //璁剧疆涓瓑寰呭洖澶嶇殑鏍囪瘑 鏄剧ず鎴愬姛鐣岄潰
             HeroUIManager.Instance.waitResponse = new WaitHeroFuncResponse()
diff --git a/Main/System/HeroUI/HeroPosWin.cs b/Main/System/HeroUI/HeroPosWin.cs
index 0c335d1..ab8a8f2 100644
--- a/Main/System/HeroUI/HeroPosWin.cs
+++ b/Main/System/HeroUI/HeroPosWin.cs
@@ -472,10 +472,33 @@
         var guidList = HeroUIManager.Instance.SelectRecommend();
         var team = TeamManager.Instance.GetTeam(HeroUIManager.Instance.selectTeamType);
         team.RemoveAllHeroes();
-        for (int i = 0; i < guidList.Count; i++)
+        if (NewBieCenter.Instance.inGuiding && NewBieCenter.Instance.currentGuide == HeroUIManager.Instance.onekeyGuideID)
         {
-            team.AddHero(HeroManager.Instance.GetHero(guidList[i]), i, true);
+            //绗簩涓己鍒舵帓鍦�5鍙蜂綅
+            if (guidList.Count > 1)
+            {
+                team.AddHero(HeroManager.Instance.GetHero(guidList[1]), 4, true);
+                guidList.RemoveAt(1);
+            }
+
+            for (int i = 0; i < guidList.Count; i++)
+            {
+                int index = i;
+                if (i >= 4)
+                {
+                    index = i + 1;
+                }
+                team.AddHero(HeroManager.Instance.GetHero(guidList[i]), index, true);
+            }
+
         }
+        else
+        {
+            for (int i = 0; i < guidList.Count; i++)
+            {
+                team.AddHero(HeroManager.Instance.GetHero(guidList[i]), i, true);
+            }
+        }        
 
         TeamChangeEvent(new List<int>() { 0, 1, 2, 3, 4, 5 }, -1, Vector3.zero);
 
diff --git a/Main/System/HeroUI/HeroTrainWin.cs b/Main/System/HeroUI/HeroTrainWin.cs
index c77ce4d..11d1c80 100644
--- a/Main/System/HeroUI/HeroTrainWin.cs
+++ b/Main/System/HeroUI/HeroTrainWin.cs
@@ -225,7 +225,7 @@
         jobImg.SetSprite(HeroUIManager.Instance.GetJobIconName(hero.heroConfig.Class));
         jobPosNameText.text = HeroUIManager.Instance.GetJobName(hero.heroConfig.Class);
         descText.text = hero.heroConfig.Desc;
-        fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculatePower());
+        fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculateFightPower());
         PlayerMainDate.Instance.AddPowerNotOnTeam(hero);
         lockImg.SetActive(hero.isLock);
         unLockImg.SetActive(!hero.isLock);
@@ -468,7 +468,7 @@
                     ReturnCell(cell);
                 });
 
-                HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculatePower(false));
+                HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculateFightPower(false));
             }
 
         }
@@ -712,7 +712,7 @@
     {
         if (teamType != TeamType.Story)
             return;
-        fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculatePower());
+        fightPowerText.text = UIHelper.ReplaceLargeArtNum(hero.CalculateFightPower());
     }
 
     void RefreshFreeze()
diff --git a/Main/System/HeroUI/HeroUIManager.OnTeam.cs b/Main/System/HeroUI/HeroUIManager.OnTeam.cs
index 00ec094..e3a740c 100644
--- a/Main/System/HeroUI/HeroUIManager.OnTeam.cs
+++ b/Main/System/HeroUI/HeroUIManager.OnTeam.cs
@@ -292,12 +292,8 @@
     //鎺ㄨ崘闃靛
     public List<string> SelectRecommend()
     {
-        //鎺ㄨ崘闃靛鐨勭畻娉曢�昏緫
-        //鑷姩閫夋嫨浼樺厛绾э細姝﹀皢绛夌骇锛炵獊鐮寸瓑绾э紴姝﹀皢瑙夐啋闃剁骇锛炴灏嗗搧璐紴姝﹀皢鍚炲櫖鏄熺骇锛炴灏咺D
         var tmpList = HeroManager.Instance.GetHeroGuidList();
         tmpList.Sort(CmpHeroRecommend);
-
-
         //鎺ㄨ崘鏈�澶�6涓紝瀛樺湪鐩稿悓heroid锛屽垯璺宠繃
         List<string> selectHeroList = new List<string>();
         List<int> selectHeroIDList = new List<int>();
@@ -309,6 +305,7 @@
             string guid = tmpList[i];
             HeroInfo heroInfo = HeroManager.Instance.GetHero(guid);
             if (selectHeroIDList.Contains(heroInfo.heroId))
+                //閲嶅鑻遍泟
                 continue;
             //濡傛灉閲嶅浜�,璺宠繃
             if (selectHeroList.Contains(guid))
@@ -316,10 +313,16 @@
             selectHeroList.Add(guid);
             selectHeroIDList.Add(heroInfo.heroId);
         }
+
+        // 鍐嶆寜 鑲夌浘>鎺у埗>杈撳嚭>杈呭姪
+        selectHeroList.Sort(CmpByJob);
+
         return selectHeroList;
     }
 
-
+    //锛侊紒锛佹柊鎺掑簭瑙勫垯
+    //鑻ュ湪鏂版墜寮曞锛堝紩瀵糏D锛変腑锛屽鏋�5鍙蜂綅涓虹┖锛屽垯浼樺厛鏀剧疆5鍙蜂綅
+    //鎸夋垬鍔涙帓搴� 
     int CmpHeroRecommend(string guidA, string guidB)
     {
         HeroInfo heroA = HeroManager.Instance.GetHero(guidA);
@@ -329,29 +332,46 @@
             return 0;
         }
 
-        // 鎺掑簭瑙勫垯锛氭灏嗙瓑绾э紴绐佺牬绛夌骇锛炴灏嗚閱掗樁绾э紴姝﹀皢鍝佽川锛炴灏嗗悶鍣槦绾э紴姝﹀皢ID
-        if (heroA.heroLevel != heroB.heroLevel)
-        {
-            return heroA.heroLevel > heroB.heroLevel ? -1 : 1;
-        }
-        if (heroA.breakLevel != heroB.breakLevel)
-        {
-            return heroA.breakLevel > heroB.breakLevel ? -1 : 1;
-        }
-        if (heroA.awakeLevel != heroB.awakeLevel)
-        {
-            return heroA.awakeLevel > heroB.awakeLevel ? -1 : 1;
-        }
-        if (heroA.Quality != heroB.Quality)
-        {
-            return heroA.Quality > heroB.Quality ? -1 : 1;
-        }
-        if (heroA.heroStar != heroB.heroStar)
-        {
-            return heroA.heroStar > heroB.heroStar ? -1 : 1;
-        }
+        // // 鎺掑簭瑙勫垯锛氭灏嗙瓑绾э紴绐佺牬绛夌骇锛炴灏嗚閱掗樁绾э紴姝﹀皢鍝佽川锛炴灏嗗悶鍣槦绾э紴姝﹀皢ID
+        // if (heroA.heroLevel != heroB.heroLevel)
+        // {
+        //     return heroA.heroLevel > heroB.heroLevel ? -1 : 1;
+        // }
+        // if (heroA.breakLevel != heroB.breakLevel)
+        // {
+        //     return heroA.breakLevel > heroB.breakLevel ? -1 : 1;
+        // }
+        // if (heroA.awakeLevel != heroB.awakeLevel)
+        // {
+        //     return heroA.awakeLevel > heroB.awakeLevel ? -1 : 1;
+        // }
+        // if (heroA.Quality != heroB.Quality)
+        // {
+        //     return heroA.Quality > heroB.Quality ? -1 : 1;
+        // }
+        // if (heroA.heroStar != heroB.heroStar)
+        // {
+        //     return heroA.heroStar > heroB.heroStar ? -1 : 1;
+        // }
 
-        return heroA.heroId.CompareTo(heroB.heroId);
+
+
+        return heroB.CalculateFightPower(false).CompareTo(heroA.CalculateFightPower(false));
+    }
+
+    int CmpByJob(string guidA, string guidB)
+    {
+        HeroInfo heroA = HeroManager.Instance.GetHero(guidA);
+        HeroInfo heroB = HeroManager.Instance.GetHero(guidB);
+        if (heroA == null || heroB == null)
+        {
+            return 0;
+        }
+        
+        int indexA = Array.IndexOf(teamSortByJob, heroA.heroConfig.Class);
+        int indexB = Array.IndexOf(teamSortByJob, heroB.heroConfig.Class);
+
+        return indexA.CompareTo(indexB);
     }
 
 
@@ -362,6 +382,10 @@
     public int[][] lockHeroCountLimit;
     public List<int> lockIndexList = new List<int>();
 
+    public int[] teamSortByJob;
+    public int onekeyGuideID;
+    public int onekeyGuideFirstPos; //涓�閿笂闃靛湪寮曞涓嬬殑鏈�浼樺厛鎺ㄨ崘浣嶇疆
+
     public Action OnUnLockHeroCountEvent;
     public int lockState
     {
diff --git a/Main/System/HeroUI/HeroUIManager.Reborn.cs b/Main/System/HeroUI/HeroUIManager.Reborn.cs
index 18aee2a..8ef21bb 100644
--- a/Main/System/HeroUI/HeroUIManager.Reborn.cs
+++ b/Main/System/HeroUI/HeroUIManager.Reborn.cs
@@ -265,7 +265,7 @@
         pack.ItemIndex = (ushort)hero.itemHero.gridIndex;
         GameNetSystem.Instance.SendInfo(pack);
 
-        lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculatePower(false));
+        lastFightPower = new KeyValuePair<string, long>(hero.itemHero.guid, hero.CalculateFightPower(false));
 
     }
 }
diff --git a/Main/System/HeroUI/HeroUIManager.cs b/Main/System/HeroUI/HeroUIManager.cs
index 723800a..9bcc3ee 100644
--- a/Main/System/HeroUI/HeroUIManager.cs
+++ b/Main/System/HeroUI/HeroUIManager.cs
@@ -69,6 +69,10 @@
 
         config = FuncConfigConfig.Get("HeroOnTeam");
         lockHeroCountLimit = JsonMapper.ToObject<int[][]>(config.Numerical1);
+        teamSortByJob = JsonMapper.ToObject<int[]>(config.Numerical2);
+        onekeyGuideID = int.Parse(config.Numerical3);
+        onekeyGuideFirstPos = int.Parse(config.Numerical4);
+        
     }
 
     public void OnBeforePlayerDataInitialize()
diff --git a/Main/System/Main/PlayerMainDate.cs b/Main/System/Main/PlayerMainDate.cs
index 5164266..a35504f 100644
--- a/Main/System/Main/PlayerMainDate.cs
+++ b/Main/System/Main/PlayerMainDate.cs
@@ -109,7 +109,7 @@
             return;
         }
 
-        prowNum = hero.CalculatePower();
+        prowNum = hero.CalculateFightPower();
         prowNumChange = prowNum - HeroUIManager.Instance.lastFightPower.Value;
         HeroUIManager.Instance.lastFightPower = new KeyValuePair<string, long>();
         isAdd = prowNumChange > 0;
diff --git a/Main/System/NewBieGuidance/NewBieCenter.cs b/Main/System/NewBieGuidance/NewBieCenter.cs
index 1b05f90..9d59430 100644
--- a/Main/System/NewBieGuidance/NewBieCenter.cs
+++ b/Main/System/NewBieGuidance/NewBieCenter.cs
@@ -255,11 +255,7 @@
 
         guideStep = config.Steps.Length > 0 ? config.Steps[0] : 0;
         var stepConfig = ScriptableObjectLoader.LoadSoNewBieGuideStep(guideStep);
-        if (!(stepConfig.guideType == GuideType.NewBie && stepConfig.clickCompleteNoMask))
-        {
-            // 闈炲己鍒跺紩瀵间笉鏆傚仠鎴樻枟锛屽鏈夊叿浣撻渶瑕佸彲浠ュ鍔犲瓧娈�
-            BattleManager.Instance.storyBattleField.IsPause = true;
-        }
+        TryPauseStoryBattle();
 
 
         if (guideBeginEvent != null)
@@ -278,6 +274,37 @@
         UIManager.Instance.CloseWindow<ChatWin>();
         return true;
 
+    }
+
+    public void TryPauseStoryBattle()
+    {
+        var stepConfig = ScriptableObjectLoader.LoadSoNewBieGuideStep(guideStep);
+        if (!(stepConfig.guideType == GuideType.NewBie && stepConfig.clickCompleteNoMask))
+        {
+            // 闈炲己鍒跺紩瀵间笉鏆傚仠鎴樻枟锛屽鏈夊叿浣撻渶瑕佸彲浠ュ鍔犲瓧娈�
+            BattleManager.Instance.storyBattleField.IsPause = true;
+        }
+    }
+
+    public bool IsPauseStoryBattleState()
+    {
+        if (!UIManager.Instance.IsOpened<NewBieWin>())
+            return false;
+        
+        var stepConfig = ScriptableObjectLoader.LoadSoNewBieGuideStep(guideStep);
+        if (!(stepConfig.guideType == GuideType.NewBie && stepConfig.clickCompleteNoMask))
+        {
+            // 闈炲己鍒跺紩瀵间笉鏆傚仠鎴樻枟锛屽鏈夊叿浣撻渶瑕佸彲浠ュ鍔犲瓧娈�
+            if (currentGuide == BattleManager.Instance.fightGuideID)
+            {
+                // 鎴樻枟寮曞涓紝涓嶆殏鍋�
+                return false;
+            }
+            return true;
+        }
+
+
+        return false;
     }
 
     bool IsNeedRecord(int _id)
@@ -400,7 +427,9 @@
         switch ((GuideTriggerType)config.TriggerType)
         {
             case GuideTriggerType.None:
-                return true;
+                if (isOrgTrigger)
+                    return true;
+                return false;
             case GuideTriggerType.FunctionOpen:
                 return FuncOpen.Instance.IsFuncOpen(config.Condition);
             case GuideTriggerType.Level:
diff --git a/Main/System/Team/TeamBase.cs b/Main/System/Team/TeamBase.cs
index 84d2361..522db83 100644
--- a/Main/System/Team/TeamBase.cs
+++ b/Main/System/Team/TeamBase.cs
@@ -345,6 +345,7 @@
     }
     
     //checkLock 锛氭槸鍚﹂獙璇佷笂闃典汉鏁伴檺鍒�
+    //targetPosition 浠�0寮�濮�
     public void AddHero(HeroInfo heroInfo, int targetPosition, bool checkLock)
     {
         if (targetPosition < 0 || targetPosition >= tempHeroes.Length)

--
Gitblit v1.8.0