| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540 | 
							- using System.Collections;
 
- using System.Collections.Generic;
 
- using System;
 
- using UnityEngine;
 
- namespace GFGGame
 
- {
 
-     public enum DressFilterType
 
-     {
 
-         None,
 
-         Search,
 
-         Filter
 
-     }
 
-     public class DressUpMenuItemDataManager
 
-     {
 
-         public static string dressSearchTxt = "";
 
-         public static DressFilterType dressFilterType = DressFilterType.None;
 
-         public static List<int> selectRarityList = new List<int>();
 
-         public static List<int> selectScoreList = new List<int>();
 
-         public static List<string> selectTagList = new List<string>();
 
-         private static List<int> _itemDatas = new List<int>();
 
-         private static Dictionary<int, List<int>> _itemDatasBySubTypeDic = new Dictionary<int, List<int>>();
 
-         public static Dictionary<int, List<int>> ItemDatasBySubTypeDic { get { return _itemDatasBySubTypeDic; } }
 
-         private static Dictionary<int, List<int>> _newItemdata = new Dictionary<int, List<int>>();
 
-         private static List<int> _newSuitData = new List<int>();
 
-         public static void InitData()
 
-         {
 
-             _itemDatas.Clear();
 
-             _newItemdata.Clear();
 
-             _itemDatasBySubTypeDic.Clear();
 
-         }
 
-         public static void Clear()
 
-         {
 
-             DressUpMenuItemDataManager.dressFilterType = DressFilterType.None;
 
-             selectRarityList.Clear();
 
-             selectScoreList.Clear();
 
-             selectTagList.Clear();
 
-             dressSearchTxt = "";
 
-         }
 
-         public static void Add(int value)
 
-         {
 
-             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(value);
 
-             if (itemCfg == null)
 
-             {
 
-                 Debug.LogError("添加了一个不存在的物品" + value);
 
-             }
 
-             else
 
-             {
 
-                 if (!_itemDatas.Contains(value))
 
-                 {
 
-                     _itemDatas.Add(value);
 
-                     int subType = ItemUtilCS.GetItemSubType(value);
 
-                     subType = subType >= (int)ConstDressUpItemType.TE_SHU ? (int)ConstDressUpItemType.TE_SHU : subType;
 
-                     if (!_itemDatasBySubTypeDic.ContainsKey(subType))
 
-                     {
 
-                         _itemDatasBySubTypeDic.Add(subType, new List<int>());
 
-                     }
 
-                     _itemDatasBySubTypeDic[subType].Add(value);
 
-                     if (GameGlobal.DataInited)
 
-                     {
 
-                         AddNewDressItem(value);
 
-                     }
 
-                     DressUpMenuSuitDataManager.CheckItemInSuit(value);
 
-                 }
 
-             }
 
-         }
 
-         public static bool CheckHasItem(int itemID)
 
-         {
 
-             return _itemDatas.Contains(itemID);
 
-         }
 
-         public static void Remove(int value)
 
-         {
 
-             if (_itemDatas == null)
 
-             {
 
-                 return;
 
-             }
 
-             if (_itemDatas.Contains(value))
 
-             {
 
-                 _itemDatas.Remove(value);
 
-             }
 
-             int subType = ItemUtilCS.GetItemSubType(value);
 
-             subType = subType >= (int)ConstDressUpItemType.TE_SHU ? (int)ConstDressUpItemType.TE_SHU : subType;
 
-             if (_itemDatasBySubTypeDic.ContainsKey(subType) && _itemDatasBySubTypeDic[subType].IndexOf(value) >= 0)
 
-             {
 
-                 _itemDatasBySubTypeDic[subType].Remove(value);
 
-             }
 
-         }
 
-         public static List<int> getItemDatasByType(int type)
 
-         {
 
-             List<int> arrayList = new List<int>();
 
-             if (_itemDatasBySubTypeDic.ContainsKey(type))
 
-             {
 
-                 arrayList.AddRange(_itemDatasBySubTypeDic[type]);
 
-             }
 
-             // for (int i = 0; i < _itemDatas.Count; i++)
 
-             // {
 
-             //     int itemID = (int)_itemDatas[i];
 
-             //     int subType = ItemUtilCS.GetItemSubType(itemID);
 
-             //     if (type == (int)ConstDressUpItemType.TE_SHU && subType > type)
 
-             //     {
 
-             //         arrayList.Add(itemID);
 
-             //     }
 
-             //     else if (subType == type)
 
-             //     {
 
-             //         arrayList.Add(itemID);
 
-             //     }
 
-             // }
 
-             return arrayList;
 
-         }
 
-         public static List<int> SortItemListByHighScore(List<int> arrayList)
 
-         {
 
-             arrayList.Sort((int a, int b) =>
 
-             {
 
-                 bool isNewA = CheckIsDressUpItemNew(a);
 
-                 bool isNewB = CheckIsDressUpItemNew(b);
 
-                 if (isNewA != isNewB)
 
-                 {
 
-                     if (isNewA) return -1;
 
-                     if (isNewB) return 1;
 
-                 }
 
-                 int scoreA = ItemDataManager.GetItemAdditionScore(a, InstanceZonesDataManager.currentScoreType, InstanceZonesDataManager.currentFightTags); ;
 
-                 int scoreB = ItemDataManager.GetItemAdditionScore(b, InstanceZonesDataManager.currentScoreType, InstanceZonesDataManager.currentFightTags); ;
 
-                 if (scoreB > scoreA)
 
-                 {
 
-                     return 1;
 
-                 }
 
-                 else if (scoreB < scoreA)
 
-                 {
 
-                     return -1;
 
-                 }
 
-                 return 0;
 
-             });
 
-             return arrayList;
 
-         }
 
-         public static List<int> SortItemListByLowScore(List<int> arrayList)
 
-         {
 
-             arrayList.Sort((int a, int b) =>
 
-             {
 
-                 bool isNewA = CheckIsDressUpItemNew(a);
 
-                 bool isNewB = CheckIsDressUpItemNew(b);
 
-                 if (isNewA != isNewB)
 
-                 {
 
-                     if (isNewA) return -1;
 
-                     if (isNewB) return 1;
 
-                 }
 
-                 int scoreA = ItemDataManager.GetItemAdditionScore(a, InstanceZonesDataManager.currentScoreType, InstanceZonesDataManager.currentFightTags); ;
 
-                 int scoreB = ItemDataManager.GetItemAdditionScore(b, InstanceZonesDataManager.currentScoreType, InstanceZonesDataManager.currentFightTags); ;
 
-                 if (scoreB < scoreA)
 
-                 {
 
-                     return 1;
 
-                 }
 
-                 else if (scoreB > scoreA)
 
-                 {
 
-                     return -1;
 
-                 }
 
-                 return 0;
 
-             });
 
-             return arrayList;
 
-         }
 
-         private static List<int> SortItemListByScoreByType(List<int> arrayList)
 
-         {
 
-             arrayList.Sort((int a, int b) =>
 
-             {
 
-                 int typeA = ItemUtilCS.GetItemSubType(a);
 
-                 int typeB = ItemUtilCS.GetItemSubType(b);
 
-                 int scoreA = ItemDataManager.GetItemAdditionScore(a, InstanceZonesDataManager.currentScoreType, InstanceZonesDataManager.currentFightTags); ;
 
-                 int scoreB = ItemDataManager.GetItemAdditionScore(b, InstanceZonesDataManager.currentScoreType, InstanceZonesDataManager.currentFightTags); ;
 
-                 if (typeB < typeA)
 
-                 {
 
-                     return -1;
 
-                 }
 
-                 else if (typeB > typeA)
 
-                 {
 
-                     return 1;
 
-                 }
 
-                 else if (scoreB > scoreA)
 
-                 {
 
-                     return 1;
 
-                 }
 
-                 else if (scoreB < scoreA)
 
-                 {
 
-                     return -1;
 
-                 }
 
-                 return 0;
 
-             });
 
-             return arrayList;
 
-         }
 
-         public static List<int> SortItemListByHighRarity(List<int> arrayList)
 
-         {
 
-             arrayList.Sort((int a, int b) =>
 
-             {
 
-                 ItemCfg itemCfgA = ItemCfgArray.Instance.GetCfg(a);
 
-                 ItemCfg itemCfgB = ItemCfgArray.Instance.GetCfg(b);
 
-                 bool isNewA = CheckIsDressUpItemNew(a);
 
-                 bool isNewB = CheckIsDressUpItemNew(b);
 
-                 if (isNewA != isNewB)
 
-                 {
 
-                     if (isNewA) return -1;
 
-                     if (isNewB) return 1;
 
-                 }
 
-                 if (itemCfgB.rarity > itemCfgA.rarity)
 
-                 {
 
-                     return 1;
 
-                 }
 
-                 else if (itemCfgB.rarity < itemCfgA.rarity)
 
-                 {
 
-                     return -1;
 
-                 }
 
-                 return 0;
 
-             });
 
-             return arrayList;
 
-         }
 
-         public static List<int> SortItemListByLowRarity(List<int> arrayList)
 
-         {
 
-             arrayList.Sort((int a, int b) =>
 
-             {
 
-                 ItemCfg itemCfgA = ItemCfgArray.Instance.GetCfg(a);
 
-                 ItemCfg itemCfgB = ItemCfgArray.Instance.GetCfg(b);
 
-                 bool isNewA = CheckIsDressUpItemNew(a);
 
-                 bool isNewB = CheckIsDressUpItemNew(b);
 
-                 if (isNewA != isNewB)
 
-                 {
 
-                     if (isNewA) return -1;
 
-                     if (isNewB) return 1;
 
-                 }
 
-                 if (itemCfgB.rarity < itemCfgA.rarity)
 
-                 {
 
-                     return 1;
 
-                 }
 
-                 else if (itemCfgB.rarity > itemCfgA.rarity)
 
-                 {
 
-                     return -1;
 
-                 }
 
-                 return 0;
 
-             });
 
-             return arrayList;
 
-         }
 
-         public static List<int> GetRecommendItemList(bool toSort = true)
 
-         {
 
-             StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(InstanceZonesDataManager.currentLevelCfgId);
 
-             StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
 
-             List<int> recommendTypeList = new List<int>();
 
-             List<int> recommendList = new List<int>();
 
-             List<int> recommendSpecialList = new List<int>();
 
-             List<int> tempAllList = _itemDatas.GetRange(0, _itemDatas.Count);
 
-             if (toSort)
 
-             {
 
-                 SortItemListByScoreByType(tempAllList);
 
-             }
 
-             foreach (int itemID in tempAllList)
 
-             {
 
-                 int subType = ItemUtilCS.GetItemSubType(itemID);
 
-                 if (!DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemID) && subType != ConstDressUpItemType.BEI_JING)
 
-                 {
 
-                     if (!recommendTypeList.Contains(subType))
 
-                     {
 
-                         bool isNeed = fightCfg.needItemId > 0 && (ItemUtilCS.GetItemSubType(fightCfg.needItemId) != subType || ItemUtilCS.GetItemSubType(fightCfg.needItemId) == subType && fightCfg.needItemId == itemID);
 
-                         if (isNeed || fightCfg.needItemId <= 0)
 
-                         {
 
-                             if (subType < ConstDressUpItemType.TE_SHU)
 
-                             {
 
-                                 recommendList.Add(itemID);
 
-                             }
 
-                             recommendTypeList.Add(subType);
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-             recommendSpecialList = DressUpMenuItemDataManager.getItemDatasByType(ConstDressUpItemType.TE_SHU);
 
-             recommendSpecialList = DressUpMenuItemDataManager.SortItemListByHighScore(recommendSpecialList);
 
-             List<int> specialSubList = new List<int>();
 
-             List<int> specialIdList = new List<int>();
 
-             foreach (int itemID in recommendSpecialList)
 
-             {
 
-                 int subType = ItemUtilCS.GetItemSubType(itemID);
 
-                 if (subType > ConstDressUpItemType.TE_SHU)
 
-                 {
 
-                     if (specialSubList.Count >= 3) continue;
 
-                     if (specialSubList.IndexOf(subType) < 0)
 
-                     {
 
-                         specialSubList.Add(subType);
 
-                         specialIdList.Add(itemID);
 
-                     }
 
-                 }
 
-             }
 
-             recommendList.AddRange(specialIdList);
 
-             return recommendList;
 
-         }
 
-         // public static int GetRecommendCount()
 
-         // {
 
-         //     List<int> recommendTypeList = GetRecommendItemList(false);
 
-         //     return recommendTypeList.Count;
 
-         // }
 
-         // public static int GetItemScore(int itemId)
 
-         // {
 
-         //     return ItemDataManager.GetItemAdditionScore(itemId, InstanceZonesDataManager.currentScoreType);
 
-         // }
 
-         public static List<int> DressSearch(List<int> list)
 
-         {
 
-             List<int> searchList = new List<int>();
 
-             for (int i = 0; i < list.Count; i++)
 
-             {
 
-                 bool isSearch = true;
 
-                 ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(list[i]);
 
-                 SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(list[i]);
 
-                 string name = itemCfg != null ? itemCfg.name : suitCfg.name;
 
-                 for (int j = 0; j < dressSearchTxt.Length; j++)
 
-                 {
 
-                     if (name.IndexOf(dressSearchTxt[j]) < 0)
 
-                     {
 
-                         isSearch = false;
 
-                         break;
 
-                     }
 
-                 }
 
-                 if (isSearch)
 
-                 {
 
-                     searchList.Add(list[i]);
 
-                 }
 
-             }
 
-             return searchList;
 
-         }
 
-         public static List<int> DressFilter(List<int> list)
 
-         {
 
-             List<int> filterList = new List<int>();
 
-             for (int i = 0; i < list.Count; i++)
 
-             {
 
-                 ItemCfg cfg = ItemCfgArray.Instance.GetCfg(list[i]);
 
-                 SuitCfg tzCfg = SuitCfgArray.Instance.GetCfg(list[i]);
 
-                 bool isRarity = cfg == null ? FilterRarity(tzCfg) : FilterRarity(cfg);
 
-                 bool isScore = cfg == null ? true : FilterScore(cfg);
 
-                 bool isTag = cfg == null ? true : FilterTag(cfg);
 
-                 if (isRarity && isScore && isTag)
 
-                 {
 
-                     filterList.Add(list[i]);
 
-                 }
 
-             }
 
-             if (filterList.Count == 0)
 
-             {
 
-                 PromptController.Instance.ShowFloatTextPrompt("无满足条件物品");
 
-             }
 
-             return filterList;
 
-         }
 
-         private static bool FilterRarity(ItemCfg cfg)
 
-         {
 
-             bool isRarity = false;
 
-             if (selectRarityList.Count > 0)
 
-             {
 
-                 for (int j = 0; j < selectRarityList.Count; j++)
 
-                 {
 
-                     if (cfg != null && cfg.rarity == selectRarityList[j])
 
-                     {
 
-                         isRarity = true;
 
-                         break;
 
-                     }
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 isRarity = true;
 
-             }
 
-             return isRarity;
 
-         }
 
-         private static bool FilterRarity(SuitCfg cfg)
 
-         {
 
-             bool isRarity = false;
 
-             if (selectRarityList.Count > 0)
 
-             {
 
-                 for (int j = 0; j < selectRarityList.Count; j++)
 
-                 {
 
-                     if (cfg != null && cfg.rarity == selectRarityList[j])
 
-                     {
 
-                         isRarity = true;
 
-                         break;
 
-                     }
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 isRarity = true;
 
-             }
 
-             return isRarity;
 
-         }
 
-         private static bool FilterScore(ItemCfg cfg)
 
-         {
 
-             bool isScore = false;
 
-             if (selectScoreList.Count > 0)
 
-             {
 
-                 if (cfg != null)
 
-                 {
 
-                     for (int j = 0; j < selectScoreList.Count; j++)
 
-                     {
 
-                         if (cfg.mainScore == selectScoreList[j])
 
-                         {
 
-                             isScore = true;
 
-                             break;
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 isScore = true;
 
-             }
 
-             return isScore;
 
-         }
 
-         private static bool FilterTag(ItemCfg cfg)
 
-         {
 
-             bool isTag = false;
 
-             if (selectTagList.Count > 0)
 
-             {
 
-                 if (cfg != null)
 
-                 {
 
-                     for (int j = 0; j < selectTagList.Count; j++)
 
-                     {
 
-                         if (isTag == true)
 
-                         {
 
-                             break;
 
-                         }
 
-                         for (int k = 0; k < cfg.tagsArr.Length; k++)
 
-                         {
 
-                             if (cfg.tagsArr[k][0] == selectTagList[j])
 
-                             {
 
-                                 isTag = true;
 
-                                 break;
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 isTag = true;
 
-             }
 
-             return isTag;
 
-         }
 
-         public static void AddNewDressItem(int value)
 
-         {
 
-             int subType = ItemUtilCS.GetItemSubType(value);
 
-             if (!_newItemdata.ContainsKey(subType))
 
-             {
 
-                 _newItemdata.Add(subType, new List<int>());
 
-             }
 
-             _newItemdata[subType].Add(value);
 
-             // ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(value);
 
-             // if (itemCfg.suitId > 0 && DressUpMenuSuitDataManager.CheckHaveSuit(itemCfg.suitId))
 
-             // {
 
-             //     SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(itemCfg.suitId);
 
-             // }
 
-         }
 
-         public static void RemoveNewDressItem(int itemId)
 
-         {
 
-             int subType = ItemCfgArray.Instance.GetCfg(itemId).subType;
 
-             if (_newItemdata.ContainsKey(subType) && _newItemdata[subType].IndexOf(itemId) >= 0)
 
-             {
 
-                 _newItemdata[subType].Remove(itemId);
 
-             }
 
-         }
 
-         //检测一级菜单是否有展示新增
 
-         public static bool CheckIsFirstMenuNew(int menuId)
 
-         {
 
-             if (_newItemdata.Count == 0) return false;
 
-             DressUpMenuItemCfg1 cfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuId);
 
-             if (cfg1.subMenusArr.Length > 0)//有二级菜单
 
-             {
 
-                 foreach (int id2 in cfg1.subMenusArr)
 
-                 {
 
-                     if (CheckIsSecondMenuNew(id2)) return true;
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 if (_newItemdata.ContainsKey(cfg1.type) && _newItemdata[cfg1.type].Count > 0) return true;
 
-             }
 
-             return false;
 
-         }
 
-         //检测二级菜单是否有展示新增
 
-         public static bool CheckIsSecondMenuNew(int subMenuId)
 
-         {
 
-             if (_newItemdata.Count == 0) return false;
 
-             DressUpMenuItemCfg2 cfg2 = DressUpMenuItemCfg2Array.Instance.GetCfg(subMenuId);
 
-             if (_newItemdata.ContainsKey(cfg2.type) && _newItemdata[cfg2.type].Count > 0)
 
-             {
 
-                 return true;
 
-             }
 
-             return false;
 
-         }
 
-         //检测服装部件是否为新增
 
-         public static bool CheckIsDressUpItemNew(int itemId)
 
-         {
 
-             if (_newItemdata.Count == 0) return false;
 
-             int subType = ItemUtilCS.GetItemSubType(itemId);
 
-             return _newItemdata.ContainsKey(subType) && _newItemdata[subType].IndexOf(itemId) >= 0;
 
-         }
 
-     }
 
- }
 
 
  |