소스 검색

修改图鉴中饰品的加载方式

leiyasi 1 년 전
부모
커밋
29dfd65180

+ 60 - 0
GameClient/Assets/Game/HotUpdate/Data/DressUpMenuItemDataManager.cs

@@ -729,6 +729,66 @@ namespace GFGGame
             return result;
         }
 
+        public static List<int> GetAllDressUpGuideIdListBySubTypes(List<int> subTypes)
+        {
+            List<int> result = new List<int>();
+            List<ItemCfg> itemCfgs = new List<ItemCfg>();
+
+            for (int j = 0; j < subTypes.Count; j++)
+            {
+                int subType = subTypes[j];
+                if (subType == ConstDressUpItemType.TE_SHU)
+                {
+                    ItemTypeCfg[] itemTypeCfg = ItemTypeCfgArray.Instance.dataArray;
+                    for (int i = 0; i < itemTypeCfg.Length; i++)
+                    {
+                        if (itemTypeCfg[i].type > ConstDressUpItemType.TE_SHU)
+                        {
+                            itemCfgs.AddRange(ItemCfgArray.Instance.GetCfgsByitemTypeAndsubType(ConstItemType.DRESS_UP, itemTypeCfg[i].type));
+                        }
+                    }
+                }
+                else
+                {
+                    itemCfgs.AddRange(ItemCfgArray.Instance.GetCfgsByitemTypeAndsubType(ConstItemType.DRESS_UP, subType));
+                }
+            }
+
+
+            itemCfgs.Sort((a, b) =>
+            {
+                bool haveA = CheckHasItem(a.id);
+                bool haveB = CheckHasItem(b.id);
+
+                if (haveB && !haveA)
+                {
+                    return 1;
+                }
+                else if (!haveB && haveA)
+                {
+                    return -1;
+                }
+
+                if (a.rarity != b.rarity)
+                {
+                    return a.rarity > b.rarity ? -1 : 1;
+                }
+
+                return a.res.CompareTo(b.res);
+
+            });
+
+            for (int i = 0; i < itemCfgs.Count; i++)
+            {
+                if (itemCfgs[i].isHide <= 0)
+                {
+                    result.Add(itemCfgs[i].id);
+                }
+            }
+
+            return result;
+        }
+
         public static bool isLoading = false;
         public static async Task GetAllDressUpGuideIdListBySubTypeAsync()
         {

+ 8 - 8
GameClient/Assets/Game/HotUpdate/Views/FieldGuide/DressUpGuideView.cs

@@ -202,15 +202,15 @@ namespace GFGGame
                 // 存在二级菜单
                 if (item1.subMenusArr.Length > 0)
                 {
-                    _itemIdList.Clear();
-
                     _currentList2 = item1.subMenusArr.Clone() as int[];
-                    for (int i = 0; i < item1.subMenusArr.Length; i++)
+                    List<int> types = new List<int>();
+                    for (int i = 0; i < _currentList2.Length; i++)
                     {
                         DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[i] - 1];
-                        _itemIdList.AddRange(DressUpMenuItemDataManager.GetAllDressUpGuideIdListBySubType(item2.type, false));
+                        types.Add(item2.type);
                     }
-                    DressUpMenuItemDataManager.SortDressUpGuideIdList(_itemIdList);
+                    _itemIdList = DressUpMenuItemDataManager.GetAllDressUpGuideIdListBySubTypes(types);
+
                     ShowListType2();
                 }
                 else
@@ -231,13 +231,13 @@ namespace GFGGame
 
             if (index == 0)
             {
-                _itemIdList.Clear();
+                List<int> types = new List<int>();
                 for (int i = 0; i < _currentList2.Length; i++)
                 {
                     DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[i] - 1];
-                    _itemIdList.AddRange(DressUpMenuItemDataManager.GetAllDressUpGuideIdListBySubType(item2.type, false));
+                    types.Add(item2.type);
                 }
-                DressUpMenuItemDataManager.SortDressUpGuideIdList(_itemIdList);
+                _itemIdList = DressUpMenuItemDataManager.GetAllDressUpGuideIdListBySubTypes(types);
             }
             else
             {