From cdb0198fb8e85811ec1e06b15f36df9cbe0fdb9a Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期一, 25 二月 2019 14:12:41 +0800
Subject: [PATCH] 3335 物品相关类型重构

---
 System/KnapSack/Logic/PackModel.cs | 4248 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 2,124 insertions(+), 2,124 deletions(-)

diff --git a/System/KnapSack/Logic/PlayerPackModels.cs b/System/KnapSack/Logic/PackModel.cs
similarity index 99%
rename from System/KnapSack/Logic/PlayerPackModels.cs
rename to System/KnapSack/Logic/PackModel.cs
index e2b3006..fadc8dc 100644
--- a/System/KnapSack/Logic/PlayerPackModels.cs
+++ b/System/KnapSack/Logic/PackModel.cs
@@ -1,2124 +1,2124 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Linq;
-using UnityEngine;
-using LitJson;
-
-namespace Snxxz.UI
-{
-    [XLua.LuaCallCSharp]
-    public class PlayerPackModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk
-    {
-        public static string StrengthAttrShift_RecordKey = "";
-        public const string RecordKnapsackTitle = "RecordKnapsackTitle";
-
-        Dictionary<int, int> DrugToDungeonDict { get; set; }   //key 涓硅嵂ID,value鍓湰ID
-        Dictionary<int, int[]> DungeonToDrugDict { get; set; }  //key 鍓湰ID,value涓硅嵂ID鍒楄〃
-        public List<AttrFruitConfig> makeDruglist { get; private set; }
-        Dictionary<int, Dictionary<int, int>> decomposeAttrDict = new Dictionary<int, Dictionary<int, int>>();
-        string RoleEquipLocalSave = "";
-        List<int> LocalSavePlaceArray { get; set; }
-        Dictionary<int, List<int>> sharedUseCountItemDict { get; set; }
-        bool isUpdatePlayerLv = false;
-
-        BlastFurnaceModel FurnaceModel { get { return ModelCenter.Instance.GetModel<BlastFurnaceModel>(); } }
-
-        public override void Init()
-        {
-            ParseConfig();
-            List<DungeonOpenTimeConfig> dungeonlist = DungeonOpenTimeConfig.GetValues();
-            if (dungeonlist != null)
-            {
-                DrugToDungeonDict = new Dictionary<int, int>();
-                DungeonToDrugDict = new Dictionary<int, int[]>();
-
-                for (int i = 0; i < dungeonlist.Count; i++)
-                {
-                    int[] drugIdlist = dungeonlist[i].ElixirHint;
-                    if (drugIdlist != null && drugIdlist.Length > 0)
-                    {
-                        DungeonToDrugDict.Add(dungeonlist[i].DataMapID, drugIdlist);
-                        for (int j = 0; j < drugIdlist.Length; j++)
-                        {
-                            DrugToDungeonDict.Add(drugIdlist[j], dungeonlist[i].DataMapID);
-                        }
-                    }
-                }
-            }
-
-            makeDruglist = new List<AttrFruitConfig>();
-            List<AttrFruitConfig> fruitlist = AttrFruitConfig.GetValues();
-            for (int i = 0; i < fruitlist.Count; i++)
-            {
-                if (fruitlist[i].FuncID == 2)
-                {
-                    makeDruglist.Add(fruitlist[i]);
-                }
-            }
-            StageLoad.Instance.onStageLoadFinish += OnStageLoadFinish;
-
-            SetDevourEquipPlace();
-
-            decomposeAttrDict.Clear();
-            List<EquipDeComposeConfig> decomlist = EquipDeComposeConfig.GetValues();
-            for (int i = 0; i < decomlist.Count; i++)
-            {
-                JsonData attrData = JsonMapper.ToObject(decomlist[i].Attr);
-                Dictionary<int, int> attrDict = new Dictionary<int, int>();
-                decomposeAttrDict.Add(decomlist[i].LV, attrDict);
-                foreach (var id in attrData.Keys)
-                {
-                    attrDict.Add(int.Parse(id), int.Parse(attrData[id].ToString()));
-                }
-            }
-
-            FuncConfigConfig equipDecompose = FuncConfigConfig.Get("EquipDevourCount");
-            minDecomposeNum = int.Parse(equipDecompose.Numerical1);
-            defaultUnSelectlist = ConfigParse.GetMultipleStr<int>(equipDecompose.Numerical2);
-
-            FuncConfigConfig ShareUseCntItem = FuncConfigConfig.Get("ShareUseCntItem");
-            sharedUseCountItemDict = new Dictionary<int, List<int>>();
-            JsonData shareUseJson = JsonMapper.ToObject(ShareUseCntItem.Numerical1);
-            if (shareUseJson.IsArray)
-            {
-                for (int i = 0; i < shareUseJson.Count; i++)
-                {
-                    var idListJson = shareUseJson[i];
-                    var idlist = new List<int>();
-                    sharedUseCountItemDict.Add(i, idlist);
-                    foreach (var id in idListJson)
-                    {
-                        idlist.Add(int.Parse(id.ToString()));
-                    }
-                }
-            }
-
-            SetRoleEquipRedpoint();
-        }
-
-        public void OnBeforePlayerDataInitialize()
-        {
-            GlobalTimeEvent.Instance.secondEvent -= UpdateSecond;
-            PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= UpdatePlayerLv;
-            LocalSave.DeleteKey(RecordKnapsackTitle);
-            cacheMapId = 0;
-            playerPackDict.Clear();
-            itemDayUseCntDict.Clear();
-            itemSumUseCntDict.Clear();
-            itemGUIDDict.Clear();
-            showDropItem = false;
-            isPlayBetterEquipEffect = false;
-            equipAttrActiveDict.Clear();
-            colorType = EquipColorType.Purple;
-            lvType = EquipLvType.All;
-            starType = EquipStarType.None;
-            decomposeLv = 1;
-            decomposeExp = 0;
-            decomposeProgress = 0;
-            isAutoDecompose = false;
-        }
-
-        public void OnAfterPlayerDataInitialize()
-        {
-
-        }
-
-        public void OnPlayerLoginOk()
-        {
-            ItemOperateUtility.Instance.RequestWarehouseData();
-            SetPlayerAttrActiveRedPoint();
-            EquipDecomRedCtrl();
-            RoleEquipLocalSave = StringUtility.Contact("RoleEquipLocalSave", PlayerDatas.Instance.baseData.PlayerID);
-            StrengthAttrShift_RecordKey = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "StrengthAttrShift");
-            if (LocalSave.GetIntArray(RoleEquipLocalSave) != null)
-            {
-                LocalSavePlaceArray = LocalSave.GetIntArray(RoleEquipLocalSave).ToList();
-            }
-            else
-            {
-                LocalSavePlaceArray = null;
-            }
-            GlobalTimeEvent.Instance.secondEvent += UpdateSecond;
-            PlayerDatas.Instance.PlayerDataRefreshInfoEvent += UpdatePlayerLv;
-            isUpdatePlayerLv = true;
-        }
-
-        public override void UnInit()
-        {
-
-        }
-
-        ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
-
-        public event Action<PackType> refrechPackEvent; //鍒锋柊鏁翠釜鑳屽寘鏁版嵁
-        public event Action<PackType, int, int> refreshItemCountEvent; //锛堝崟涓級鏈�鏂扮墿鍝佹暟閲忓埛鏂�(鏃х殑寮冪敤)鍦ㄥ緱鍒版柊鐗╁搧銆佺墿鍝佹暟閲忕殑鏀瑰彉锛屾竻鐞嗚鐗╁搧鏃跺潎浼氳Е鍙� int 浣嶇疆绱㈠紩 int鐗╁搧id
-        public event Action<PackType> gridRefreshEvent; //鑳屽寘绌烘牸鍒锋柊
-        public event Action<PackType, int, int> itemCntAddEvent; //鐗╁搧鏁伴噺澧炲姞 int 浣嶇疆绱㈠紩 int鐗╁搧id
-        public event Action<PackType, int, int> itemCntReduceEvent; //鐗╁搧鏁伴噺鍑忓皯鐨勬敼鍙� int 浣嶇疆绱㈠紩 int鐗╁搧id
-        public event Action<int, int> useItemSuccessEvent; //鐗╁搧浣跨敤鎴愬姛 int 浣嶇疆绱㈠紩 int鐗╁搧id
-
-        public event Action<int> refreshItemDayUseCountEvent;  //鍒锋柊鐗╁搧姣忔棩浣跨敤鏁伴噺
-        public event Action<int> refreshItemSumUseCountEvent;  //鍒锋柊鐗╁搧鎬讳娇鐢ㄦ暟閲�
-
-        public bool isPlayBetterEquipEffect { get; set; }  //鏁寸悊鑳屽寘鏃舵槸鍚︽挱鏀剧壒鏁�
-
-        #region 鎺ユ敹鏈嶅姟绔暟鎹�
-        bool showDropItem = false;
-        private Dictionary<PackType, SinglePack> playerPackDict = new Dictionary<PackType, SinglePack>();
-        private Dictionary<string, ItemModel> itemGUIDDict = new Dictionary<string, ItemModel>();
-
-        public void UpdatePack(H0725_tagRolePackRefreshEx packInfo)
-        {
-            showDropItem = false;
-            SetLookIndex(null);
-            var packType = (PackType)packInfo.PackType;
-            if (!playerPackDict.ContainsKey(packType))
-            {
-                playerPackDict.Add(packType, new SinglePack(packType));
-            }
-
-            if (isPlayBetterEquipEffect)
-            {
-                ItemLogicUtility.Instance.ClearSortedBetterEquip();
-            }
-
-            for (int i = 0; i < packInfo.ItemCount; i++)
-            {
-                var itemInfo = new ItemInfo(packInfo.ItemInfo[i]);
-                var item = playerPackDict[packType].UpdateItem(itemInfo);
-                AddItemGUIDDict(item);
-
-                if (isPlayBetterEquipEffect)
-                {
-                    ItemLogicUtility.Instance.SetBagSortBetterEquipList(GetItemByGuid(itemInfo.guid));
-                }
-            }
-
-            if (refrechPackEvent != null)
-            {
-                refrechPackEvent(packType);
-            }
-
-            UpdatePackRedpoint(packType);
-        }
-
-        public void UpdateItem(H0704_tagRolePackRefresh serverItem)
-        {
-            isPlayBetterEquipEffect = false;
-            SetLookIndex(null);
-            showDropItem = true;
-            PackType type = (PackType)serverItem.PackType;
-            if (!playerPackDict.ContainsKey(type))
-            {
-                playerPackDict.Add(type, new SinglePack(type));
-            }
-
-            var itemInfo = new ItemInfo(serverItem);
-            var item = playerPackDict[type].UpdateItem(itemInfo);
-            AddItemGUIDDict(item);
-
-            if (refreshItemCountEvent != null)
-            {
-                refreshItemCountEvent(type, itemInfo.index, itemInfo.itemId);
-            }
-
-            if (itemCntAddEvent != null)
-            {
-                itemCntAddEvent(type, itemInfo.index, itemInfo.itemId);
-            }
-
-            if (type == PackType.Equip)
-            {
-                SetPlayerAttrActiveRedPoint();
-            }
-
-            UpdatePackRedpoint(type);
-            EquipDecomRedCtrl();
-        }
-
-        public void UpdateUnlockedGridCount(H0724_tagRolePackCanUseCount useCount)
-        {
-            PackType type = (PackType)useCount.PackType;
-            if (!playerPackDict.ContainsKey(type))
-            {
-                playerPackDict.Add(type, new SinglePack(type));
-            }
-
-            playerPackDict[type].SetOpenGridCount(useCount.CanUseCount);
-
-            if (gridRefreshEvent != null)
-            {
-                gridRefreshEvent(type);
-            }
-
-            UpdatePackRedpoint(type);
-        }
-
-        public void RefreshItemCount(H0707_tagItemCountRefresh refresh)
-        {
-            SetLookIndex(null);
-            isPlayBetterEquipEffect = false;
-            PackType type = (PackType)refresh.PackType;
-            SinglePack singlePack = null;
-            playerPackDict.TryGetValue(type, out singlePack);
-            if (singlePack != null)
-            {
-                ItemModel itemModel = singlePack.GetItemByIndex(refresh.ItemIndex);
-                if (itemModel != null)
-                {
-                    bool isAddItemCount = false;
-                    if (refresh.ItemCount > itemModel.count)
-                    {
-                        isAddItemCount = true;
-                    }
-                    itemModel.RefreshItemCount(refresh.ItemCount);
-
-                    if (isAddItemCount)
-                    {
-                        if (itemCntAddEvent != null)
-                        {
-                            itemCntAddEvent(type, itemModel.itemPlace, itemModel.itemId);
-                        }
-                        ItemLogicUtility.Instance.RecommendItem(itemModel);
-                        ItemLogicUtility.Instance.RefreshPickItem(type, itemModel.guid);
-                    }
-                    else
-                    {
-                        if (itemCntReduceEvent != null)
-                        {
-                            itemCntReduceEvent(type, itemModel.itemPlace, itemModel.itemId);
-                        }
-                    }
-
-                    if (refreshItemCountEvent != null)
-                    {
-                        refreshItemCountEvent(type, itemModel.itemPlace, itemModel.itemId);
-                    }
-                }
-            }
-
-        }
-
-        public void ClearPack(H0711_tagClearItemPack clearPack)
-        {
-            PackType type = (PackType)clearPack.PackIndex;
-            SinglePack singlePack = null;
-            playerPackDict.TryGetValue(type, out singlePack);
-            if (singlePack != null)
-            {
-                singlePack.Clear();
-            }
-
-            if (type == PackType.Equip)
-            {
-                SetPlayerAttrActiveRedPoint();
-            }
-            //if (RefreshPackAct != null)
-            //{
-            //    RefreshPackAct(type);
-            //}
-
-            //RedPointPackCtrl(type);
-        }
-
-        public void RemoveItem(H0709_tagClearItem clearItem)
-        {
-            isPlayBetterEquipEffect = false;
-            SetLookIndex(null);
-            PackType type = (PackType)clearItem.PackType;
-
-            SinglePack singlePack = null;
-            playerPackDict.TryGetValue(type, out singlePack);
-            string guid = "";
-            if (singlePack != null)
-            {
-                ItemModel itemModel = singlePack.GetItemByIndex(clearItem.ItemIndex);
-                guid = itemModel.guid;
-                int itemId = itemModel.itemId;
-                DeleteItemDictByGUID(type, itemModel.guid);
-                singlePack.RemoveItem(clearItem.ItemIndex);
-                if (refreshItemCountEvent != null)
-                {
-                    refreshItemCountEvent(type, clearItem.ItemIndex, itemId);
-                }
-
-                if (itemCntReduceEvent != null)
-                {
-                    itemCntReduceEvent(type, clearItem.ItemIndex, itemId);
-                }
-            }
-            if (type == PackType.Equip)
-            {
-                SetPlayerAttrActiveRedPoint();
-            }
-            UpdatePackRedpoint(type);
-            EquipDecomRedCtrl();
-
-            if (GetItemByGuid(guid) == null)
-            {
-                KnapsackTimeCDMgr.Instance.UnRegister(guid);
-            }
-
-        }
-
-        public void PackResetOk(H0316_tagPackResetOK packreset)
-        {
-            ItemLogicUtility.Instance.isPackResetOk = true;
-        }
-
-        public void UseItemSuccess(H0706_tagUseItemSuccess success)
-        {
-            isPlayBetterEquipEffect = false;
-            SetLookIndex(null);
-            if (success.PlayerID != PlayerDatas.Instance.baseData.PlayerID)
-                return;
-
-            ItemConfig itemConfig = ItemConfig.Get((int)success.ItemID);
-            MakeUseItemSuccess(success.ItemIndex, (int)success.ItemID);
-
-            switch (success.ItemID)
-            {
-                case 221:
-                    if (WindowCenter.Instance.IsOpen<KnapSackWin>())
-                    {
-                        WindowCenter.Instance.Close<KnapSackWin>();
-                    }
-                    break;
-            }
-
-            if (useItemSuccessEvent != null)
-            {
-                useItemSuccessEvent(success.ItemIndex, (int)success.ItemID);
-            }
-        }
-
-        private void MakeUseItemSuccess(int index, int id)
-        {
-            ItemConfig itemConfig = ItemConfig.Get(id);
-            if (itemConfig.CDType != 0)
-            {
-                float configCdTime = (float)Math.Round((double)itemConfig.CDTime / 1000, 1);
-                var items = GetSinglePack(PackType.Item).GetItemsByType((int)ItemType.Buff);
-                for (int i = 0; i < items.Count; i++)
-                {
-                    if (items[i].itemId == 901
-                        || items[i].itemId == 902
-                        || items[i].itemId == 903
-                        || items[i].itemId == 904)
-                    {
-                        KnapsackTimeCDMgr.Instance.Register(items[i].guid, items[i].itemId, configCdTime);
-                        break;
-                    }
-                }
-
-            }
-        }
-
-        void AddItemGUIDDict(ItemModel itemModel)
-        {
-            if (!itemGUIDDict.ContainsKey(itemModel.guid))
-            {
-                itemGUIDDict.Add(itemModel.guid, itemModel);
-                GetItemEventCtrl(itemModel);
-            }
-            else
-            {
-                PackType prePack = itemGUIDDict[itemModel.guid].packType;
-                itemGUIDDict[itemModel.guid] = itemModel;
-                if (prePack != itemModel.packType)
-                {
-                    GetItemEventCtrl(itemModel);
-                }
-            }
-        }
-
-        void DeleteItemDictByGUID(PackType type, string guid)
-        {
-
-            if (itemGUIDDict.ContainsKey(guid))
-            {
-                if (itemGUIDDict[guid].packType == type)
-                {
-                    itemGUIDDict.Remove(guid);
-                }
-            }
-        }
-
-        /// <summary>
-        /// 鐗╁搧姣忔棩浣跨敤鐨勬鏁�
-        /// </summary>
-        private Dictionary<int, int> itemDayUseCntDict = new Dictionary<int, int>();
-        public void UpdateItemUseCnt(HA809_tagMCItemDayUseCntInfo useCntInfo)
-        {
-            for (int i = 0; i < useCntInfo.Count; i++)
-            {
-                int itemId = (int)useCntInfo.ItemUseCntList[i].ItemID;
-                int cnt = useCntInfo.ItemUseCntList[i].UseCnt;
-                if (!itemDayUseCntDict.ContainsKey(itemId))
-                {
-                    itemDayUseCntDict.Add(itemId, cnt);
-                }
-                else
-                {
-                    itemDayUseCntDict[itemId] = cnt;
-                }
-
-                if (refreshItemDayUseCountEvent != null)
-                {
-                    refreshItemDayUseCountEvent(itemId);
-                }
-
-            }
-        }
-
-        private Dictionary<int, int> itemSumUseCntDict = new Dictionary<int, int>();
-        public void UpdateItemSumUseCnt(HA339_tagMCAttrFruitEatCntList useCntInfo)
-        {
-            for (int i = 0; i < useCntInfo.count; i++)
-            {
-                int itemId = (int)useCntInfo.EatCntList[i].ItemID;
-                int cnt = useCntInfo.EatCntList[i].EatCnt;
-                if (!itemSumUseCntDict.ContainsKey(itemId))
-                {
-                    itemSumUseCntDict.Add(itemId, cnt);
-                }
-                else
-                {
-                    itemSumUseCntDict[itemId] = cnt;
-                }
-
-                if (refreshItemSumUseCountEvent != null)
-                {
-                    refreshItemSumUseCountEvent(itemId);
-                }
-
-            }
-        }
-
-        #region 鎺ユ敹鍏ㄨ韩鏄熺骇锛屽己鍖栧睘鎬ф縺娲�
-        public event Action RefreshActiveAttrAct;
-        private Dictionary<int, int> equipAttrActiveDict = new Dictionary<int, int>();
-        public void UpdatePlayerEquipAttrActiveInfo(HA317_tagMCAllEquipAttrActiveInfo info)
-        {
-            for (int i = 0; i < info.Count; i++)
-            {
-                int type = info.ActiveInfo[i].Type;
-                int cnt = (int)info.ActiveInfo[i].Cnt;
-                if (type == 1)
-                {
-                    cnt = RoleEquipStarsConfig.GetActiveStars(cnt);
-                }
-                if (!equipAttrActiveDict.ContainsKey(type))
-                {
-                    equipAttrActiveDict.Add(type, cnt);
-                }
-                else
-                {
-                    equipAttrActiveDict[type] = cnt;
-                }
-            }
-
-            if (RefreshActiveAttrAct != null)
-            {
-                RefreshActiveAttrAct();
-            }
-
-            SetPlayerAttrActiveRedPoint();
-        }
-
-        public void SendActiveAttrQuest(int type, int cnt)
-        {
-            var equipAttr = new CA503_tagCMActiveAllEquipAttr();
-            equipAttr.Type = (byte)type;
-            equipAttr.Cnt = (uint)cnt;
-            GameNetSystem.Instance.SendInfo(equipAttr);
-        }
-
-        public int GetActiveCntByType(int type)
-        {
-            int cnt = 0;
-            equipAttrActiveDict.TryGetValue(type, out cnt);
-            return cnt;
-        }
-
-        public List<int> GetAddAttrIdByStars(int _curStarsCount, out int starsCount)
-        {
-            starsCount = 0;
-            List<int> activeIdlist = new List<int>();
-            List<int> addIdlist = new List<int>();
-            List<int> starslist = RoleEquipStarsConfig.GetEquipStarsCntlist();
-            if (starslist == null || starslist.Count < 1) return addIdlist;
-            int activeStars = GetActiveCntByType(1);
-            int realActiveStars = _curStarsCount > activeStars ? activeStars : _curStarsCount;
-            for (int i = starslist.Count - 1; i > -1; i--)
-            {
-                if (i == 0 && starslist[i] > realActiveStars)
-                {
-                    realActiveStars = 0;
-                    break;
-                }
-                if (starslist[i] <= realActiveStars)
-                {
-                    realActiveStars = starslist[i];
-                    break;
-                }
-            }
-
-            RoleEquipStarsConfig activeStarsConfig = RoleEquipStarsConfig.GetEquipStarsModel(realActiveStars);
-            if (activeStarsConfig != null)
-            {
-                for (int i = 0; i < activeStarsConfig.attType.Length; i++)
-                {
-                    activeIdlist.Add(activeStarsConfig.attType[i]);
-                }
-            }
-            List<RoleEquipStarsConfig> starsConfigs = RoleEquipStarsConfig.GetValues();
-            for (int i = 0; i < starsConfigs.Count; i++)
-            {
-                bool isAddId = false;
-                RoleEquipStarsConfig starsConfig = starsConfigs[i];
-                if (realActiveStars < starsConfig.countNeed)
-                {
-                    for (int j = 0; j < starsConfig.attType.Length; j++)
-                    {
-                        int attrId = starsConfig.attType[j];
-                        if (!activeIdlist.Contains(attrId))
-                        {
-                            isAddId = true;
-                            addIdlist.Add(attrId);
-                        }
-                    }
-                }
-                if (isAddId)
-                {
-                    starsCount = starsConfig.countNeed;
-                    break;
-                }
-
-            }
-            return addIdlist;
-        }
-        #endregion
-
-        #endregion
-
-        #region 鐜╁瑁呭鐗规畩閫昏緫
-        public int fairyRedPointLvlimt { get; private set; }
-        public int wingsRedpointLvlimt { get; private set; }
-        public int fairyGetPathId { get; private set; }
-        public Dictionary<int, int> wingsGetPathIdDict { get; private set; }
-        public Dictionary<int, List<int>> dungeonUseDict { get; private set; }
-        void ParseConfig()
-        {
-            FuncConfigConfig funcConfig = FuncConfigConfig.Get("WingYuPeiHQTJ");
-            fairyRedPointLvlimt = int.Parse(funcConfig.Numerical1);
-            wingsRedpointLvlimt = int.Parse(funcConfig.Numerical2);
-            fairyGetPathId = int.Parse(funcConfig.Numerical3);
-            wingsGetPathIdDict = ConfigParse.GetDic<int, int>(funcConfig.Numerical4);
-            FuncConfigConfig copyItemBulletWindow = FuncConfigConfig.Get("CopyItemBulletWindow");
-            JsonData copyWinData = JsonMapper.ToObject(copyItemBulletWindow.Numerical1);
-            dungeonUseDict = new Dictionary<int, List<int>>();
-            foreach (var dungeonId in copyWinData.Keys)
-            {
-                List<int> idlist = new List<int>();
-                dungeonUseDict.Add(int.Parse(dungeonId), idlist);
-                if (copyWinData[dungeonId].IsArray)
-                {
-                    JsonData useData = copyWinData[dungeonId];
-                    for (int i = 0; i < useData.Count; i++)
-                    {
-                        idlist.Add(int.Parse(useData[i].ToString()));
-                    }
-                }
-            }
-        }
-
-        public int GetRoleEquipPathId(int equipPlace)
-        {
-            int playerJob = PlayerDatas.Instance.baseData.Job;
-            switch ((RoleEquipType)equipPlace)
-            {
-                case RoleEquipType.FairyCan:
-                case RoleEquipType.FairyCan2:
-                    return fairyGetPathId;
-                case RoleEquipType.Wing:
-                    if (wingsGetPathIdDict.ContainsKey(playerJob))
-                    {
-                        return wingsGetPathIdDict[playerJob];
-                    }
-                    break;
-            }
-            return 0;
-        }
-
-        private void UpdateSecond()
-        {
-            if (isUpdatePlayerLv)
-            {
-                for (int i = 1; i < 13; i++)
-                {
-                    CheckRoleEquipByPlace((RoleEquipType)i);
-                }
-                UpdateRoleEquipRed();
-                isUpdatePlayerLv = false;
-            }
-        }
-
-        private void UpdatePlayerLv(PlayerDataRefresh type)
-        {
-            if (type != PlayerDataRefresh.LV) return;
-
-            isUpdatePlayerLv = true;
-        }
-
-        public bool IsShowAddEquipByPlace(int equipPlace)
-        {
-            switch ((RoleEquipType)equipPlace)
-            {
-                case RoleEquipType.FairyCan:
-                case RoleEquipType.FairyCan2:
-                    if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt)
-                    {
-                        return true;
-                    }
-                    break;
-                case RoleEquipType.Wing:
-                    if (PlayerDatas.Instance.baseData.LV >= wingsRedpointLvlimt)
-                    {
-                        return true;
-                    }
-                    break;
-            }
-            return false;
-        }
-
-        public void CheckRoleEquipByPlace(RoleEquipType equipType)
-        {
-            ItemModel itemModel = GetItemByIndex(PackType.Equip, (int)equipType);
-            switch (equipType)
-            {
-                case RoleEquipType.FairyCan:
-                case RoleEquipType.FairyCan2:
-                    if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt && itemModel != null)
-                    {
-                        SaveRoleEquipToLocal((int)equipType);
-                    }
-                    break;
-                case RoleEquipType.Wing:
-                    if (PlayerDatas.Instance.baseData.LV >= wingsRedpointLvlimt && itemModel != null)
-                    {
-                        SaveRoleEquipToLocal((int)equipType);
-                    }
-                    break;
-            }
-        }
-
-        public void SaveRoleEquipToLocal(int equipPlace, bool isRedState = false)
-        {
-            if (isRedState && roleEquipRedDict[equipPlace].state == RedPointState.None) return;
-
-            if (LocalSavePlaceArray != null)
-            {
-                if (!LocalSavePlaceArray.Contains(equipPlace))
-                {
-                    LocalSavePlaceArray.Add(equipPlace);
-                    LocalSave.SetIntArray(RoleEquipLocalSave, LocalSavePlaceArray.ToArray());
-                }
-            }
-            else
-            {
-                LocalSavePlaceArray = new List<int>();
-                LocalSavePlaceArray.Add(equipPlace);
-                LocalSave.SetIntArray(RoleEquipLocalSave, LocalSavePlaceArray.ToArray());
-            }
-        }
-        #endregion
-
-        private void GetItemEventCtrl(ItemModel itemModel)
-        {
-            if (showDropItem)
-            {
-                bool isOverdue = false;
-                if (itemModel.config.ExpireTime > 0)
-                {
-                    ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(itemModel.guid);
-                    switch ((EquipReduceType)itemModel.config.EndureReduceType)
-                    {
-                        case EquipReduceType.Def_EquipReduceType_Time:
-                            List<int> itemEffectTime = itemModel.GetUseDataModel((int)ItemUseDataKey.createTime);
-                            if (itemEffectTime != null && itemEffectTime[0] != 0)
-                            {
-                                if (cool == null || cool.GetRemainTime() <= 0)
-                                {
-                                    isOverdue = true;
-                                }
-                            }
-                            break;
-
-                        case EquipReduceType.Def_EquipReduceType_RTimeItem:
-                            if (cool == null || cool.GetRemainTime() <= 0)
-                            {
-                                isOverdue = true;
-                            }
-                            break;
-
-                    }
-                }
-                if (!isOverdue)
-                {
-                    ItemLogicUtility.Instance.RecommendItem(itemModel);
-                    ItemLogicUtility.Instance.OnGetEquip(itemModel);
-                    ItemLogicUtility.Instance.RefreshPickItem(itemModel.packType, itemModel.guid);
-                }
-            }
-
-        }
-
-        /// <summary>
-        /// 寰楀埌鏌愪釜鍖呰9鐨勬墍鏈夋暟鎹�
-        /// </summary>
-        /// <param name="type"></param>
-        /// <returns></returns>
-        public SinglePack GetSinglePack(PackType type)
-        {
-            SinglePack singlePack = null;
-            playerPackDict.TryGetValue(type, out singlePack);
-            return singlePack;
-        }
-
-        public void UnLockPackGrid(int chooseGridCount, PackType type)
-        {
-            var singlePack = GetSinglePack(type);
-            int openCount = chooseGridCount - singlePack.unlockedGridCount;
-            int index = 0;
-            switch (type)
-            {
-                case PackType.Item:
-                    index = chooseGridCount - GeneralDefine.initBagGridCount;
-                    break;
-                case PackType.Warehouse:
-                    index = chooseGridCount - GeneralDefine.initDepotGridCount;
-                    break;
-            }
-
-            itemTipsModel.SetExtendGirdModel(openCount, index, type);
-            WindowCenter.Instance.Open<ExtendWin>();
-        }
-
-        public ItemModel GetItemByGuid(string guid)
-        {
-            ItemModel itemModel = null;
-            itemGUIDDict.TryGetValue(guid, out itemModel);
-            return itemModel;
-        }
-
-        public ItemModel GetItemByIndex(PackType type, int index)
-        {
-            switch (type)
-            {
-                case PackType.JadeDynastyEquip:
-                    if (index >= 121)
-                    {
-                        index = index - 121;
-                    }
-                    break;
-            }
-
-            ItemModel itemModel = null;
-            if (playerPackDict.ContainsKey(type))
-            {
-                itemModel = playerPackDict[type].GetItemByIndex(index);
-            }
-            return itemModel;
-        }
-
-        public List<ItemModel> GetItemsById(PackType type, int id)
-        {
-            if (playerPackDict.ContainsKey(type))
-            {
-                var singlePack = playerPackDict[type];
-                return singlePack.GetItemsById(id);
-            }
-            else
-            {
-                return null;
-            }
-        }
-
-        public string GetItemGUIDByID(int itemId)
-        {
-            string guid = string.Empty;
-            foreach (var key in itemGUIDDict.Keys)
-            {
-                if (itemGUIDDict[key].itemId == itemId)
-                {
-                    guid = key;
-                    return guid;
-                }
-            }
-
-            return guid;
-        }
-
-        /// <summary>
-        /// 寰楀埌ID鐩稿悓鐨勭墿鍝佹暟閲�
-        /// </summary>
-        /// <param name="type"></param>
-        /// <param name="id"></param>
-        /// <returns></returns>
-        public int GetItemCountByID(PackType type, int id)
-        {
-            int count = 0;
-            var singlePack = GetSinglePack(type);
-            if (singlePack != null)
-            {
-                count = singlePack.GetCountById(id);
-            }
-
-            return count;
-        }
-
-        public bool CheckBagIsPutNewItem(int itemId)
-        {
-            var singlePack = GetSinglePack(PackType.Item);
-            if (singlePack == null)
-            {
-                return false;
-            }
-
-            var config = ItemConfig.Get(itemId);
-            var items = singlePack.GetItemsById(itemId);
-            var count = singlePack.GetCountById(itemId);
-
-            int sumPutCnt = config.PackCount * items.Count;
-            if (sumPutCnt > count)
-            {
-                return true;
-            }
-            else if (GetEmptyGridCount(PackType.Item) > 0)
-            {
-                return true;
-            }
-
-            return false;
-        }
-
-        public int GetEmptyGridCount(PackType type)
-        {
-            int count = 0;
-            SinglePack singlePack = GetSinglePack(type);
-            if (singlePack != null)
-            {
-                count = singlePack.GetEmptyGridCount();
-            }
-
-            return count;
-        }
-
-        public bool TryGetShareNumItem(int itemId, out List<int> idlist)
-        {
-            idlist = new List<int>();
-            foreach (var list in sharedUseCountItemDict.Values)
-            {
-                if (list.Contains(itemId))
-                {
-                    idlist = list;
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        /// <summary>
-        /// 寰楀埌鐗╁搧浠婃棩浣跨敤娆℃暟
-        /// </summary>
-        /// <param name="itemId"></param>
-        /// <returns></returns>
-        public int GetItemUsedTimesToday(int itemId)
-        {
-            int useCnt = 0;
-            List<int> shareIdlist = null;
-            bool isShare = TryGetShareNumItem(itemId, out shareIdlist);
-            if (isShare)
-            {
-                foreach (var id in shareIdlist)
-                {
-                    int singleUseCnt = 0;
-                    itemDayUseCntDict.TryGetValue(id, out singleUseCnt);
-                    useCnt += singleUseCnt;
-                }
-            }
-            else
-            {
-                itemDayUseCntDict.TryGetValue(itemId, out useCnt);
-            }
-            return useCnt;
-        }
-
-        /// <summary>
-        /// 寰楀埌鐗╁搧鎬讳娇鐢ㄦ鏁�
-        /// </summary>
-        /// <param name="itemId"></param>
-        /// <returns></returns>
-        public int GetItemTotalUsedTimes(int itemId)
-        {
-            int useCnt = 0;
-            List<int> shareIdlist = null;
-            bool isShare = TryGetShareNumItem(itemId, out shareIdlist);
-            if (isShare)
-            {
-                foreach (var id in shareIdlist)
-                {
-                    int singleUseCnt = 0;
-                    itemDayUseCntDict.TryGetValue(id, out singleUseCnt);
-                    useCnt += singleUseCnt;
-                }
-            }
-            else
-            {
-                itemSumUseCntDict.TryGetValue(itemId, out useCnt);
-            }
-            return useCnt;
-        }
-
-        public void GotoWashAttributePoint(string guid)
-        {
-            ItemModel itemModel = GetItemByGuid(guid);
-            if (itemModel == null) return;
-
-            WashAttrPointWin.itemModel = itemModel;
-            WindowCenter.Instance.Open<WashAttrPointWin>();
-        }
-
-        #region 绾㈢偣閫昏緫鍒ゆ柇
-        private Dictionary<int, Redpoint> roleEquipRedDict = new Dictionary<int, Redpoint>();
-        public void SetRoleEquipRedpoint()
-        {
-            roleEquipRedDict.Clear();
-            for (int i = 1; i < 13; i++)
-            {
-                int redKey = ITEMPACK_REDKEY + i;
-                Redpoint redpoint = new Redpoint(MainRedDot.RedPoint_BagFuncKey, redKey);
-                roleEquipRedDict.Add(i, redpoint);
-            }
-        }
-
-        public void UpdateRoleEquipRed()
-        {
-            foreach (var key in roleEquipRedDict.Keys)
-            {
-                var item = GetItemByIndex(PackType.Equip, key);
-                switch ((RoleEquipType)key)
-                {
-                    case RoleEquipType.FairyCan:
-                        if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt && !TryGetRoleEquipLocalSave(key)
-                           && item == null && roleEquipRedDict[(int)RoleEquipType.FairyCan2].state == RedPointState.None)
-                        {
-                            roleEquipRedDict[key].state = RedPointState.Simple;
-                        }
-                        else
-                        {
-                            roleEquipRedDict[key].state = RedPointState.None;
-                        }
-                        break;
-                    case RoleEquipType.FairyCan2:
-                        if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt && !TryGetRoleEquipLocalSave(key)
-                            && item == null && roleEquipRedDict[(int)RoleEquipType.FairyCan].state == RedPointState.None)
-                        {
-                            roleEquipRedDict[key].state = RedPointState.Simple;
-                        }
-                        else
-                        {
-                            roleEquipRedDict[key].state = RedPointState.None;
-                        }
-                        break;
-                    case RoleEquipType.Wing:
-                        if (PlayerDatas.Instance.baseData.LV >= wingsRedpointLvlimt && !TryGetRoleEquipLocalSave(key)
-                          && item == null)
-                        {
-                            roleEquipRedDict[key].state = RedPointState.Simple;
-                        }
-                        else
-                        {
-                            roleEquipRedDict[key].state = RedPointState.None;
-                        }
-                        break;
-                    default:
-                        roleEquipRedDict[key].state = RedPointState.None;
-                        break;
-                }
-            }
-        }
-
-        private bool TryGetRoleEquipLocalSave(int equipPlace)
-        {
-            if (LocalSavePlaceArray != null)
-            {
-                for (int i = 0; i < LocalSavePlaceArray.Count; i++)
-                {
-                    if (equipPlace == 9 || equipPlace == 10)
-                    {
-                        if (LocalSavePlaceArray[i] == 9 || LocalSavePlaceArray[i] == 10)
-                        {
-                            return true;
-                        }
-                    }
-                    else
-                    {
-                        if (LocalSavePlaceArray[i] == equipPlace)
-                        {
-                            return true;
-                        }
-                    }
-
-                }
-            }
-            return false;
-        }
-
-        const int ITEMPACK_REDKEY = 102011003;
-        Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY);
-
-        private void UpdatePackRedpoint(PackType type)
-        {
-            var singlePack = GetSinglePack(type);
-            if (singlePack == null)
-            {
-                return;
-            }
-
-            switch (type)
-            {
-                case PackType.Item:
-                    if (singlePack.GetEmptyGridCount() <= 0)
-                    {
-                        redpointItemPack.state = RedPointState.Full;
-                        SysNotifyMgr.Instance.ShowTip("BagFull");
-                    }
-                    else
-                    {
-                        redpointItemPack.state = RedPointState.None;
-                    }
-                    break;
-                case PackType.Warehouse:
-                    if (singlePack.GetEmptyGridCount() <= 0)
-                    {
-                        MainRedDot.Instance.redPointDepotFunc.state = RedPointState.Full;
-                    }
-                    else
-                    {
-                        MainRedDot.Instance.redPointDepotFunc.state = RedPointState.None;
-                    }
-                    break;
-            }
-        }
-
-        const int PLAYERSUMSTAR_REDKEY = 102011002;
-        Redpoint redpointSTAR = new Redpoint(MainRedDot.RedPoint_BagFuncKey, PLAYERSUMSTAR_REDKEY);
-
-        public event Action<int, bool> RefreshAttrActiveAct;
-        public void SetPlayerAttrActiveRedPoint()
-        {
-            if (IsActiveStarAttr())
-            {
-                if (redpointSTAR.state != RedPointState.Simple)
-                {
-                    redpointSTAR.state = RedPointState.Simple;
-                    if (RefreshAttrActiveAct != null)
-                    {
-                        RefreshAttrActiveAct(1, true);
-                    }
-                }
-            }
-            else
-            {
-                if (redpointSTAR.state != RedPointState.None)
-                {
-                    redpointSTAR.state = RedPointState.None;
-                    if (RefreshAttrActiveAct != null)
-                    {
-                        RefreshAttrActiveAct(1, false);
-                    }
-                }
-            }
-        }
-
-        public bool IsActiveStarAttr()
-        {
-            List<int> starslist = RoleEquipStarsConfig.GetEquipStarsCntlist();
-            SinglePack singlePack = GetSinglePack(PackType.Equip);
-            if (singlePack == null || starslist == null || starslist.Count < 1) return false;
-
-            Dictionary<int, ItemModel> _itemDict = singlePack.GetAllItems();
-            int playerSumStars = 0;
-            foreach (var model in _itemDict.Values)
-            {
-                playerSumStars += model.config.StarLevel;
-            }
-            int cnt = GetActiveCntByType(1);
-            int nextActiveStars = 0;
-            for (int i = 0; i < starslist.Count; i++)
-            {
-                if (cnt == 0)
-                {
-                    nextActiveStars = starslist[0];
-                    break;
-                }
-                else
-                {
-                    if (starslist[i] == cnt)
-                    {
-                        if (i < starslist.Count - 1)
-                        {
-                            nextActiveStars = starslist[i + 1];
-                        }
-                        break;
-                    }
-                }
-            }
-
-            if (nextActiveStars != 0 && playerSumStars >= nextActiveStars)
-            {
-                return true;
-            }
-
-            return false;
-        }
-
-        public bool IsActiveSTRAttr()
-        {
-            List<string> strenlist = ItemPlusSumAttrConfig.GetKeys();
-            if (strenlist == null || strenlist.Count < 1) return false;
-            int playerSumSTR = 0;
-            Dictionary<int, EquipmentInitialization> strenInfoDict = ModelCenter.Instance.GetModel<PlayerStrengthengDatas>()._EqInfo;
-            foreach (var value in strenInfoDict.Values)
-            {
-                ItemModel itemModel = GetItemByIndex(PackType.Equip, value.EquipIndex);
-                if (itemModel != null)
-                {
-                    playerSumSTR += value.EquipPartStarLV;
-                }
-            }
-            int cnt = GetActiveCntByType(0);
-            int nextActiveSTR = 0;
-            for (int i = 0; i < strenlist.Count; i++)
-            {
-                if (cnt == 0)
-                {
-                    nextActiveSTR = int.Parse(strenlist[0]);
-                    break;
-                }
-                else
-                {
-                    if (int.Parse(strenlist[i]) == cnt)
-                    {
-                        if (i < strenlist.Count - 1)
-                        {
-                            nextActiveSTR = int.Parse(strenlist[i + 1]);
-                        }
-                        break;
-                    }
-                }
-            }
-
-            if (nextActiveSTR != 0 && playerSumSTR >= nextActiveSTR)
-            {
-                return true;
-            }
-
-            return false;
-        }
-
-        public const int EquipDecompose_RedKey = 10205;
-        public Redpoint redpointEquipDecom = new Redpoint(MainRedDot.RedPoint_MainPackKey, EquipDecompose_RedKey);
-        public void EquipDecomRedCtrl()
-        {
-            if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.EquipDecompose)) return;
-
-            if (GetCanDevourModellist() != null && GetCanDevourModellist().Count >= minDevourEquipNum)
-            {
-                redpointEquipDecom.state = RedPointState.Simple;
-            }
-            else
-            {
-                redpointEquipDecom.state = RedPointState.None;
-            }
-        }
-        #endregion
-
-        #region 鏌ョ湅鏌愪釜浣嶇疆鐨勭墿鍝�
-        public event Action lookEquipEvent;
-        private int _lookLineIndex = -1;
-        public int lookLineIndex { get { return _lookLineIndex; } private set { _lookLineIndex = value; } }
-
-        public string lookItemGUID { get; private set; }
-
-        public void SetLookIndex(string guid, int singleRowCount = 5)
-        {
-            if (string.IsNullOrEmpty(guid) || guid == "")
-            {
-                lookLineIndex = -1;
-                lookItemGUID = "";
-            }
-            else
-            {
-                int index = GetItemByGuid(guid).itemPlace;
-                lookLineIndex = index / singleRowCount;
-                lookItemGUID = guid;
-            }
-
-            if (lookEquipEvent != null)
-            {
-                lookEquipEvent();
-            }
-
-        }
-
-        public event Action RefreshBagEvent;
-        public void RefreshBagInfo()
-        {
-            if (RefreshBagEvent != null)
-            {
-                RefreshBagEvent();
-            }
-        }
-        #endregion
-
-        public void SetJumpToOneKeySell(Transform parent)
-        {
-            var goEffect = AchievementGuideEffectPool.Require(1);
-            goEffect.transform.SetParentEx(parent, Vector3.zero, Quaternion.identity, Vector3.one);
-            AchievementGoto.guideAchievementId = 0;
-        }
-
-        #region 鐗╁搧浣跨敤蹇嵎鎻愮ず
-
-        private int cacheMapId = 0;
-        public event Action<PackType, string> itemUseAct;
-        private Dictionary<int, int> itemUseTypeDict = new Dictionary<int, int>(); //key SkillTypeID,value 浣跨敤鐗╁搧鐨処D
-        private void OnStageLoadFinish()
-        {
-            itemUseTypeDict.Clear();
-            if (PlayerDatas.Instance.baseData.MapID == cacheMapId)
-            {
-                return;
-            }
-
-            cacheMapId = PlayerDatas.Instance.baseData.MapID;
-            UpdateDungeonDanUse();
-            UpdateDungeonUse();
-            SinglePack singlePack = GetSinglePack(PackType.Item);
-            foreach (int itemId in itemUseTypeDict.Values)
-            {
-                var modellist = singlePack.GetItemsById(itemId);
-                if (modellist.Count > 0)
-                {
-                    ItemModel itemModel = modellist[0];
-                    bool isExist = StatusMgr.Instance.IsExist(PlayerDatas.Instance.hero.ServerInstID, itemModel.config.AddSkill1);
-                    DebugEx.Log("Buff鏄惁瀛樺湪" + isExist);
-                    if (itemUseAct != null && !isExist)
-                    {
-                        itemUseAct(PackType.Item, itemModel.guid);
-                    }
-                }
-            }
-        }
-
-        private void AddItemUseTypeDict(int id)
-        {
-            SkillConfig skillConfig = GetSkillConfig(id);
-            int itemCount = GetItemCountByID(PackType.Item, id);
-            if (skillConfig != null && itemCount > 0)
-            {
-                if (!itemUseTypeDict.ContainsKey(skillConfig.SkillTypeID))
-                {
-                    itemUseTypeDict.Add(skillConfig.SkillTypeID, id);
-                }
-                else
-                {
-                    SkillConfig preSkillConfig = GetSkillConfig(itemUseTypeDict[skillConfig.SkillTypeID]);
-                    if (skillConfig.SkillLV > preSkillConfig.SkillLV)
-                    {
-                        itemUseTypeDict[skillConfig.SkillTypeID] = id;
-                    }
-                }
-            }
-        }
-
-        private void UpdateDungeonDanUse()
-        {
-            int mapId = PlayerDatas.Instance.baseData.MapID;
-            int[] useDrugs = GetDrugIDListByDungeonID(mapId);
-            if (useDrugs == null) return;
-
-            for (int i = 0; i < useDrugs.Length; i++)
-            {
-                int id = useDrugs[i];
-                AddItemUseTypeDict(id);
-            }
-        }
-
-        private void UpdateDungeonUse()
-        {
-            int mapId = PlayerDatas.Instance.baseData.MapID;
-            if (!dungeonUseDict.ContainsKey(mapId)) return;
-
-            List<int> useIdlist = dungeonUseDict[mapId];
-            for (int i = 0; i < useIdlist.Count; i++)
-            {
-                int id = useIdlist[i];
-                AddItemUseTypeDict(id);
-            }
-        }
-
-        public SkillConfig GetSkillConfig(int itemId)
-        {
-            ItemConfig itemConfig = ItemConfig.Get(itemId);
-            SkillConfig skillConfig = SkillConfig.Get(itemConfig.AddSkill1);
-            return skillConfig;
-        }
-
-        public int GetDungeonIDByDrugID(int drugID)
-        {
-            int dungeonID = 0;
-            DrugToDungeonDict.TryGetValue(drugID, out dungeonID);
-            return dungeonID;
-        }
-
-        public int[] GetDrugIDListByDungeonID(int dungeonID)
-        {
-            int[] drugIDlist = null;
-            DungeonToDrugDict.TryGetValue(dungeonID, out drugIDlist);
-            return drugIDlist;
-        }
-        #endregion
-
-        #region 鍒ゆ柇鐗╁搧鏄惁杈惧埌浣跨敤涓婇檺
-        public bool IsReachUseLimit(string guid, out ulong count)
-        {
-            count = 0;
-            ItemModel itemModel = GetItemByGuid(guid);
-            if (itemModel == null) return false;
-
-            AttrFruitConfig fruitConfig = AttrFruitConfig.Get(itemModel.itemId);
-            int haveUseCnt = GetItemUsedTimesToday(itemModel.itemId);
-            int sumHaveUseCnt = GetItemTotalUsedTimes(itemModel.itemId);
-            count = (ulong)itemModel.count;
-            bool isReach = false;
-            int remainDayCnt = 0;
-            if (itemModel.config.MaxSkillCnt > 0)
-            {
-                remainDayCnt = itemModel.config.MaxSkillCnt - haveUseCnt;
-                if (itemModel.count > remainDayCnt)
-                {
-                    count = (ulong)remainDayCnt;
-                }
-
-            }
-
-            int remainSumCnt = 0;
-            if (fruitConfig != null)
-            {
-                remainSumCnt = fruitConfig.MaxUseCnt - sumHaveUseCnt;
-                if (remainSumCnt <= remainDayCnt && itemModel.count > remainSumCnt)
-                {
-                    count = (ulong)remainSumCnt;
-                }
-            }
-
-            if (count < (ulong)itemModel.count)
-            {
-                isReach = true;
-            }
-
-            return isReach;
-        }
-        #endregion
-
-        #region 鐗╁搧鍚炲櫖閫昏緫澶勭悊
-        public EquipColorType colorType { get; private set; }
-        public EquipLvType lvType { get; private set; }
-        public EquipStarType starType { get; private set; }
-        public event Action<EquipColorType> RefreshColorSelectAct;
-        public event Action<EquipLvType> RefreshLvSelectAct;
-        public event Action<EquipStarType> RefreshStarSelectAct;
-        public event Action RefreshEquipDecomNumAct;
-        public int[] defaultUnSelectlist { get; private set; }
-
-        public bool ContainPreciousItem(List<ItemModel> itemModels, out int betterEquipCnt, out int preciousCnt)
-        {
-            betterEquipCnt = 0;
-            preciousCnt = 0;
-            if (itemModels == null) return false;
-
-            for (int i = 0; i < itemModels.Count; i++)
-            {
-                if (defaultUnSelectlist.Contains(itemModels[i].itemId))
-                {
-                    preciousCnt += itemModels[i].count;
-                }
-                else if (ItemLogicUtility.Instance.IsFightUp(itemModels[i].itemId, itemModels[i].equipScore) == 1)
-                {
-                    betterEquipCnt += itemModels[i].count;
-                }
-            }
-
-            if (betterEquipCnt > 0 || preciousCnt > 0)
-            {
-                return true;
-            }
-
-            return false;
-        }
-
-        public bool ContainTwoStarEquip(List<ItemModel> itemModels, out int twoStarEquipCnt)
-        {
-            twoStarEquipCnt = 0;
-            if (itemModels == null) return false;
-            for (int i = 0; i < itemModels.Count; i++)
-            {
-                if (itemModels[i].config.StarLevel >= 2 && itemModels[i].config.ItemColor >= (int)E_ItemColor.Orange)
-                {
-                    twoStarEquipCnt += itemModels[i].count;
-                }
-            }
-            if (twoStarEquipCnt > 0)
-            {
-                return true;
-            }
-            return false;
-        }
-
-        public void SetColorSelect(EquipColorType type)
-        {
-            colorType = type;
-            if (colorType == EquipColorType.None)
-            {
-                if (lvType != EquipLvType.None)
-                {
-                    SetLvSelect(EquipLvType.None);
-                }
-            }
-            else
-            {
-                if (lvType == EquipLvType.None)
-                {
-                    SetLvSelect(EquipLvType.All);
-                }
-            }
-
-            if (RefreshColorSelectAct != null)
-            {
-                RefreshColorSelectAct(type);
-            }
-            SendEquipDevourRecordQuest();
-            EquipDecomRedCtrl();
-        }
-
-        public void SetLvSelect(EquipLvType type)
-        {
-            lvType = type;
-            if (lvType == EquipLvType.None)
-            {
-                if (colorType != EquipColorType.None)
-                {
-                    SetColorSelect(EquipColorType.None);
-                }
-            }
-            else
-            {
-                if (colorType == EquipColorType.None)
-                {
-                    SetColorSelect(EquipColorType.Purple);
-                }
-            }
-            if (RefreshLvSelectAct != null)
-            {
-                RefreshLvSelectAct(type);
-            }
-            SendEquipDevourRecordQuest();
-            EquipDecomRedCtrl();
-        }
-
-        public void SetStarSelect(EquipStarType type)
-        {
-            starType = type;
-            if (RefreshStarSelectAct != null)
-            {
-                RefreshStarSelectAct(type);
-            }
-            SendEquipDevourRecordQuest();
-            EquipDecomRedCtrl();
-        }
-
-        public List<int> devourPlacelist { get; private set; }
-        public int MaxDevourEquipNum { get; private set; }
-        public int minDevourEquipNum { get; private set; }
-        public void SetDevourEquipPlace()
-        {
-            devourPlacelist = new List<int>();
-            FuncConfigConfig funcConfig = FuncConfigConfig.Get("PetAbsorbType");
-            int[] placeArray = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1);
-            for (int i = 0; i < placeArray.Length; i++)
-            {
-                devourPlacelist.Add(placeArray[i]);
-            }
-            MaxDevourEquipNum = int.Parse(funcConfig.Numerical2);
-            minDevourEquipNum = int.Parse(funcConfig.Numerical3);
-        }
-
-        List<ItemModel> devourModellist = new List<ItemModel>();
-        List<ItemModel> orderDevourModellist = new List<ItemModel>();
-        public List<ItemModel> GetDevourModellist()
-        {
-            SinglePack singlePack = GetSinglePack(PackType.Item);
-            if (singlePack == null) return null;
-
-            devourModellist.Clear();
-            orderDevourModellist.Clear();
-            foreach (var model in singlePack.GetAllItems().Values)
-            {
-                if (model.config.Type == 29)
-                {
-                    devourModellist.Add(model);
-                }
-                else
-                {
-                    if (devourPlacelist.Contains(model.config.EquipPlace))
-                    {
-                        if (model.config.ItemColor >= (int)E_ItemColor.Purple)
-                        {
-                            devourModellist.Add(model);
-                        }
-                    }
-                }
-
-            }
-            orderDevourModellist.AddRange(devourModellist);
-            orderDevourModellist.Sort(CompareByColor);
-            return orderDevourModellist;
-        }
-
-        public int CompareByColor(ItemModel start, ItemModel next)
-        {
-            bool typeX = start.config.Type == 29 ? true : false;
-            bool typeY = next.config.Type == 29 ? true : false;
-
-            if (typeX.CompareTo(typeY) != 0) return -typeX.CompareTo(typeY);
-
-            int colorX = start.config.ItemColor;
-            int colorY = next.config.ItemColor;
-            if (colorX.CompareTo(colorY) != 0) return colorX.CompareTo(colorY);
-
-            int startIndex = devourModellist.IndexOf(start);
-            int nextIndex = devourModellist.IndexOf(next);
-            if (startIndex.CompareTo(nextIndex) != 0) return startIndex.CompareTo(nextIndex);
-
-            return 0;
-        }
-
-        public List<ItemModel> GetCanDevourModellist()
-        {
-            List<ItemModel> canDevourModellist = new List<ItemModel>();
-            SinglePack singlePack = GetSinglePack(PackType.Item);
-            if (singlePack == null
-                || colorType == EquipColorType.None
-                || lvType == EquipLvType.None)
-            {
-                if (RefreshEquipDecomNumAct != null)
-                {
-                    RefreshEquipDecomNumAct();
-                }
-                return null;
-            }
-
-            foreach (var model in singlePack.GetAllItems().Values)
-            {
-                if (model.config.Type == 29)
-                {
-                    if (!defaultUnSelectlist.Contains(model.itemId))
-                    {
-                        canDevourModellist.Add(model);
-                    }
-                }
-                else
-                {
-                    if (IsCanDevour(model))
-                    {
-                        canDevourModellist.Add(model);
-                    }
-
-                }
-            }
-            if (RefreshEquipDecomNumAct != null)
-            {
-                RefreshEquipDecomNumAct();
-            }
-            return canDevourModellist;
-        }
-
-        public bool IsCanDevour(ItemModel model)
-        {
-            if (devourPlacelist.Contains(model.config.EquipPlace))
-            {
-                if (model.config.ItemColor >= (int)E_ItemColor.Purple)
-                {
-                    PetEatEquipConfig eatEquipConfig = PetEatEquipConfig.GetEquipColorAndEquipClass(model.config.ItemColor, model.config.LV);
-                    if (eatEquipConfig == null) return false;
-
-                    if (ItemLogicUtility.Instance.IsFightUp(model.itemId, model.equipScore) != 1)
-                    {
-                        if (model.config.ItemColor <= (int)colorType
-                            && model.config.LV <= (int)lvType
-                            && model.config.StarLevel <= (int)starType)
-                        {
-                            return true;
-                        }
-                    }
-                }
-            }
-
-            return false;
-        }
-
-        public bool IsMaxDecomLv(int decomLv, out int realLv)
-        {
-            realLv = decomLv;
-            List<EquipDeComposeConfig> decomlist = EquipDeComposeConfig.GetValues();
-            if (decomLv > decomlist[decomlist.Count - 1].LV)
-            {
-                realLv = decomlist[decomlist.Count - 1].LV;
-                return true;
-            }
-
-            return false;
-        }
-
-
-        public List<ItemModel> selectDevourlist = new List<ItemModel>();
-        public void GetSelectDevourList()
-        {
-            selectDevourlist.Clear();
-            List<ItemModel> itemModels = GetCanDevourModellist();
-            if (itemModels != null)
-            {
-                selectDevourlist.AddRange(itemModels);
-            }
-        }
-
-        public void RefreshGetNewItem(ItemModel model)
-        {
-            if (model == null) return;
-
-            if (CheckIsReachDevourCondi(model))
-            {
-                selectDevourlist.Add(model);
-                if (RefreshEquipDecomNumAct != null)
-                {
-                    RefreshEquipDecomNumAct();
-                }
-            }
-        }
-
-        public void AddSelectDevourModellist(ItemModel model)
-        {
-            selectDevourlist.Add(model);
-            if (RefreshEquipDecomNumAct != null)
-            {
-                RefreshEquipDecomNumAct();
-            }
-        }
-
-        public bool CheckIsReachDevourCondi(ItemModel model)
-        {
-            if (model.config.Type == 29)
-            {
-                if (!defaultUnSelectlist.Contains(model.itemId))
-                {
-                    return true;
-                }
-                return false;
-            }
-            else
-            {
-                if (IsCanDevour(model))
-                {
-                    return true;
-                }
-
-            }
-            return false;
-        }
-
-        public void RemoveSelectDevourModellist(ItemModel model)
-        {
-            if (selectDevourlist.Contains(model))
-            {
-                selectDevourlist.Remove(model);
-            }
-            if (RefreshEquipDecomNumAct != null)
-            {
-                RefreshEquipDecomNumAct();
-            }
-        }
-
-        public Dictionary<int, int> GetDecomAttrDictByLv(int decomLv)
-        {
-            if (decomposeAttrDict.ContainsKey(decomLv))
-            {
-                return decomposeAttrDict[decomLv];
-            }
-
-            return null;
-        }
-
-        public bool IsReachMinDecomposeNum()
-        {
-            List<ItemModel> itemModels = GetCanDevourModellist();
-            if (itemModels != null && itemModels.Count >= minDecomposeNum)
-            {
-                return true;
-            }
-            return false;
-        }
-
-        public void SendEquipdevourQuest()
-        {
-            List<ItemModel> itemModels = GetCanDevourModellist();
-            if (itemModels == null || itemModels.Count < minDecomposeNum || !ItemLogicUtility.Instance.isPackResetOk || SettingEffectMgr.Instance.isStartDecompose) return;
-
-            SettingEffectMgr.Instance.isStartDecompose = true;
-            isAutoDecompose = true;
-            recordAutoDecomNum = itemModels.Count;
-            CA32C_tagCMEquipDecompose _petEat = new CA32C_tagCMEquipDecompose();
-            var _petIndex = new ushort[recordAutoDecomNum];
-            var idlist = new uint[recordAutoDecomNum];
-            for (int i = 0; i < recordAutoDecomNum; i++)
-            {
-                _petIndex[i] = (ushort)itemModels[i].itemPlace;
-                idlist[i] = (uint)itemModels[i].itemId;
-                if (itemModels[i].config.StarLevel >= 2
-                    || (itemModels[i].config.EquipPlace == 0 && itemModels[i].config.Type != 29))
-                {
-                    return;
-                }
-            }
-            _petEat.Count = (byte)_petIndex.Length;
-            _petEat.IndexList = _petIndex;
-            _petEat.ItemIDList = idlist;
-            _petEat.IsAuto = 1;
-            GameNetSystem.Instance.SendInfo(_petEat);
-        }
-
-        public void SendEquipDevourRecordQuest()
-        {
-            string record = StringUtility.Contact((int)colorType + 1, (int)lvType + 1, (int)starType + 1);
-            CA32D_tagCMDecomposeSeting decomSet = new CA32D_tagCMDecomposeSeting();
-            decomSet.Seting = uint.Parse(record);
-            GameNetSystem.Instance.SendInfo(decomSet);
-        }
-        public int decomposeLv { get; private set; }
-        public int decomposeExp { get; private set; }
-        public int decomposeProgress { get; private set; }
-        public int addDecomposeExp { get; private set; }
-        public int minDecomposeNum { get; private set; }
-        public bool isAutoDecompose { get; set; }
-        public int recordAutoDecomNum { get; private set; }
-        public DecomposeGetMatInfo[] getItems { get; private set; }
-
-        public event Action RefreshDecomAttrAct;
-        public void GetServerDecomposeSet(HA31C_tagMCEquipDecomposeInfo info)
-        {
-            addDecomposeExp = 0;
-            int realLv = info.LV + 1;
-            bool isMax = IsMaxDecomLv(realLv, out realLv);
-            if (realLv == decomposeLv)
-            {
-                addDecomposeExp = (int)info.Exp - decomposeExp;
-            }
-            else
-            {
-                for (int i = decomposeLv; i <= realLv; i++)
-                {
-                    EquipDeComposeConfig deComposeConfig = EquipDeComposeConfig.Get(i);
-                    if (i == decomposeLv)
-                    {
-                        addDecomposeExp = deComposeConfig.UpNeedExp - decomposeExp;
-                    }
-                    else if (i == realLv)
-                    {
-                        addDecomposeExp += (int)info.Exp;
-                    }
-                    else
-                    {
-                        addDecomposeExp += deComposeConfig.UpNeedExp;
-                    }
-                }
-            }
-
-            decomposeLv = realLv;
-            decomposeExp = (int)info.Exp;
-            decomposeProgress = info.DecomposeCnt;
-            getItems = JsonMapper.ToObject<DecomposeGetMatInfo[]>(info.GetItemData);
-
-            if (info.Seting != 0)
-            {
-                string decomSetStr = info.Seting.ToString();
-                string colorStr = decomSetStr.Substring(0, 1);
-                colorType = (EquipColorType)(int.Parse(colorStr) - 1);
-                starType = (EquipStarType)((int)info.Seting % 10 - 1);
-                string lvStr = decomSetStr.Substring(1, decomSetStr.Length - 2);
-                lvType = (EquipLvType)(int.Parse(lvStr) - 1);
-            }
-            if (RefreshDecomAttrAct != null)
-            {
-                RefreshDecomAttrAct();
-            }
-        }
-        /// <summary>
-        /// 璁剧疆鑾峰緱鐐间腹鏉愭枡鐨勫睍绀烘暟鎹�
-        /// </summary>
-        /// <param name="getMatInfos"></param>
-        /// <returns></returns>
-        private List<DecomposeGetMatInfo> getMatInfos = new List<DecomposeGetMatInfo>();
-        public List<DecomposeGetMatInfo> SetShowMatInfo()
-        {
-            getMatInfos.Clear();
-            int sumMatCnt = 0;
-            if (getItems != null)
-            {
-                for (int i = 0; i < getItems.Length; i++)
-                {
-                    if (getItems[i].Count > 0)
-                    {
-                        sumMatCnt += getItems[i].Count;
-                    }
-                    else
-                    {
-                        sumMatCnt += 1;
-                    }
-                }
-            }
-
-            if (sumMatCnt > 5)
-            {
-                for (int i = 0; i < getItems.Length; i++)
-                {
-                    getMatInfos.Add(getItems[i]);
-                }
-            }
-            else
-            {
-                if (getItems != null)
-                {
-                    for (int i = 0; i < getItems.Length; i++)
-                    {
-                        if (getItems[i].Count > 0)
-                        {
-                            for (int j = 0; j < getItems[i].Count; j++)
-                            {
-                                DecomposeGetMatInfo matInfo = new DecomposeGetMatInfo();
-                                matInfo.ItemID = getItems[i].ItemID;
-                                matInfo.Count = 1;
-                                matInfo.IsBind = getItems[i].IsBind;
-                                matInfo.IsSuite = getItems[i].IsSuite;
-                                matInfo.UserData = getItems[i].UserData;
-                                getMatInfos.Add(matInfo);
-                            }
-                        }
-                        else
-                        {
-                            getMatInfos.Add(getItems[i]);
-                        }
-                    }
-                }
-            }
-            return getMatInfos;
-        }
-
-        public enum EquipColorType
-        {
-            None = 0,
-            Purple = 3,
-            Orange = 4,
-            Red = 5,
-            All = 10,
-        }
-
-        public enum EquipLvType
-        {
-            None = 0,
-            One,
-            Two,
-            Three,
-            Four,
-            Five,
-            Six,
-            Seven,
-            Eight,
-            Nine,
-            Ten,
-            Eleven,
-            Twelve,
-            Thirteen,
-            Fourteen,
-            Fifteen,
-            All,
-        }
-
-        public enum EquipStarType
-        {
-            None = 0,
-            One,
-            Two,
-            Three,
-            All,
-        }
-
-        public class DecomposeGetMatInfo
-        {
-            public int ItemID;
-            public int Count;
-            public int IsBind;
-            public int IsSuite;
-            public string UserData;
-        }
-        #endregion
-
-        #region 涓硅嵂閫昏緫澶勭悊
-
-        private int CompareMakeDrug(AttrFruitConfig start, AttrFruitConfig end)
-        {
-            ItemConfig configS = ItemConfig.Get(start.ID);
-            ItemConfig configE = ItemConfig.Get(end.ID);
-            if (configS.RealmLimit.CompareTo(configE.RealmLimit) != 0)
-            {
-                return configS.RealmLimit.CompareTo(configE.RealmLimit);
-            }
-            if (configS.LV.CompareTo(configE.LV) != 0)
-            {
-                return configS.LV.CompareTo(configE.LV);
-            }
-
-            int x = makeDruglist.IndexOf(start);
-            int y = makeDruglist.IndexOf(end);
-            if (x.CompareTo(y) != 0) x.CompareTo(y);
-
-            return 0;
-        }
-
-        List<AttrFruitConfig> drugOrderlist = new List<AttrFruitConfig>();
-        List<AttrFruitConfig> haveDruglist = new List<AttrFruitConfig>();
-        public List<AttrFruitConfig> GetDrugOrderByCnt()
-        {
-            drugOrderlist.Clear();
-            haveDruglist.Clear();
-            drugOrderlist.AddRange(makeDruglist);
-            drugOrderlist.Sort(CompareByIsHave);
-            for (int i = 0; i < drugOrderlist.Count; i++)
-            {
-                if (IsHaveDrugUse(drugOrderlist[i]))
-                {
-                    haveDruglist.Add(drugOrderlist[i]);
-                }
-            }
-            haveDruglist.Sort(CompareMakeDrug);
-            for (int i = 0; i < haveDruglist.Count; i++)
-            {
-                drugOrderlist[i] = haveDruglist[i];
-            }
-
-            return drugOrderlist;
-        }
-
-        public bool CheckIsDrugById(int itemId)
-        {
-            for (int i = 0; i < makeDruglist.Count; i++)
-            {
-                if (makeDruglist[i].ID == itemId)
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-
-        public int CompareByIsHave(AttrFruitConfig start, AttrFruitConfig end)
-        {
-            bool isHaveStart = IsHaveDrugUse(start);
-            bool isHaveEnd = IsHaveDrugUse(end);
-            if (isHaveStart.CompareTo(isHaveEnd) != 0) return -isHaveStart.CompareTo(isHaveEnd);
-
-            //isHaveStart = IsHaveDrugRecycle(start);
-            //isHaveEnd = IsHaveDrugRecycle(end);
-            //if (isHaveStart.CompareTo(isHaveEnd) != 0) return -isHaveStart.CompareTo(isHaveEnd);
-
-            isHaveStart = GetItemCountByID(PackType.Item, start.ID) > 0 ? true : false;
-            isHaveEnd = GetItemCountByID(PackType.Item, end.ID) > 0 ? true : false;
-            if (isHaveStart.CompareTo(isHaveEnd) != 0) return isHaveStart.CompareTo(isHaveEnd);
-
-            isHaveStart = IsReachMaxUseDrug(start);
-            isHaveEnd = IsReachMaxUseDrug(end);
-            if (isHaveStart.CompareTo(isHaveEnd) != 0) return isHaveStart.CompareTo(isHaveEnd);
-
-            int x = makeDruglist.IndexOf(start);
-            int y = makeDruglist.IndexOf(end);
-            if (x.CompareTo(y) != 0) return x.CompareTo(y);
-            return 0;
-        }
-
-        public bool IsHaveDrugUse(AttrFruitConfig fruitConfig)
-        {
-            if (!IsReachMaxUseDrug(fruitConfig))
-            {
-                return GetItemCountByID(PackType.Item, fruitConfig.ID) > 0 ? true : false;
-            }
-
-            return false;
-        }
-
-        public bool IsHaveDrugRecycle(AttrFruitConfig fruitConfig)
-        {
-            if (IsReachMaxUseDrug(fruitConfig))
-            {
-                return GetItemCountByID(PackType.Item, fruitConfig.ID) > 0 ? true : false;
-            }
-            return false;
-        }
-
-        public bool IsReachMaxUseDrug(AttrFruitConfig fruitConfig)
-        {
-            if (fruitConfig == null) return false;
-
-            int useNum = GetItemTotalUsedTimes(fruitConfig.ID);
-            if (useNum >= fruitConfig.MaxUseCnt)
-            {
-                return true;
-            }
-            return false;
-        }
-
-        List<AttrFruitConfig> limitlist = new List<AttrFruitConfig>();
-        public float GetAlchemyProgress(AlchemyConfig alchemy)
-        {
-            var previewDanlist = FurnaceModel.GetPreviewIdlist(alchemy);
-            float progress = 0;
-            limitlist.Clear();
-            for (int i = 0; i < previewDanlist.Count; i++)
-            {
-                AttrFruitConfig fruitConfig = AttrFruitConfig.Get(previewDanlist[i]);
-                if (fruitConfig != null)
-                {
-                    limitlist.Add(fruitConfig);
-                }
-            }
-
-            for (int i = 0; i < limitlist.Count; i++)
-            {
-                progress += ((float)1 / limitlist.Count) * ((float)GetItemTotalUsedTimes(limitlist[i].ID) / limitlist[i].MaxUseCnt);
-            }
-            return progress * 100;
-        }
-        #endregion
-    }
-}
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using LitJson;
+
+namespace Snxxz.UI
+{
+    [XLua.LuaCallCSharp]
+    public class PackModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk
+    {
+        public static string StrengthAttrShift_RecordKey = "";
+        public const string RecordKnapsackTitle = "RecordKnapsackTitle";
+
+        Dictionary<int, int> DrugToDungeonDict { get; set; }   //key 涓硅嵂ID,value鍓湰ID
+        Dictionary<int, int[]> DungeonToDrugDict { get; set; }  //key 鍓湰ID,value涓硅嵂ID鍒楄〃
+        public List<AttrFruitConfig> makeDruglist { get; private set; }
+        Dictionary<int, Dictionary<int, int>> decomposeAttrDict = new Dictionary<int, Dictionary<int, int>>();
+        string RoleEquipLocalSave = "";
+        List<int> LocalSavePlaceArray { get; set; }
+        Dictionary<int, List<int>> sharedUseCountItemDict { get; set; }
+        bool isUpdatePlayerLv = false;
+
+        BlastFurnaceModel FurnaceModel { get { return ModelCenter.Instance.GetModel<BlastFurnaceModel>(); } }
+
+        public override void Init()
+        {
+            ParseConfig();
+            List<DungeonOpenTimeConfig> dungeonlist = DungeonOpenTimeConfig.GetValues();
+            if (dungeonlist != null)
+            {
+                DrugToDungeonDict = new Dictionary<int, int>();
+                DungeonToDrugDict = new Dictionary<int, int[]>();
+
+                for (int i = 0; i < dungeonlist.Count; i++)
+                {
+                    int[] drugIdlist = dungeonlist[i].ElixirHint;
+                    if (drugIdlist != null && drugIdlist.Length > 0)
+                    {
+                        DungeonToDrugDict.Add(dungeonlist[i].DataMapID, drugIdlist);
+                        for (int j = 0; j < drugIdlist.Length; j++)
+                        {
+                            DrugToDungeonDict.Add(drugIdlist[j], dungeonlist[i].DataMapID);
+                        }
+                    }
+                }
+            }
+
+            makeDruglist = new List<AttrFruitConfig>();
+            List<AttrFruitConfig> fruitlist = AttrFruitConfig.GetValues();
+            for (int i = 0; i < fruitlist.Count; i++)
+            {
+                if (fruitlist[i].FuncID == 2)
+                {
+                    makeDruglist.Add(fruitlist[i]);
+                }
+            }
+            StageLoad.Instance.onStageLoadFinish += OnStageLoadFinish;
+
+            SetDevourEquipPlace();
+
+            decomposeAttrDict.Clear();
+            List<EquipDeComposeConfig> decomlist = EquipDeComposeConfig.GetValues();
+            for (int i = 0; i < decomlist.Count; i++)
+            {
+                JsonData attrData = JsonMapper.ToObject(decomlist[i].Attr);
+                Dictionary<int, int> attrDict = new Dictionary<int, int>();
+                decomposeAttrDict.Add(decomlist[i].LV, attrDict);
+                foreach (var id in attrData.Keys)
+                {
+                    attrDict.Add(int.Parse(id), int.Parse(attrData[id].ToString()));
+                }
+            }
+
+            FuncConfigConfig equipDecompose = FuncConfigConfig.Get("EquipDevourCount");
+            minDecomposeNum = int.Parse(equipDecompose.Numerical1);
+            defaultUnSelectlist = ConfigParse.GetMultipleStr<int>(equipDecompose.Numerical2);
+
+            FuncConfigConfig ShareUseCntItem = FuncConfigConfig.Get("ShareUseCntItem");
+            sharedUseCountItemDict = new Dictionary<int, List<int>>();
+            JsonData shareUseJson = JsonMapper.ToObject(ShareUseCntItem.Numerical1);
+            if (shareUseJson.IsArray)
+            {
+                for (int i = 0; i < shareUseJson.Count; i++)
+                {
+                    var idListJson = shareUseJson[i];
+                    var idlist = new List<int>();
+                    sharedUseCountItemDict.Add(i, idlist);
+                    foreach (var id in idListJson)
+                    {
+                        idlist.Add(int.Parse(id.ToString()));
+                    }
+                }
+            }
+
+            SetRoleEquipRedpoint();
+        }
+
+        public void OnBeforePlayerDataInitialize()
+        {
+            GlobalTimeEvent.Instance.secondEvent -= UpdateSecond;
+            PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= UpdatePlayerLv;
+            LocalSave.DeleteKey(RecordKnapsackTitle);
+            cacheMapId = 0;
+            playerPackDict.Clear();
+            itemDayUseCntDict.Clear();
+            itemSumUseCntDict.Clear();
+            itemGUIDDict.Clear();
+            showDropItem = false;
+            isPlayBetterEquipEffect = false;
+            equipAttrActiveDict.Clear();
+            colorType = EquipColorType.Purple;
+            lvType = EquipLvType.All;
+            starType = EquipStarType.None;
+            decomposeLv = 1;
+            decomposeExp = 0;
+            decomposeProgress = 0;
+            isAutoDecompose = false;
+        }
+
+        public void OnAfterPlayerDataInitialize()
+        {
+
+        }
+
+        public void OnPlayerLoginOk()
+        {
+            ItemOperateUtility.Instance.RequestWarehouseData();
+            SetPlayerAttrActiveRedPoint();
+            EquipDecomRedCtrl();
+            RoleEquipLocalSave = StringUtility.Contact("RoleEquipLocalSave", PlayerDatas.Instance.baseData.PlayerID);
+            StrengthAttrShift_RecordKey = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "StrengthAttrShift");
+            if (LocalSave.GetIntArray(RoleEquipLocalSave) != null)
+            {
+                LocalSavePlaceArray = LocalSave.GetIntArray(RoleEquipLocalSave).ToList();
+            }
+            else
+            {
+                LocalSavePlaceArray = null;
+            }
+            GlobalTimeEvent.Instance.secondEvent += UpdateSecond;
+            PlayerDatas.Instance.PlayerDataRefreshInfoEvent += UpdatePlayerLv;
+            isUpdatePlayerLv = true;
+        }
+
+        public override void UnInit()
+        {
+
+        }
+
+        ItemTipsModel itemTipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
+
+        public event Action<PackType> refrechPackEvent; //鍒锋柊鏁翠釜鑳屽寘鏁版嵁
+        public event Action<PackType, int, int> refreshItemCountEvent; //锛堝崟涓級鏈�鏂扮墿鍝佹暟閲忓埛鏂�(鏃х殑寮冪敤)鍦ㄥ緱鍒版柊鐗╁搧銆佺墿鍝佹暟閲忕殑鏀瑰彉锛屾竻鐞嗚鐗╁搧鏃跺潎浼氳Е鍙� int 浣嶇疆绱㈠紩 int鐗╁搧id
+        public event Action<PackType> gridRefreshEvent; //鑳屽寘绌烘牸鍒锋柊
+        public event Action<PackType, int, int> itemCntAddEvent; //鐗╁搧鏁伴噺澧炲姞 int 浣嶇疆绱㈠紩 int鐗╁搧id
+        public event Action<PackType, int, int> itemCntReduceEvent; //鐗╁搧鏁伴噺鍑忓皯鐨勬敼鍙� int 浣嶇疆绱㈠紩 int鐗╁搧id
+        public event Action<int, int> useItemSuccessEvent; //鐗╁搧浣跨敤鎴愬姛 int 浣嶇疆绱㈠紩 int鐗╁搧id
+
+        public event Action<int> refreshItemDayUseCountEvent;  //鍒锋柊鐗╁搧姣忔棩浣跨敤鏁伴噺
+        public event Action<int> refreshItemSumUseCountEvent;  //鍒锋柊鐗╁搧鎬讳娇鐢ㄦ暟閲�
+
+        public bool isPlayBetterEquipEffect { get; set; }  //鏁寸悊鑳屽寘鏃舵槸鍚︽挱鏀剧壒鏁�
+
+        #region 鎺ユ敹鏈嶅姟绔暟鎹�
+        bool showDropItem = false;
+        private Dictionary<PackType, SinglePack> playerPackDict = new Dictionary<PackType, SinglePack>();
+        private Dictionary<string, ItemModel> itemGUIDDict = new Dictionary<string, ItemModel>();
+
+        public void UpdatePack(H0725_tagRolePackRefreshEx packInfo)
+        {
+            showDropItem = false;
+            SetLookIndex(null);
+            var packType = (PackType)packInfo.PackType;
+            if (!playerPackDict.ContainsKey(packType))
+            {
+                playerPackDict.Add(packType, new SinglePack(packType));
+            }
+
+            if (isPlayBetterEquipEffect)
+            {
+                ItemLogicUtility.Instance.ClearSortedBetterEquip();
+            }
+
+            for (int i = 0; i < packInfo.ItemCount; i++)
+            {
+                var itemInfo = new ItemInfo(packInfo.ItemInfo[i]);
+                var item = playerPackDict[packType].UpdateItem(itemInfo);
+                AddItemGUIDDict(item);
+
+                if (isPlayBetterEquipEffect)
+                {
+                    ItemLogicUtility.Instance.SetBagSortBetterEquipList(GetItemByGuid(itemInfo.guid));
+                }
+            }
+
+            if (refrechPackEvent != null)
+            {
+                refrechPackEvent(packType);
+            }
+
+            UpdatePackRedpoint(packType);
+        }
+
+        public void UpdateItem(H0704_tagRolePackRefresh serverItem)
+        {
+            isPlayBetterEquipEffect = false;
+            SetLookIndex(null);
+            showDropItem = true;
+            PackType type = (PackType)serverItem.PackType;
+            if (!playerPackDict.ContainsKey(type))
+            {
+                playerPackDict.Add(type, new SinglePack(type));
+            }
+
+            var itemInfo = new ItemInfo(serverItem);
+            var item = playerPackDict[type].UpdateItem(itemInfo);
+            AddItemGUIDDict(item);
+
+            if (refreshItemCountEvent != null)
+            {
+                refreshItemCountEvent(type, itemInfo.index, itemInfo.itemId);
+            }
+
+            if (itemCntAddEvent != null)
+            {
+                itemCntAddEvent(type, itemInfo.index, itemInfo.itemId);
+            }
+
+            if (type == PackType.Equip)
+            {
+                SetPlayerAttrActiveRedPoint();
+            }
+
+            UpdatePackRedpoint(type);
+            EquipDecomRedCtrl();
+        }
+
+        public void UpdateUnlockedGridCount(H0724_tagRolePackCanUseCount useCount)
+        {
+            PackType type = (PackType)useCount.PackType;
+            if (!playerPackDict.ContainsKey(type))
+            {
+                playerPackDict.Add(type, new SinglePack(type));
+            }
+
+            playerPackDict[type].SetOpenGridCount(useCount.CanUseCount);
+
+            if (gridRefreshEvent != null)
+            {
+                gridRefreshEvent(type);
+            }
+
+            UpdatePackRedpoint(type);
+        }
+
+        public void RefreshItemCount(H0707_tagItemCountRefresh refresh)
+        {
+            SetLookIndex(null);
+            isPlayBetterEquipEffect = false;
+            PackType type = (PackType)refresh.PackType;
+            SinglePack singlePack = null;
+            playerPackDict.TryGetValue(type, out singlePack);
+            if (singlePack != null)
+            {
+                ItemModel itemModel = singlePack.GetItemByIndex(refresh.ItemIndex);
+                if (itemModel != null)
+                {
+                    bool isAddItemCount = false;
+                    if (refresh.ItemCount > itemModel.count)
+                    {
+                        isAddItemCount = true;
+                    }
+                    itemModel.RefreshItemCount(refresh.ItemCount);
+
+                    if (isAddItemCount)
+                    {
+                        if (itemCntAddEvent != null)
+                        {
+                            itemCntAddEvent(type, itemModel.itemPlace, itemModel.itemId);
+                        }
+                        ItemLogicUtility.Instance.RecommendItem(itemModel);
+                        ItemLogicUtility.Instance.RefreshPickItem(type, itemModel.guid);
+                    }
+                    else
+                    {
+                        if (itemCntReduceEvent != null)
+                        {
+                            itemCntReduceEvent(type, itemModel.itemPlace, itemModel.itemId);
+                        }
+                    }
+
+                    if (refreshItemCountEvent != null)
+                    {
+                        refreshItemCountEvent(type, itemModel.itemPlace, itemModel.itemId);
+                    }
+                }
+            }
+
+        }
+
+        public void ClearPack(H0711_tagClearItemPack clearPack)
+        {
+            PackType type = (PackType)clearPack.PackIndex;
+            SinglePack singlePack = null;
+            playerPackDict.TryGetValue(type, out singlePack);
+            if (singlePack != null)
+            {
+                singlePack.Clear();
+            }
+
+            if (type == PackType.Equip)
+            {
+                SetPlayerAttrActiveRedPoint();
+            }
+            //if (RefreshPackAct != null)
+            //{
+            //    RefreshPackAct(type);
+            //}
+
+            //RedPointPackCtrl(type);
+        }
+
+        public void RemoveItem(H0709_tagClearItem clearItem)
+        {
+            isPlayBetterEquipEffect = false;
+            SetLookIndex(null);
+            PackType type = (PackType)clearItem.PackType;
+
+            SinglePack singlePack = null;
+            playerPackDict.TryGetValue(type, out singlePack);
+            string guid = "";
+            if (singlePack != null)
+            {
+                ItemModel itemModel = singlePack.GetItemByIndex(clearItem.ItemIndex);
+                guid = itemModel.guid;
+                int itemId = itemModel.itemId;
+                DeleteItemDictByGUID(type, itemModel.guid);
+                singlePack.RemoveItem(clearItem.ItemIndex);
+                if (refreshItemCountEvent != null)
+                {
+                    refreshItemCountEvent(type, clearItem.ItemIndex, itemId);
+                }
+
+                if (itemCntReduceEvent != null)
+                {
+                    itemCntReduceEvent(type, clearItem.ItemIndex, itemId);
+                }
+            }
+            if (type == PackType.Equip)
+            {
+                SetPlayerAttrActiveRedPoint();
+            }
+            UpdatePackRedpoint(type);
+            EquipDecomRedCtrl();
+
+            if (GetItemByGuid(guid) == null)
+            {
+                KnapsackTimeCDMgr.Instance.UnRegister(guid);
+            }
+
+        }
+
+        public void PackResetOk(H0316_tagPackResetOK packreset)
+        {
+            ItemLogicUtility.Instance.isPackResetOk = true;
+        }
+
+        public void UseItemSuccess(H0706_tagUseItemSuccess success)
+        {
+            isPlayBetterEquipEffect = false;
+            SetLookIndex(null);
+            if (success.PlayerID != PlayerDatas.Instance.baseData.PlayerID)
+                return;
+
+            ItemConfig itemConfig = ItemConfig.Get((int)success.ItemID);
+            MakeUseItemSuccess(success.ItemIndex, (int)success.ItemID);
+
+            switch (success.ItemID)
+            {
+                case 221:
+                    if (WindowCenter.Instance.IsOpen<KnapSackWin>())
+                    {
+                        WindowCenter.Instance.Close<KnapSackWin>();
+                    }
+                    break;
+            }
+
+            if (useItemSuccessEvent != null)
+            {
+                useItemSuccessEvent(success.ItemIndex, (int)success.ItemID);
+            }
+        }
+
+        private void MakeUseItemSuccess(int index, int id)
+        {
+            ItemConfig itemConfig = ItemConfig.Get(id);
+            if (itemConfig.CDType != 0)
+            {
+                float configCdTime = (float)Math.Round((double)itemConfig.CDTime / 1000, 1);
+                var items = GetSinglePack(PackType.Item).GetItemsByType((int)ItemType.Buff);
+                for (int i = 0; i < items.Count; i++)
+                {
+                    if (items[i].itemId == 901
+                        || items[i].itemId == 902
+                        || items[i].itemId == 903
+                        || items[i].itemId == 904)
+                    {
+                        KnapsackTimeCDMgr.Instance.Register(items[i].guid, items[i].itemId, configCdTime);
+                        break;
+                    }
+                }
+
+            }
+        }
+
+        void AddItemGUIDDict(ItemModel itemModel)
+        {
+            if (!itemGUIDDict.ContainsKey(itemModel.guid))
+            {
+                itemGUIDDict.Add(itemModel.guid, itemModel);
+                GetItemEventCtrl(itemModel);
+            }
+            else
+            {
+                PackType prePack = itemGUIDDict[itemModel.guid].packType;
+                itemGUIDDict[itemModel.guid] = itemModel;
+                if (prePack != itemModel.packType)
+                {
+                    GetItemEventCtrl(itemModel);
+                }
+            }
+        }
+
+        void DeleteItemDictByGUID(PackType type, string guid)
+        {
+
+            if (itemGUIDDict.ContainsKey(guid))
+            {
+                if (itemGUIDDict[guid].packType == type)
+                {
+                    itemGUIDDict.Remove(guid);
+                }
+            }
+        }
+
+        /// <summary>
+        /// 鐗╁搧姣忔棩浣跨敤鐨勬鏁�
+        /// </summary>
+        private Dictionary<int, int> itemDayUseCntDict = new Dictionary<int, int>();
+        public void UpdateItemUseCnt(HA809_tagMCItemDayUseCntInfo useCntInfo)
+        {
+            for (int i = 0; i < useCntInfo.Count; i++)
+            {
+                int itemId = (int)useCntInfo.ItemUseCntList[i].ItemID;
+                int cnt = useCntInfo.ItemUseCntList[i].UseCnt;
+                if (!itemDayUseCntDict.ContainsKey(itemId))
+                {
+                    itemDayUseCntDict.Add(itemId, cnt);
+                }
+                else
+                {
+                    itemDayUseCntDict[itemId] = cnt;
+                }
+
+                if (refreshItemDayUseCountEvent != null)
+                {
+                    refreshItemDayUseCountEvent(itemId);
+                }
+
+            }
+        }
+
+        private Dictionary<int, int> itemSumUseCntDict = new Dictionary<int, int>();
+        public void UpdateItemSumUseCnt(HA339_tagMCAttrFruitEatCntList useCntInfo)
+        {
+            for (int i = 0; i < useCntInfo.count; i++)
+            {
+                int itemId = (int)useCntInfo.EatCntList[i].ItemID;
+                int cnt = useCntInfo.EatCntList[i].EatCnt;
+                if (!itemSumUseCntDict.ContainsKey(itemId))
+                {
+                    itemSumUseCntDict.Add(itemId, cnt);
+                }
+                else
+                {
+                    itemSumUseCntDict[itemId] = cnt;
+                }
+
+                if (refreshItemSumUseCountEvent != null)
+                {
+                    refreshItemSumUseCountEvent(itemId);
+                }
+
+            }
+        }
+
+        #region 鎺ユ敹鍏ㄨ韩鏄熺骇锛屽己鍖栧睘鎬ф縺娲�
+        public event Action RefreshActiveAttrAct;
+        private Dictionary<int, int> equipAttrActiveDict = new Dictionary<int, int>();
+        public void UpdatePlayerEquipAttrActiveInfo(HA317_tagMCAllEquipAttrActiveInfo info)
+        {
+            for (int i = 0; i < info.Count; i++)
+            {
+                int type = info.ActiveInfo[i].Type;
+                int cnt = (int)info.ActiveInfo[i].Cnt;
+                if (type == 1)
+                {
+                    cnt = RoleEquipStarsConfig.GetActiveStars(cnt);
+                }
+                if (!equipAttrActiveDict.ContainsKey(type))
+                {
+                    equipAttrActiveDict.Add(type, cnt);
+                }
+                else
+                {
+                    equipAttrActiveDict[type] = cnt;
+                }
+            }
+
+            if (RefreshActiveAttrAct != null)
+            {
+                RefreshActiveAttrAct();
+            }
+
+            SetPlayerAttrActiveRedPoint();
+        }
+
+        public void SendActiveAttrQuest(int type, int cnt)
+        {
+            var equipAttr = new CA503_tagCMActiveAllEquipAttr();
+            equipAttr.Type = (byte)type;
+            equipAttr.Cnt = (uint)cnt;
+            GameNetSystem.Instance.SendInfo(equipAttr);
+        }
+
+        public int GetActiveCntByType(int type)
+        {
+            int cnt = 0;
+            equipAttrActiveDict.TryGetValue(type, out cnt);
+            return cnt;
+        }
+
+        public List<int> GetAddAttrIdByStars(int _curStarsCount, out int starsCount)
+        {
+            starsCount = 0;
+            List<int> activeIdlist = new List<int>();
+            List<int> addIdlist = new List<int>();
+            List<int> starslist = RoleEquipStarsConfig.GetEquipStarsCntlist();
+            if (starslist == null || starslist.Count < 1) return addIdlist;
+            int activeStars = GetActiveCntByType(1);
+            int realActiveStars = _curStarsCount > activeStars ? activeStars : _curStarsCount;
+            for (int i = starslist.Count - 1; i > -1; i--)
+            {
+                if (i == 0 && starslist[i] > realActiveStars)
+                {
+                    realActiveStars = 0;
+                    break;
+                }
+                if (starslist[i] <= realActiveStars)
+                {
+                    realActiveStars = starslist[i];
+                    break;
+                }
+            }
+
+            RoleEquipStarsConfig activeStarsConfig = RoleEquipStarsConfig.GetEquipStarsModel(realActiveStars);
+            if (activeStarsConfig != null)
+            {
+                for (int i = 0; i < activeStarsConfig.attType.Length; i++)
+                {
+                    activeIdlist.Add(activeStarsConfig.attType[i]);
+                }
+            }
+            List<RoleEquipStarsConfig> starsConfigs = RoleEquipStarsConfig.GetValues();
+            for (int i = 0; i < starsConfigs.Count; i++)
+            {
+                bool isAddId = false;
+                RoleEquipStarsConfig starsConfig = starsConfigs[i];
+                if (realActiveStars < starsConfig.countNeed)
+                {
+                    for (int j = 0; j < starsConfig.attType.Length; j++)
+                    {
+                        int attrId = starsConfig.attType[j];
+                        if (!activeIdlist.Contains(attrId))
+                        {
+                            isAddId = true;
+                            addIdlist.Add(attrId);
+                        }
+                    }
+                }
+                if (isAddId)
+                {
+                    starsCount = starsConfig.countNeed;
+                    break;
+                }
+
+            }
+            return addIdlist;
+        }
+        #endregion
+
+        #endregion
+
+        #region 鐜╁瑁呭鐗规畩閫昏緫
+        public int fairyRedPointLvlimt { get; private set; }
+        public int wingsRedpointLvlimt { get; private set; }
+        public int fairyGetPathId { get; private set; }
+        public Dictionary<int, int> wingsGetPathIdDict { get; private set; }
+        public Dictionary<int, List<int>> dungeonUseDict { get; private set; }
+        void ParseConfig()
+        {
+            FuncConfigConfig funcConfig = FuncConfigConfig.Get("WingYuPeiHQTJ");
+            fairyRedPointLvlimt = int.Parse(funcConfig.Numerical1);
+            wingsRedpointLvlimt = int.Parse(funcConfig.Numerical2);
+            fairyGetPathId = int.Parse(funcConfig.Numerical3);
+            wingsGetPathIdDict = ConfigParse.GetDic<int, int>(funcConfig.Numerical4);
+            FuncConfigConfig copyItemBulletWindow = FuncConfigConfig.Get("CopyItemBulletWindow");
+            JsonData copyWinData = JsonMapper.ToObject(copyItemBulletWindow.Numerical1);
+            dungeonUseDict = new Dictionary<int, List<int>>();
+            foreach (var dungeonId in copyWinData.Keys)
+            {
+                List<int> idlist = new List<int>();
+                dungeonUseDict.Add(int.Parse(dungeonId), idlist);
+                if (copyWinData[dungeonId].IsArray)
+                {
+                    JsonData useData = copyWinData[dungeonId];
+                    for (int i = 0; i < useData.Count; i++)
+                    {
+                        idlist.Add(int.Parse(useData[i].ToString()));
+                    }
+                }
+            }
+        }
+
+        public int GetRoleEquipPathId(int equipPlace)
+        {
+            int playerJob = PlayerDatas.Instance.baseData.Job;
+            switch ((RoleEquipType)equipPlace)
+            {
+                case RoleEquipType.FairyCan:
+                case RoleEquipType.FairyCan2:
+                    return fairyGetPathId;
+                case RoleEquipType.Wing:
+                    if (wingsGetPathIdDict.ContainsKey(playerJob))
+                    {
+                        return wingsGetPathIdDict[playerJob];
+                    }
+                    break;
+            }
+            return 0;
+        }
+
+        private void UpdateSecond()
+        {
+            if (isUpdatePlayerLv)
+            {
+                for (int i = 1; i < 13; i++)
+                {
+                    CheckRoleEquipByPlace((RoleEquipType)i);
+                }
+                UpdateRoleEquipRed();
+                isUpdatePlayerLv = false;
+            }
+        }
+
+        private void UpdatePlayerLv(PlayerDataRefresh type)
+        {
+            if (type != PlayerDataRefresh.LV) return;
+
+            isUpdatePlayerLv = true;
+        }
+
+        public bool IsShowAddEquipByPlace(int equipPlace)
+        {
+            switch ((RoleEquipType)equipPlace)
+            {
+                case RoleEquipType.FairyCan:
+                case RoleEquipType.FairyCan2:
+                    if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt)
+                    {
+                        return true;
+                    }
+                    break;
+                case RoleEquipType.Wing:
+                    if (PlayerDatas.Instance.baseData.LV >= wingsRedpointLvlimt)
+                    {
+                        return true;
+                    }
+                    break;
+            }
+            return false;
+        }
+
+        public void CheckRoleEquipByPlace(RoleEquipType equipType)
+        {
+            ItemModel itemModel = GetItemByIndex(PackType.Equip, (int)equipType);
+            switch (equipType)
+            {
+                case RoleEquipType.FairyCan:
+                case RoleEquipType.FairyCan2:
+                    if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt && itemModel != null)
+                    {
+                        SaveRoleEquipToLocal((int)equipType);
+                    }
+                    break;
+                case RoleEquipType.Wing:
+                    if (PlayerDatas.Instance.baseData.LV >= wingsRedpointLvlimt && itemModel != null)
+                    {
+                        SaveRoleEquipToLocal((int)equipType);
+                    }
+                    break;
+            }
+        }
+
+        public void SaveRoleEquipToLocal(int equipPlace, bool isRedState = false)
+        {
+            if (isRedState && roleEquipRedDict[equipPlace].state == RedPointState.None) return;
+
+            if (LocalSavePlaceArray != null)
+            {
+                if (!LocalSavePlaceArray.Contains(equipPlace))
+                {
+                    LocalSavePlaceArray.Add(equipPlace);
+                    LocalSave.SetIntArray(RoleEquipLocalSave, LocalSavePlaceArray.ToArray());
+                }
+            }
+            else
+            {
+                LocalSavePlaceArray = new List<int>();
+                LocalSavePlaceArray.Add(equipPlace);
+                LocalSave.SetIntArray(RoleEquipLocalSave, LocalSavePlaceArray.ToArray());
+            }
+        }
+        #endregion
+
+        private void GetItemEventCtrl(ItemModel itemModel)
+        {
+            if (showDropItem)
+            {
+                bool isOverdue = false;
+                if (itemModel.config.ExpireTime > 0)
+                {
+                    ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(itemModel.guid);
+                    switch ((EquipReduceType)itemModel.config.EndureReduceType)
+                    {
+                        case EquipReduceType.Def_EquipReduceType_Time:
+                            List<int> itemEffectTime = itemModel.GetUseDataModel((int)ItemUseDataKey.createTime);
+                            if (itemEffectTime != null && itemEffectTime[0] != 0)
+                            {
+                                if (cool == null || cool.GetRemainTime() <= 0)
+                                {
+                                    isOverdue = true;
+                                }
+                            }
+                            break;
+
+                        case EquipReduceType.Def_EquipReduceType_RTimeItem:
+                            if (cool == null || cool.GetRemainTime() <= 0)
+                            {
+                                isOverdue = true;
+                            }
+                            break;
+
+                    }
+                }
+                if (!isOverdue)
+                {
+                    ItemLogicUtility.Instance.RecommendItem(itemModel);
+                    ItemLogicUtility.Instance.OnGetEquip(itemModel);
+                    ItemLogicUtility.Instance.RefreshPickItem(itemModel.packType, itemModel.guid);
+                }
+            }
+
+        }
+
+        /// <summary>
+        /// 寰楀埌鏌愪釜鍖呰9鐨勬墍鏈夋暟鎹�
+        /// </summary>
+        /// <param name="type"></param>
+        /// <returns></returns>
+        public SinglePack GetSinglePack(PackType type)
+        {
+            SinglePack singlePack = null;
+            playerPackDict.TryGetValue(type, out singlePack);
+            return singlePack;
+        }
+
+        public void UnLockPackGrid(int chooseGridCount, PackType type)
+        {
+            var singlePack = GetSinglePack(type);
+            int openCount = chooseGridCount - singlePack.unlockedGridCount;
+            int index = 0;
+            switch (type)
+            {
+                case PackType.Item:
+                    index = chooseGridCount - GeneralDefine.initBagGridCount;
+                    break;
+                case PackType.Warehouse:
+                    index = chooseGridCount - GeneralDefine.initDepotGridCount;
+                    break;
+            }
+
+            itemTipsModel.SetExtendGirdModel(openCount, index, type);
+            WindowCenter.Instance.Open<ExtendWin>();
+        }
+
+        public ItemModel GetItemByGuid(string guid)
+        {
+            ItemModel itemModel = null;
+            itemGUIDDict.TryGetValue(guid, out itemModel);
+            return itemModel;
+        }
+
+        public ItemModel GetItemByIndex(PackType type, int index)
+        {
+            switch (type)
+            {
+                case PackType.JadeDynastyEquip:
+                    if (index >= 121)
+                    {
+                        index = index - 121;
+                    }
+                    break;
+            }
+
+            ItemModel itemModel = null;
+            if (playerPackDict.ContainsKey(type))
+            {
+                itemModel = playerPackDict[type].GetItemByIndex(index);
+            }
+            return itemModel;
+        }
+
+        public List<ItemModel> GetItemsById(PackType type, int id)
+        {
+            if (playerPackDict.ContainsKey(type))
+            {
+                var singlePack = playerPackDict[type];
+                return singlePack.GetItemsById(id);
+            }
+            else
+            {
+                return null;
+            }
+        }
+
+        public string GetItemGUIDByID(int itemId)
+        {
+            string guid = string.Empty;
+            foreach (var key in itemGUIDDict.Keys)
+            {
+                if (itemGUIDDict[key].itemId == itemId)
+                {
+                    guid = key;
+                    return guid;
+                }
+            }
+
+            return guid;
+        }
+
+        /// <summary>
+        /// 寰楀埌ID鐩稿悓鐨勭墿鍝佹暟閲�
+        /// </summary>
+        /// <param name="type"></param>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public int GetItemCountByID(PackType type, int id)
+        {
+            int count = 0;
+            var singlePack = GetSinglePack(type);
+            if (singlePack != null)
+            {
+                count = singlePack.GetCountById(id);
+            }
+
+            return count;
+        }
+
+        public bool CheckBagIsPutNewItem(int itemId)
+        {
+            var singlePack = GetSinglePack(PackType.Item);
+            if (singlePack == null)
+            {
+                return false;
+            }
+
+            var config = ItemConfig.Get(itemId);
+            var items = singlePack.GetItemsById(itemId);
+            var count = singlePack.GetCountById(itemId);
+
+            int sumPutCnt = config.PackCount * items.Count;
+            if (sumPutCnt > count)
+            {
+                return true;
+            }
+            else if (GetEmptyGridCount(PackType.Item) > 0)
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+        public int GetEmptyGridCount(PackType type)
+        {
+            int count = 0;
+            SinglePack singlePack = GetSinglePack(type);
+            if (singlePack != null)
+            {
+                count = singlePack.GetEmptyGridCount();
+            }
+
+            return count;
+        }
+
+        public bool TryGetShareNumItem(int itemId, out List<int> idlist)
+        {
+            idlist = new List<int>();
+            foreach (var list in sharedUseCountItemDict.Values)
+            {
+                if (list.Contains(itemId))
+                {
+                    idlist = list;
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 寰楀埌鐗╁搧浠婃棩浣跨敤娆℃暟
+        /// </summary>
+        /// <param name="itemId"></param>
+        /// <returns></returns>
+        public int GetItemUsedTimesToday(int itemId)
+        {
+            int useCnt = 0;
+            List<int> shareIdlist = null;
+            bool isShare = TryGetShareNumItem(itemId, out shareIdlist);
+            if (isShare)
+            {
+                foreach (var id in shareIdlist)
+                {
+                    int singleUseCnt = 0;
+                    itemDayUseCntDict.TryGetValue(id, out singleUseCnt);
+                    useCnt += singleUseCnt;
+                }
+            }
+            else
+            {
+                itemDayUseCntDict.TryGetValue(itemId, out useCnt);
+            }
+            return useCnt;
+        }
+
+        /// <summary>
+        /// 寰楀埌鐗╁搧鎬讳娇鐢ㄦ鏁�
+        /// </summary>
+        /// <param name="itemId"></param>
+        /// <returns></returns>
+        public int GetItemTotalUsedTimes(int itemId)
+        {
+            int useCnt = 0;
+            List<int> shareIdlist = null;
+            bool isShare = TryGetShareNumItem(itemId, out shareIdlist);
+            if (isShare)
+            {
+                foreach (var id in shareIdlist)
+                {
+                    int singleUseCnt = 0;
+                    itemDayUseCntDict.TryGetValue(id, out singleUseCnt);
+                    useCnt += singleUseCnt;
+                }
+            }
+            else
+            {
+                itemSumUseCntDict.TryGetValue(itemId, out useCnt);
+            }
+            return useCnt;
+        }
+
+        public void GotoWashAttributePoint(string guid)
+        {
+            ItemModel itemModel = GetItemByGuid(guid);
+            if (itemModel == null) return;
+
+            WashAttrPointWin.itemModel = itemModel;
+            WindowCenter.Instance.Open<WashAttrPointWin>();
+        }
+
+        #region 绾㈢偣閫昏緫鍒ゆ柇
+        private Dictionary<int, Redpoint> roleEquipRedDict = new Dictionary<int, Redpoint>();
+        public void SetRoleEquipRedpoint()
+        {
+            roleEquipRedDict.Clear();
+            for (int i = 1; i < 13; i++)
+            {
+                int redKey = ITEMPACK_REDKEY + i;
+                Redpoint redpoint = new Redpoint(MainRedDot.RedPoint_BagFuncKey, redKey);
+                roleEquipRedDict.Add(i, redpoint);
+            }
+        }
+
+        public void UpdateRoleEquipRed()
+        {
+            foreach (var key in roleEquipRedDict.Keys)
+            {
+                var item = GetItemByIndex(PackType.Equip, key);
+                switch ((RoleEquipType)key)
+                {
+                    case RoleEquipType.FairyCan:
+                        if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt && !TryGetRoleEquipLocalSave(key)
+                           && item == null && roleEquipRedDict[(int)RoleEquipType.FairyCan2].state == RedPointState.None)
+                        {
+                            roleEquipRedDict[key].state = RedPointState.Simple;
+                        }
+                        else
+                        {
+                            roleEquipRedDict[key].state = RedPointState.None;
+                        }
+                        break;
+                    case RoleEquipType.FairyCan2:
+                        if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt && !TryGetRoleEquipLocalSave(key)
+                            && item == null && roleEquipRedDict[(int)RoleEquipType.FairyCan].state == RedPointState.None)
+                        {
+                            roleEquipRedDict[key].state = RedPointState.Simple;
+                        }
+                        else
+                        {
+                            roleEquipRedDict[key].state = RedPointState.None;
+                        }
+                        break;
+                    case RoleEquipType.Wing:
+                        if (PlayerDatas.Instance.baseData.LV >= wingsRedpointLvlimt && !TryGetRoleEquipLocalSave(key)
+                          && item == null)
+                        {
+                            roleEquipRedDict[key].state = RedPointState.Simple;
+                        }
+                        else
+                        {
+                            roleEquipRedDict[key].state = RedPointState.None;
+                        }
+                        break;
+                    default:
+                        roleEquipRedDict[key].state = RedPointState.None;
+                        break;
+                }
+            }
+        }
+
+        private bool TryGetRoleEquipLocalSave(int equipPlace)
+        {
+            if (LocalSavePlaceArray != null)
+            {
+                for (int i = 0; i < LocalSavePlaceArray.Count; i++)
+                {
+                    if (equipPlace == 9 || equipPlace == 10)
+                    {
+                        if (LocalSavePlaceArray[i] == 9 || LocalSavePlaceArray[i] == 10)
+                        {
+                            return true;
+                        }
+                    }
+                    else
+                    {
+                        if (LocalSavePlaceArray[i] == equipPlace)
+                        {
+                            return true;
+                        }
+                    }
+
+                }
+            }
+            return false;
+        }
+
+        const int ITEMPACK_REDKEY = 102011003;
+        Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY);
+
+        private void UpdatePackRedpoint(PackType type)
+        {
+            var singlePack = GetSinglePack(type);
+            if (singlePack == null)
+            {
+                return;
+            }
+
+            switch (type)
+            {
+                case PackType.Item:
+                    if (singlePack.GetEmptyGridCount() <= 0)
+                    {
+                        redpointItemPack.state = RedPointState.Full;
+                        SysNotifyMgr.Instance.ShowTip("BagFull");
+                    }
+                    else
+                    {
+                        redpointItemPack.state = RedPointState.None;
+                    }
+                    break;
+                case PackType.Warehouse:
+                    if (singlePack.GetEmptyGridCount() <= 0)
+                    {
+                        MainRedDot.Instance.redPointDepotFunc.state = RedPointState.Full;
+                    }
+                    else
+                    {
+                        MainRedDot.Instance.redPointDepotFunc.state = RedPointState.None;
+                    }
+                    break;
+            }
+        }
+
+        const int PLAYERSUMSTAR_REDKEY = 102011002;
+        Redpoint redpointSTAR = new Redpoint(MainRedDot.RedPoint_BagFuncKey, PLAYERSUMSTAR_REDKEY);
+
+        public event Action<int, bool> RefreshAttrActiveAct;
+        public void SetPlayerAttrActiveRedPoint()
+        {
+            if (IsActiveStarAttr())
+            {
+                if (redpointSTAR.state != RedPointState.Simple)
+                {
+                    redpointSTAR.state = RedPointState.Simple;
+                    if (RefreshAttrActiveAct != null)
+                    {
+                        RefreshAttrActiveAct(1, true);
+                    }
+                }
+            }
+            else
+            {
+                if (redpointSTAR.state != RedPointState.None)
+                {
+                    redpointSTAR.state = RedPointState.None;
+                    if (RefreshAttrActiveAct != null)
+                    {
+                        RefreshAttrActiveAct(1, false);
+                    }
+                }
+            }
+        }
+
+        public bool IsActiveStarAttr()
+        {
+            List<int> starslist = RoleEquipStarsConfig.GetEquipStarsCntlist();
+            SinglePack singlePack = GetSinglePack(PackType.Equip);
+            if (singlePack == null || starslist == null || starslist.Count < 1) return false;
+
+            Dictionary<int, ItemModel> _itemDict = singlePack.GetAllItems();
+            int playerSumStars = 0;
+            foreach (var model in _itemDict.Values)
+            {
+                playerSumStars += model.config.StarLevel;
+            }
+            int cnt = GetActiveCntByType(1);
+            int nextActiveStars = 0;
+            for (int i = 0; i < starslist.Count; i++)
+            {
+                if (cnt == 0)
+                {
+                    nextActiveStars = starslist[0];
+                    break;
+                }
+                else
+                {
+                    if (starslist[i] == cnt)
+                    {
+                        if (i < starslist.Count - 1)
+                        {
+                            nextActiveStars = starslist[i + 1];
+                        }
+                        break;
+                    }
+                }
+            }
+
+            if (nextActiveStars != 0 && playerSumStars >= nextActiveStars)
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+        public bool IsActiveSTRAttr()
+        {
+            List<string> strenlist = ItemPlusSumAttrConfig.GetKeys();
+            if (strenlist == null || strenlist.Count < 1) return false;
+            int playerSumSTR = 0;
+            Dictionary<int, EquipmentInitialization> strenInfoDict = ModelCenter.Instance.GetModel<PlayerStrengthengDatas>()._EqInfo;
+            foreach (var value in strenInfoDict.Values)
+            {
+                ItemModel itemModel = GetItemByIndex(PackType.Equip, value.EquipIndex);
+                if (itemModel != null)
+                {
+                    playerSumSTR += value.EquipPartStarLV;
+                }
+            }
+            int cnt = GetActiveCntByType(0);
+            int nextActiveSTR = 0;
+            for (int i = 0; i < strenlist.Count; i++)
+            {
+                if (cnt == 0)
+                {
+                    nextActiveSTR = int.Parse(strenlist[0]);
+                    break;
+                }
+                else
+                {
+                    if (int.Parse(strenlist[i]) == cnt)
+                    {
+                        if (i < strenlist.Count - 1)
+                        {
+                            nextActiveSTR = int.Parse(strenlist[i + 1]);
+                        }
+                        break;
+                    }
+                }
+            }
+
+            if (nextActiveSTR != 0 && playerSumSTR >= nextActiveSTR)
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+        public const int EquipDecompose_RedKey = 10205;
+        public Redpoint redpointEquipDecom = new Redpoint(MainRedDot.RedPoint_MainPackKey, EquipDecompose_RedKey);
+        public void EquipDecomRedCtrl()
+        {
+            if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.EquipDecompose)) return;
+
+            if (GetCanDevourModellist() != null && GetCanDevourModellist().Count >= minDevourEquipNum)
+            {
+                redpointEquipDecom.state = RedPointState.Simple;
+            }
+            else
+            {
+                redpointEquipDecom.state = RedPointState.None;
+            }
+        }
+        #endregion
+
+        #region 鏌ョ湅鏌愪釜浣嶇疆鐨勭墿鍝�
+        public event Action lookEquipEvent;
+        private int _lookLineIndex = -1;
+        public int lookLineIndex { get { return _lookLineIndex; } private set { _lookLineIndex = value; } }
+
+        public string lookItemGUID { get; private set; }
+
+        public void SetLookIndex(string guid, int singleRowCount = 5)
+        {
+            if (string.IsNullOrEmpty(guid) || guid == "")
+            {
+                lookLineIndex = -1;
+                lookItemGUID = "";
+            }
+            else
+            {
+                int index = GetItemByGuid(guid).itemPlace;
+                lookLineIndex = index / singleRowCount;
+                lookItemGUID = guid;
+            }
+
+            if (lookEquipEvent != null)
+            {
+                lookEquipEvent();
+            }
+
+        }
+
+        public event Action RefreshBagEvent;
+        public void RefreshBagInfo()
+        {
+            if (RefreshBagEvent != null)
+            {
+                RefreshBagEvent();
+            }
+        }
+        #endregion
+
+        public void SetJumpToOneKeySell(Transform parent)
+        {
+            var goEffect = AchievementGuideEffectPool.Require(1);
+            goEffect.transform.SetParentEx(parent, Vector3.zero, Quaternion.identity, Vector3.one);
+            AchievementGoto.guideAchievementId = 0;
+        }
+
+        #region 鐗╁搧浣跨敤蹇嵎鎻愮ず
+
+        private int cacheMapId = 0;
+        public event Action<PackType, string> itemUseAct;
+        private Dictionary<int, int> itemUseTypeDict = new Dictionary<int, int>(); //key SkillTypeID,value 浣跨敤鐗╁搧鐨処D
+        private void OnStageLoadFinish()
+        {
+            itemUseTypeDict.Clear();
+            if (PlayerDatas.Instance.baseData.MapID == cacheMapId)
+            {
+                return;
+            }
+
+            cacheMapId = PlayerDatas.Instance.baseData.MapID;
+            UpdateDungeonDanUse();
+            UpdateDungeonUse();
+            SinglePack singlePack = GetSinglePack(PackType.Item);
+            foreach (int itemId in itemUseTypeDict.Values)
+            {
+                var modellist = singlePack.GetItemsById(itemId);
+                if (modellist.Count > 0)
+                {
+                    ItemModel itemModel = modellist[0];
+                    bool isExist = StatusMgr.Instance.IsExist(PlayerDatas.Instance.hero.ServerInstID, itemModel.config.AddSkill1);
+                    DebugEx.Log("Buff鏄惁瀛樺湪" + isExist);
+                    if (itemUseAct != null && !isExist)
+                    {
+                        itemUseAct(PackType.Item, itemModel.guid);
+                    }
+                }
+            }
+        }
+
+        private void AddItemUseTypeDict(int id)
+        {
+            SkillConfig skillConfig = GetSkillConfig(id);
+            int itemCount = GetItemCountByID(PackType.Item, id);
+            if (skillConfig != null && itemCount > 0)
+            {
+                if (!itemUseTypeDict.ContainsKey(skillConfig.SkillTypeID))
+                {
+                    itemUseTypeDict.Add(skillConfig.SkillTypeID, id);
+                }
+                else
+                {
+                    SkillConfig preSkillConfig = GetSkillConfig(itemUseTypeDict[skillConfig.SkillTypeID]);
+                    if (skillConfig.SkillLV > preSkillConfig.SkillLV)
+                    {
+                        itemUseTypeDict[skillConfig.SkillTypeID] = id;
+                    }
+                }
+            }
+        }
+
+        private void UpdateDungeonDanUse()
+        {
+            int mapId = PlayerDatas.Instance.baseData.MapID;
+            int[] useDrugs = GetDrugIDListByDungeonID(mapId);
+            if (useDrugs == null) return;
+
+            for (int i = 0; i < useDrugs.Length; i++)
+            {
+                int id = useDrugs[i];
+                AddItemUseTypeDict(id);
+            }
+        }
+
+        private void UpdateDungeonUse()
+        {
+            int mapId = PlayerDatas.Instance.baseData.MapID;
+            if (!dungeonUseDict.ContainsKey(mapId)) return;
+
+            List<int> useIdlist = dungeonUseDict[mapId];
+            for (int i = 0; i < useIdlist.Count; i++)
+            {
+                int id = useIdlist[i];
+                AddItemUseTypeDict(id);
+            }
+        }
+
+        public SkillConfig GetSkillConfig(int itemId)
+        {
+            ItemConfig itemConfig = ItemConfig.Get(itemId);
+            SkillConfig skillConfig = SkillConfig.Get(itemConfig.AddSkill1);
+            return skillConfig;
+        }
+
+        public int GetDungeonIDByDrugID(int drugID)
+        {
+            int dungeonID = 0;
+            DrugToDungeonDict.TryGetValue(drugID, out dungeonID);
+            return dungeonID;
+        }
+
+        public int[] GetDrugIDListByDungeonID(int dungeonID)
+        {
+            int[] drugIDlist = null;
+            DungeonToDrugDict.TryGetValue(dungeonID, out drugIDlist);
+            return drugIDlist;
+        }
+        #endregion
+
+        #region 鍒ゆ柇鐗╁搧鏄惁杈惧埌浣跨敤涓婇檺
+        public bool IsReachUseLimit(string guid, out ulong count)
+        {
+            count = 0;
+            ItemModel itemModel = GetItemByGuid(guid);
+            if (itemModel == null) return false;
+
+            AttrFruitConfig fruitConfig = AttrFruitConfig.Get(itemModel.itemId);
+            int haveUseCnt = GetItemUsedTimesToday(itemModel.itemId);
+            int sumHaveUseCnt = GetItemTotalUsedTimes(itemModel.itemId);
+            count = (ulong)itemModel.count;
+            bool isReach = false;
+            int remainDayCnt = 0;
+            if (itemModel.config.MaxSkillCnt > 0)
+            {
+                remainDayCnt = itemModel.config.MaxSkillCnt - haveUseCnt;
+                if (itemModel.count > remainDayCnt)
+                {
+                    count = (ulong)remainDayCnt;
+                }
+
+            }
+
+            int remainSumCnt = 0;
+            if (fruitConfig != null)
+            {
+                remainSumCnt = fruitConfig.MaxUseCnt - sumHaveUseCnt;
+                if (remainSumCnt <= remainDayCnt && itemModel.count > remainSumCnt)
+                {
+                    count = (ulong)remainSumCnt;
+                }
+            }
+
+            if (count < (ulong)itemModel.count)
+            {
+                isReach = true;
+            }
+
+            return isReach;
+        }
+        #endregion
+
+        #region 鐗╁搧鍚炲櫖閫昏緫澶勭悊
+        public EquipColorType colorType { get; private set; }
+        public EquipLvType lvType { get; private set; }
+        public EquipStarType starType { get; private set; }
+        public event Action<EquipColorType> RefreshColorSelectAct;
+        public event Action<EquipLvType> RefreshLvSelectAct;
+        public event Action<EquipStarType> RefreshStarSelectAct;
+        public event Action RefreshEquipDecomNumAct;
+        public int[] defaultUnSelectlist { get; private set; }
+
+        public bool ContainPreciousItem(List<ItemModel> itemModels, out int betterEquipCnt, out int preciousCnt)
+        {
+            betterEquipCnt = 0;
+            preciousCnt = 0;
+            if (itemModels == null) return false;
+
+            for (int i = 0; i < itemModels.Count; i++)
+            {
+                if (defaultUnSelectlist.Contains(itemModels[i].itemId))
+                {
+                    preciousCnt += itemModels[i].count;
+                }
+                else if (ItemLogicUtility.Instance.IsFightUp(itemModels[i].itemId, itemModels[i].equipScore) == 1)
+                {
+                    betterEquipCnt += itemModels[i].count;
+                }
+            }
+
+            if (betterEquipCnt > 0 || preciousCnt > 0)
+            {
+                return true;
+            }
+
+            return false;
+        }
+
+        public bool ContainTwoStarEquip(List<ItemModel> itemModels, out int twoStarEquipCnt)
+        {
+            twoStarEquipCnt = 0;
+            if (itemModels == null) return false;
+            for (int i = 0; i < itemModels.Count; i++)
+            {
+                if (itemModels[i].config.StarLevel >= 2 && itemModels[i].config.ItemColor >= (int)E_ItemColor.Orange)
+                {
+                    twoStarEquipCnt += itemModels[i].count;
+                }
+            }
+            if (twoStarEquipCnt > 0)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public void SetColorSelect(EquipColorType type)
+        {
+            colorType = type;
+            if (colorType == EquipColorType.None)
+            {
+                if (lvType != EquipLvType.None)
+                {
+                    SetLvSelect(EquipLvType.None);
+                }
+            }
+            else
+            {
+                if (lvType == EquipLvType.None)
+                {
+                    SetLvSelect(EquipLvType.All);
+                }
+            }
+
+            if (RefreshColorSelectAct != null)
+            {
+                RefreshColorSelectAct(type);
+            }
+            SendEquipDevourRecordQuest();
+            EquipDecomRedCtrl();
+        }
+
+        public void SetLvSelect(EquipLvType type)
+        {
+            lvType = type;
+            if (lvType == EquipLvType.None)
+            {
+                if (colorType != EquipColorType.None)
+                {
+                    SetColorSelect(EquipColorType.None);
+                }
+            }
+            else
+            {
+                if (colorType == EquipColorType.None)
+                {
+                    SetColorSelect(EquipColorType.Purple);
+                }
+            }
+            if (RefreshLvSelectAct != null)
+            {
+                RefreshLvSelectAct(type);
+            }
+            SendEquipDevourRecordQuest();
+            EquipDecomRedCtrl();
+        }
+
+        public void SetStarSelect(EquipStarType type)
+        {
+            starType = type;
+            if (RefreshStarSelectAct != null)
+            {
+                RefreshStarSelectAct(type);
+            }
+            SendEquipDevourRecordQuest();
+            EquipDecomRedCtrl();
+        }
+
+        public List<int> devourPlacelist { get; private set; }
+        public int MaxDevourEquipNum { get; private set; }
+        public int minDevourEquipNum { get; private set; }
+        public void SetDevourEquipPlace()
+        {
+            devourPlacelist = new List<int>();
+            FuncConfigConfig funcConfig = FuncConfigConfig.Get("PetAbsorbType");
+            int[] placeArray = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1);
+            for (int i = 0; i < placeArray.Length; i++)
+            {
+                devourPlacelist.Add(placeArray[i]);
+            }
+            MaxDevourEquipNum = int.Parse(funcConfig.Numerical2);
+            minDevourEquipNum = int.Parse(funcConfig.Numerical3);
+        }
+
+        List<ItemModel> devourModellist = new List<ItemModel>();
+        List<ItemModel> orderDevourModellist = new List<ItemModel>();
+        public List<ItemModel> GetDevourModellist()
+        {
+            SinglePack singlePack = GetSinglePack(PackType.Item);
+            if (singlePack == null) return null;
+
+            devourModellist.Clear();
+            orderDevourModellist.Clear();
+            foreach (var model in singlePack.GetAllItems().Values)
+            {
+                if (model.config.Type == 29)
+                {
+                    devourModellist.Add(model);
+                }
+                else
+                {
+                    if (devourPlacelist.Contains(model.config.EquipPlace))
+                    {
+                        if (model.config.ItemColor >= (int)E_ItemColor.Purple)
+                        {
+                            devourModellist.Add(model);
+                        }
+                    }
+                }
+
+            }
+            orderDevourModellist.AddRange(devourModellist);
+            orderDevourModellist.Sort(CompareByColor);
+            return orderDevourModellist;
+        }
+
+        public int CompareByColor(ItemModel start, ItemModel next)
+        {
+            bool typeX = start.config.Type == 29 ? true : false;
+            bool typeY = next.config.Type == 29 ? true : false;
+
+            if (typeX.CompareTo(typeY) != 0) return -typeX.CompareTo(typeY);
+
+            int colorX = start.config.ItemColor;
+            int colorY = next.config.ItemColor;
+            if (colorX.CompareTo(colorY) != 0) return colorX.CompareTo(colorY);
+
+            int startIndex = devourModellist.IndexOf(start);
+            int nextIndex = devourModellist.IndexOf(next);
+            if (startIndex.CompareTo(nextIndex) != 0) return startIndex.CompareTo(nextIndex);
+
+            return 0;
+        }
+
+        public List<ItemModel> GetCanDevourModellist()
+        {
+            List<ItemModel> canDevourModellist = new List<ItemModel>();
+            SinglePack singlePack = GetSinglePack(PackType.Item);
+            if (singlePack == null
+                || colorType == EquipColorType.None
+                || lvType == EquipLvType.None)
+            {
+                if (RefreshEquipDecomNumAct != null)
+                {
+                    RefreshEquipDecomNumAct();
+                }
+                return null;
+            }
+
+            foreach (var model in singlePack.GetAllItems().Values)
+            {
+                if (model.config.Type == 29)
+                {
+                    if (!defaultUnSelectlist.Contains(model.itemId))
+                    {
+                        canDevourModellist.Add(model);
+                    }
+                }
+                else
+                {
+                    if (IsCanDevour(model))
+                    {
+                        canDevourModellist.Add(model);
+                    }
+
+                }
+            }
+            if (RefreshEquipDecomNumAct != null)
+            {
+                RefreshEquipDecomNumAct();
+            }
+            return canDevourModellist;
+        }
+
+        public bool IsCanDevour(ItemModel model)
+        {
+            if (devourPlacelist.Contains(model.config.EquipPlace))
+            {
+                if (model.config.ItemColor >= (int)E_ItemColor.Purple)
+                {
+                    PetEatEquipConfig eatEquipConfig = PetEatEquipConfig.GetEquipColorAndEquipClass(model.config.ItemColor, model.config.LV);
+                    if (eatEquipConfig == null) return false;
+
+                    if (ItemLogicUtility.Instance.IsFightUp(model.itemId, model.equipScore) != 1)
+                    {
+                        if (model.config.ItemColor <= (int)colorType
+                            && model.config.LV <= (int)lvType
+                            && model.config.StarLevel <= (int)starType)
+                        {
+                            return true;
+                        }
+                    }
+                }
+            }
+
+            return false;
+        }
+
+        public bool IsMaxDecomLv(int decomLv, out int realLv)
+        {
+            realLv = decomLv;
+            List<EquipDeComposeConfig> decomlist = EquipDeComposeConfig.GetValues();
+            if (decomLv > decomlist[decomlist.Count - 1].LV)
+            {
+                realLv = decomlist[decomlist.Count - 1].LV;
+                return true;
+            }
+
+            return false;
+        }
+
+
+        public List<ItemModel> selectDevourlist = new List<ItemModel>();
+        public void GetSelectDevourList()
+        {
+            selectDevourlist.Clear();
+            List<ItemModel> itemModels = GetCanDevourModellist();
+            if (itemModels != null)
+            {
+                selectDevourlist.AddRange(itemModels);
+            }
+        }
+
+        public void RefreshGetNewItem(ItemModel model)
+        {
+            if (model == null) return;
+
+            if (CheckIsReachDevourCondi(model))
+            {
+                selectDevourlist.Add(model);
+                if (RefreshEquipDecomNumAct != null)
+                {
+                    RefreshEquipDecomNumAct();
+                }
+            }
+        }
+
+        public void AddSelectDevourModellist(ItemModel model)
+        {
+            selectDevourlist.Add(model);
+            if (RefreshEquipDecomNumAct != null)
+            {
+                RefreshEquipDecomNumAct();
+            }
+        }
+
+        public bool CheckIsReachDevourCondi(ItemModel model)
+        {
+            if (model.config.Type == 29)
+            {
+                if (!defaultUnSelectlist.Contains(model.itemId))
+                {
+                    return true;
+                }
+                return false;
+            }
+            else
+            {
+                if (IsCanDevour(model))
+                {
+                    return true;
+                }
+
+            }
+            return false;
+        }
+
+        public void RemoveSelectDevourModellist(ItemModel model)
+        {
+            if (selectDevourlist.Contains(model))
+            {
+                selectDevourlist.Remove(model);
+            }
+            if (RefreshEquipDecomNumAct != null)
+            {
+                RefreshEquipDecomNumAct();
+            }
+        }
+
+        public Dictionary<int, int> GetDecomAttrDictByLv(int decomLv)
+        {
+            if (decomposeAttrDict.ContainsKey(decomLv))
+            {
+                return decomposeAttrDict[decomLv];
+            }
+
+            return null;
+        }
+
+        public bool IsReachMinDecomposeNum()
+        {
+            List<ItemModel> itemModels = GetCanDevourModellist();
+            if (itemModels != null && itemModels.Count >= minDecomposeNum)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public void SendEquipdevourQuest()
+        {
+            List<ItemModel> itemModels = GetCanDevourModellist();
+            if (itemModels == null || itemModels.Count < minDecomposeNum || !ItemLogicUtility.Instance.isPackResetOk || SettingEffectMgr.Instance.isStartDecompose) return;
+
+            SettingEffectMgr.Instance.isStartDecompose = true;
+            isAutoDecompose = true;
+            recordAutoDecomNum = itemModels.Count;
+            CA32C_tagCMEquipDecompose _petEat = new CA32C_tagCMEquipDecompose();
+            var _petIndex = new ushort[recordAutoDecomNum];
+            var idlist = new uint[recordAutoDecomNum];
+            for (int i = 0; i < recordAutoDecomNum; i++)
+            {
+                _petIndex[i] = (ushort)itemModels[i].itemPlace;
+                idlist[i] = (uint)itemModels[i].itemId;
+                if (itemModels[i].config.StarLevel >= 2
+                    || (itemModels[i].config.EquipPlace == 0 && itemModels[i].config.Type != 29))
+                {
+                    return;
+                }
+            }
+            _petEat.Count = (byte)_petIndex.Length;
+            _petEat.IndexList = _petIndex;
+            _petEat.ItemIDList = idlist;
+            _petEat.IsAuto = 1;
+            GameNetSystem.Instance.SendInfo(_petEat);
+        }
+
+        public void SendEquipDevourRecordQuest()
+        {
+            string record = StringUtility.Contact((int)colorType + 1, (int)lvType + 1, (int)starType + 1);
+            CA32D_tagCMDecomposeSeting decomSet = new CA32D_tagCMDecomposeSeting();
+            decomSet.Seting = uint.Parse(record);
+            GameNetSystem.Instance.SendInfo(decomSet);
+        }
+        public int decomposeLv { get; private set; }
+        public int decomposeExp { get; private set; }
+        public int decomposeProgress { get; private set; }
+        public int addDecomposeExp { get; private set; }
+        public int minDecomposeNum { get; private set; }
+        public bool isAutoDecompose { get; set; }
+        public int recordAutoDecomNum { get; private set; }
+        public DecomposeGetMatInfo[] getItems { get; private set; }
+
+        public event Action RefreshDecomAttrAct;
+        public void GetServerDecomposeSet(HA31C_tagMCEquipDecomposeInfo info)
+        {
+            addDecomposeExp = 0;
+            int realLv = info.LV + 1;
+            bool isMax = IsMaxDecomLv(realLv, out realLv);
+            if (realLv == decomposeLv)
+            {
+                addDecomposeExp = (int)info.Exp - decomposeExp;
+            }
+            else
+            {
+                for (int i = decomposeLv; i <= realLv; i++)
+                {
+                    EquipDeComposeConfig deComposeConfig = EquipDeComposeConfig.Get(i);
+                    if (i == decomposeLv)
+                    {
+                        addDecomposeExp = deComposeConfig.UpNeedExp - decomposeExp;
+                    }
+                    else if (i == realLv)
+                    {
+                        addDecomposeExp += (int)info.Exp;
+                    }
+                    else
+                    {
+                        addDecomposeExp += deComposeConfig.UpNeedExp;
+                    }
+                }
+            }
+
+            decomposeLv = realLv;
+            decomposeExp = (int)info.Exp;
+            decomposeProgress = info.DecomposeCnt;
+            getItems = JsonMapper.ToObject<DecomposeGetMatInfo[]>(info.GetItemData);
+
+            if (info.Seting != 0)
+            {
+                string decomSetStr = info.Seting.ToString();
+                string colorStr = decomSetStr.Substring(0, 1);
+                colorType = (EquipColorType)(int.Parse(colorStr) - 1);
+                starType = (EquipStarType)((int)info.Seting % 10 - 1);
+                string lvStr = decomSetStr.Substring(1, decomSetStr.Length - 2);
+                lvType = (EquipLvType)(int.Parse(lvStr) - 1);
+            }
+            if (RefreshDecomAttrAct != null)
+            {
+                RefreshDecomAttrAct();
+            }
+        }
+        /// <summary>
+        /// 璁剧疆鑾峰緱鐐间腹鏉愭枡鐨勫睍绀烘暟鎹�
+        /// </summary>
+        /// <param name="getMatInfos"></param>
+        /// <returns></returns>
+        private List<DecomposeGetMatInfo> getMatInfos = new List<DecomposeGetMatInfo>();
+        public List<DecomposeGetMatInfo> SetShowMatInfo()
+        {
+            getMatInfos.Clear();
+            int sumMatCnt = 0;
+            if (getItems != null)
+            {
+                for (int i = 0; i < getItems.Length; i++)
+                {
+                    if (getItems[i].Count > 0)
+                    {
+                        sumMatCnt += getItems[i].Count;
+                    }
+                    else
+                    {
+                        sumMatCnt += 1;
+                    }
+                }
+            }
+
+            if (sumMatCnt > 5)
+            {
+                for (int i = 0; i < getItems.Length; i++)
+                {
+                    getMatInfos.Add(getItems[i]);
+                }
+            }
+            else
+            {
+                if (getItems != null)
+                {
+                    for (int i = 0; i < getItems.Length; i++)
+                    {
+                        if (getItems[i].Count > 0)
+                        {
+                            for (int j = 0; j < getItems[i].Count; j++)
+                            {
+                                DecomposeGetMatInfo matInfo = new DecomposeGetMatInfo();
+                                matInfo.ItemID = getItems[i].ItemID;
+                                matInfo.Count = 1;
+                                matInfo.IsBind = getItems[i].IsBind;
+                                matInfo.IsSuite = getItems[i].IsSuite;
+                                matInfo.UserData = getItems[i].UserData;
+                                getMatInfos.Add(matInfo);
+                            }
+                        }
+                        else
+                        {
+                            getMatInfos.Add(getItems[i]);
+                        }
+                    }
+                }
+            }
+            return getMatInfos;
+        }
+
+        public enum EquipColorType
+        {
+            None = 0,
+            Purple = 3,
+            Orange = 4,
+            Red = 5,
+            All = 10,
+        }
+
+        public enum EquipLvType
+        {
+            None = 0,
+            One,
+            Two,
+            Three,
+            Four,
+            Five,
+            Six,
+            Seven,
+            Eight,
+            Nine,
+            Ten,
+            Eleven,
+            Twelve,
+            Thirteen,
+            Fourteen,
+            Fifteen,
+            All,
+        }
+
+        public enum EquipStarType
+        {
+            None = 0,
+            One,
+            Two,
+            Three,
+            All,
+        }
+
+        public class DecomposeGetMatInfo
+        {
+            public int ItemID;
+            public int Count;
+            public int IsBind;
+            public int IsSuite;
+            public string UserData;
+        }
+        #endregion
+
+        #region 涓硅嵂閫昏緫澶勭悊
+
+        private int CompareMakeDrug(AttrFruitConfig start, AttrFruitConfig end)
+        {
+            ItemConfig configS = ItemConfig.Get(start.ID);
+            ItemConfig configE = ItemConfig.Get(end.ID);
+            if (configS.RealmLimit.CompareTo(configE.RealmLimit) != 0)
+            {
+                return configS.RealmLimit.CompareTo(configE.RealmLimit);
+            }
+            if (configS.LV.CompareTo(configE.LV) != 0)
+            {
+                return configS.LV.CompareTo(configE.LV);
+            }
+
+            int x = makeDruglist.IndexOf(start);
+            int y = makeDruglist.IndexOf(end);
+            if (x.CompareTo(y) != 0) x.CompareTo(y);
+
+            return 0;
+        }
+
+        List<AttrFruitConfig> drugOrderlist = new List<AttrFruitConfig>();
+        List<AttrFruitConfig> haveDruglist = new List<AttrFruitConfig>();
+        public List<AttrFruitConfig> GetDrugOrderByCnt()
+        {
+            drugOrderlist.Clear();
+            haveDruglist.Clear();
+            drugOrderlist.AddRange(makeDruglist);
+            drugOrderlist.Sort(CompareByIsHave);
+            for (int i = 0; i < drugOrderlist.Count; i++)
+            {
+                if (IsHaveDrugUse(drugOrderlist[i]))
+                {
+                    haveDruglist.Add(drugOrderlist[i]);
+                }
+            }
+            haveDruglist.Sort(CompareMakeDrug);
+            for (int i = 0; i < haveDruglist.Count; i++)
+            {
+                drugOrderlist[i] = haveDruglist[i];
+            }
+
+            return drugOrderlist;
+        }
+
+        public bool CheckIsDrugById(int itemId)
+        {
+            for (int i = 0; i < makeDruglist.Count; i++)
+            {
+                if (makeDruglist[i].ID == itemId)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public int CompareByIsHave(AttrFruitConfig start, AttrFruitConfig end)
+        {
+            bool isHaveStart = IsHaveDrugUse(start);
+            bool isHaveEnd = IsHaveDrugUse(end);
+            if (isHaveStart.CompareTo(isHaveEnd) != 0) return -isHaveStart.CompareTo(isHaveEnd);
+
+            //isHaveStart = IsHaveDrugRecycle(start);
+            //isHaveEnd = IsHaveDrugRecycle(end);
+            //if (isHaveStart.CompareTo(isHaveEnd) != 0) return -isHaveStart.CompareTo(isHaveEnd);
+
+            isHaveStart = GetItemCountByID(PackType.Item, start.ID) > 0 ? true : false;
+            isHaveEnd = GetItemCountByID(PackType.Item, end.ID) > 0 ? true : false;
+            if (isHaveStart.CompareTo(isHaveEnd) != 0) return isHaveStart.CompareTo(isHaveEnd);
+
+            isHaveStart = IsReachMaxUseDrug(start);
+            isHaveEnd = IsReachMaxUseDrug(end);
+            if (isHaveStart.CompareTo(isHaveEnd) != 0) return isHaveStart.CompareTo(isHaveEnd);
+
+            int x = makeDruglist.IndexOf(start);
+            int y = makeDruglist.IndexOf(end);
+            if (x.CompareTo(y) != 0) return x.CompareTo(y);
+            return 0;
+        }
+
+        public bool IsHaveDrugUse(AttrFruitConfig fruitConfig)
+        {
+            if (!IsReachMaxUseDrug(fruitConfig))
+            {
+                return GetItemCountByID(PackType.Item, fruitConfig.ID) > 0 ? true : false;
+            }
+
+            return false;
+        }
+
+        public bool IsHaveDrugRecycle(AttrFruitConfig fruitConfig)
+        {
+            if (IsReachMaxUseDrug(fruitConfig))
+            {
+                return GetItemCountByID(PackType.Item, fruitConfig.ID) > 0 ? true : false;
+            }
+            return false;
+        }
+
+        public bool IsReachMaxUseDrug(AttrFruitConfig fruitConfig)
+        {
+            if (fruitConfig == null) return false;
+
+            int useNum = GetItemTotalUsedTimes(fruitConfig.ID);
+            if (useNum >= fruitConfig.MaxUseCnt)
+            {
+                return true;
+            }
+            return false;
+        }
+
+        List<AttrFruitConfig> limitlist = new List<AttrFruitConfig>();
+        public float GetAlchemyProgress(AlchemyConfig alchemy)
+        {
+            var previewDanlist = FurnaceModel.GetPreviewIdlist(alchemy);
+            float progress = 0;
+            limitlist.Clear();
+            for (int i = 0; i < previewDanlist.Count; i++)
+            {
+                AttrFruitConfig fruitConfig = AttrFruitConfig.Get(previewDanlist[i]);
+                if (fruitConfig != null)
+                {
+                    limitlist.Add(fruitConfig);
+                }
+            }
+
+            for (int i = 0; i < limitlist.Count; i++)
+            {
+                progress += ((float)1 / limitlist.Count) * ((float)GetItemTotalUsedTimes(limitlist[i].ID) / limitlist[i].MaxUseCnt);
+            }
+            return progress * 100;
+        }
+        #endregion
+    }
+}

--
Gitblit v1.8.0