Browse Source

商城商品排序

huangxiaoyue 1 year ago
parent
commit
ab48b68665
1 changed files with 4 additions and 1 deletions
  1. 4 1
      GameClient/Assets/Game/HotUpdate/Data/ShopDataManager.cs

+ 4 - 1
GameClient/Assets/Game/HotUpdate/Data/ShopDataManager.cs

@@ -130,7 +130,10 @@ namespace GFGGame
                 int buyTypeB = (b.maxBuyNum == 0 || b.maxBuyNum - GetGoodsBuyNumById(b.id) > 0) ? 1 : -1;
                 if (buyTypeA > buyTypeB) return -1;
                 if (buyTypeA < buyTypeB) return 1;
-
+                int sortTypeA = a.sort == 0 ? 999 : a.sort;
+                int sortTypeB = b.sort == 0 ? 999 : b.sort; 
+                if (sortTypeA > sortTypeB) return 1;
+                if (sortTypeA < sortTypeB) return -1;
                 return a.id - b.id;
             });
             return shopCfgs;