From 82931aabaaa3e479bc04e11630a77cd9c9dd5fe3 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期五, 26 十月 2018 20:05:36 +0800
Subject: [PATCH] Merge branch 'master' into leonard
---
System/KnapSack/Logic/ItemOverdueModel.cs | 68 ++++++++++++++++++++++++++--------
1 files changed, 52 insertions(+), 16 deletions(-)
diff --git a/System/KnapSack/Logic/ItemOverdueModel.cs b/System/KnapSack/Logic/ItemOverdueModel.cs
index f2faac0..d4b67cd 100644
--- a/System/KnapSack/Logic/ItemOverdueModel.cs
+++ b/System/KnapSack/Logic/ItemOverdueModel.cs
@@ -26,9 +26,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>();
@@ -66,7 +63,7 @@
{
isdelay = true;
GlobalTimeEvent.Instance.secondEvent -= UpdateSecond;
- guardOverdueIndex = -1;
+ playerPack.RefreshItemCountAct -= UpdateItemCount;
itemStack.Clear();
itemGuids.Clear();
currentShowItem = default(OverdueItem);
@@ -79,6 +76,7 @@
public void OnPlayerLoginOk()
{
+ playerPack.RefreshItemCountAct += UpdateItemCount;
GlobalTimeEvent.Instance.secondEvent += UpdateSecond;
time = 0;
}
@@ -167,6 +165,37 @@
}
}
+ private void UpdateItemCount(PackType type, int index, int id)
+ {
+ if (type != PackType.rptItem && type != PackType.rptWarehouse) return;
+ ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(id);
+ if (itemConfig == null || itemConfig.EquipPlace != (int)RoleEquipType.retSpiritAnimal) return;
+
+ bool isRemove = false;
+ for(int i = 0; i < itemGuids.Count; i++)
+ {
+ string guid = itemGuids[i];
+ ItemModel itemModel = playerPack.GetItemModelByGUID(guid);
+ if(itemModel == null || itemModel.packType != PackType.rptItem)
+ {
+ isRemove = true;
+ if (itemGuids.Contains(guid))
+ {
+ itemGuids.Remove(guid);
+ }
+
+ if (itemStack.ContainsKey(guid))
+ {
+ itemStack.Remove(guid);
+ }
+ }
+ }
+ if(isRemove)
+ {
+ RefreshCurrrentShowUseItem();
+ }
+ }
+
private void OnGetOverdueItem(int itemId, string guid,int index)
{
var overdueItem = new OverdueItem(itemId,guid,index);
@@ -213,8 +242,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);
@@ -245,15 +274,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;
}
}
}
@@ -311,14 +335,26 @@
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];
- if (!overdueGuardPushlist.Contains(itemModel))
+ bool isHave = false;
+ for(int j = 0; j < models.Count; j++)
{
- overdueGuardPushlist.Add(itemModel);
+ ItemModel itemModel = models[j];
+ if(itemModel.packType == PackType.rptItem)
+ {
+ isHave = true;
+ if (!overdueGuardPushlist.Contains(itemModel))
+ {
+ overdueGuardPushlist.Add(itemModel);
+ }
+ break;
+ }
}
- break;
+ if(isHave)
+ {
+ break;
+ }
}
}
}
--
Gitblit v1.8.0