Преглед на файлове

优化搭配赛排名渲染

hexiaojie преди 11 месеца
родител
ревизия
21c5f7640c

+ 18 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/MatchingCompetitionSproxy.cs

@@ -216,6 +216,24 @@ namespace GFGGame
                 }
             }
 
+            //排序
+            MatchingCompetitionDataManager.Instance._currentRankList.Sort((a, b) =>
+            {
+                // 假设列表项具有一个名为 'score' 的属性,你想要按照分数进行排序
+                if (a.JudgingInfo.Score > b.JudgingInfo.Score)
+                {
+                    return -1; // a在b之前
+                }
+                else if (a.JudgingInfo.Score < b.JudgingInfo.Score)
+                {
+                    return 1; // b在a之前
+                }
+                else
+                {
+                    return 0; // a和b相同
+                }
+            });
+            
             Timers.inst.StartCoroutine(
                 MatchingPhotoHelper.Download(MatchingCompetitionDataManager.Instance._currentRankList));
 

+ 18 - 0
GameClient/Assets/Game/HotUpdate/Views/MatchingCompetition/MatchingCompetitionRankView.cs

@@ -64,6 +64,24 @@ namespace GFGGame
         }
      private void UpdateView()
         {
+            //排序
+            MatchingCompetitionDataManager.Instance._currentRankList.Sort((a, b) =>
+            {
+                // 假设列表项具有一个名为 'score' 的属性,你想要按照分数进行排序
+                if (a.JudgingInfo.Score > b.JudgingInfo.Score)
+                {
+                    return -1; // a在b之前
+                }
+                else if (a.JudgingInfo.Score < b.JudgingInfo.Score)
+                {
+                    return 1; // b在a之前
+                }
+                else
+                {
+                    return 0; // a和b相同
+                }
+            });
+            
             if(MatchingCompetitionDataManager.Instance._currentRankList.Count > 0)
             {
                 MatchingPhotoWorksData otherInfo = MatchingCompetitionDataManager.Instance._currentRankList[0];