Browse Source

词牌排序

huangxiaoyue 1 year ago
parent
commit
ffae314657
1 changed files with 23 additions and 1 deletions
  1. 23 1
      GameClient/Assets/Game/HotUpdate/Data/CardDataManager.cs

+ 23 - 1
GameClient/Assets/Game/HotUpdate/Data/CardDataManager.cs

@@ -84,12 +84,12 @@ namespace GFGGame
             return resources;
         }
 
+        //默认词牌排序规则 :稀有度>星级>等级>种类(风>花>雪>月)
         public static List<CardData> SortItemList(List<CardData> arrayList)
         {
 
             arrayList.Sort((CardData a, CardData b) =>
             {
-
                 int rarityA = a.itemCfg.rarity;
                 int rarityB = b.itemCfg.rarity;
                 if (rarityA < rarityB)
@@ -100,6 +100,28 @@ namespace GFGGame
                 {
                     return -1;
                 }
+                else {
+                    if (a.star < b.star)
+                    {
+                        return 1;
+                    }
+                    else if (a.star > b.star) { 
+                        return -1;
+                    }
+                    else {
+                        if (a.lv < b.lv)
+                            return 1;
+                        else if (a.lv > b.lv)
+                            return -1;
+                        else
+                        {
+                            if (a.mainScore> b.mainScore)
+                                return 1;
+                            else if (a.mainScore < b.mainScore)
+                                return -1;
+                        }
+                    }
+                }
 
                 return string.Compare(a.itemCfg.res, b.itemCfg.res);
             });