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/HeroUIManager.OnTeam.cs |   78 +++++++++++++++++++++++++-------------
 1 files changed, 51 insertions(+), 27 deletions(-)

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
     {

--
Gitblit v1.8.0