少年修仙传客户端代码仓库
client_Wu Xijin
2018-10-25 dc934f9735d6f0b337412ed791c0d443c752d4de
System/KnapSack/Logic/ItemOverdueModel.cs
@@ -25,9 +25,6 @@
        {
            get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); }
        }
        public int guardOverdueIndex { get; set; }
        public Dictionary<int, string> guardOverdueIconDict { get; private set;}
        Dictionary<string,OverdueItem> itemStack = new Dictionary<string,OverdueItem>();
@@ -65,7 +62,7 @@
        {
            isdelay = true;
            GlobalTimeEvent.Instance.secondEvent -= UpdateSecond;
            guardOverdueIndex = -1;
            playerPack.ItemCntReduceAct -= UpdateItemCount;
            itemStack.Clear();
            itemGuids.Clear();
            currentShowItem = default(OverdueItem);
@@ -78,6 +75,7 @@
    
        public void OnPlayerLoginOk()
        {
            playerPack.ItemCntReduceAct += UpdateItemCount;
            GlobalTimeEvent.Instance.secondEvent += UpdateSecond;
            time = 0;
        }
@@ -166,6 +164,31 @@
            }
        }
        private void UpdateItemCount(PackType type, int index, int id)
        {
            if (type != PackType.rptItem || type != PackType.rptWarehouse) return;
            for(int i = 0; i < itemGuids.Count; i++)
            {
                string guid = itemGuids[i];
                ItemModel itemModel = playerPack.GetItemModelByGUID(guid);
                if(itemModel == null || itemModel.packType != PackType.rptItem)
                {
                    if (itemGuids.Contains(guid))
                    {
                        itemGuids.Remove(guid);
                    }
                    if (itemStack.ContainsKey(guid))
                    {
                        itemStack.Remove(guid);
                    }
                }
            }
            RefreshCurrrentShowUseItem();
        }
        private void OnGetOverdueItem(int itemId, string guid,int index)
        {
            var overdueItem = new OverdueItem(itemId,guid,index);
@@ -212,8 +235,8 @@
                    if (list.Count > 1)
                    {
                        SetAllGuardIdlist();
                        guardOverdueIndex = int.Parse(list[1].ToString());
                        ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptItem, guardOverdueIndex);
                        int index = int.Parse(list[1].ToString());
                        ItemModel itemModel = playerPack.GetItemModelByIndex(PackType.rptItem, index);
                        if (itemModel != null)
                        {
                            List<int> renewallist = GetRenewallist(itemModel.itemId);
@@ -244,15 +267,10 @@
                                        if (models != null && models.Count > 0)
                                        {
                                            ItemModel overdueModel = models[0];
                                            guardOverdueIndex = overdueModel.itemInfo.ItemPlace;
                                            OnGetOverdueItem(overdueModel.itemInfo.ItemID, overdueModel.itemInfo.ItemGUID, overdueModel.itemInfo.ItemPlace);
                                            break;
                                        }
                                    }
                                }
                                else
                                {
                                    guardOverdueIndex = -1;
                                }
                            }
                        }
@@ -310,9 +328,15 @@
                    for (int i = idlist.Count - 1; i > -1; i--)
                    {
                        models = allGuardDict[type][idlist[i]];
                        if(models != null && models.Count > 0)
                        if(models != null)
                        {
                            ItemModel itemModel = models[0];
                            bool isHave = false;
                            for(int j = 0; j < models.Count; j++)
                            {
                                ItemModel itemModel = models[j];
                                if(itemModel.packType == PackType.rptItem)
                                {
                                    isHave = true;
                            if (!overdueGuardPushlist.Contains(itemModel))
                            {
                                overdueGuardPushlist.Add(itemModel);
@@ -320,6 +344,12 @@
                            break;
                        }
                    }
                            if(isHave)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            for(int i = 0; i < overdueGuardPushlist.Count; i++)