void ResetBtnStatus(INotifyArgs inotifyArgs) { SmsgActionColdWork smsgActionColdWork = (SmsgActionColdWork)inotifyArgs; if (smsgActionColdWork.sMsgActionColdWorkHead_SC.lMasterID == PlayerManager.Instance.FindHeroDataModel().SMsg_Header.uidEntity) { foreach (SMsgActionColdWork_SC child in smsgActionColdWork.sMsgActionColdWork_SCs) { //Debug.LogWarning("收到冷却消息:" + child.byClassID); if (child.byClassID == 1) { ColdItem((int)child.dwColdID, (int)child.dwColdTime / 1000); } } } }
void AddColdWork(object obj) { SmsgActionColdWork smsgActionColdWork = (SmsgActionColdWork)obj; //smsgActionColdWork.sMsgActionColdWork_SCs.ApplyAllItem(p => // { // Debug.LogWarning("[添加冷却事件]class = " + p.byClassID + "," + p.dwColdID + "," + p.dwColdTime); // }); foreach (var child in smsgActionColdWork.sMsgActionColdWork_SCs) { bool isContains = false; for (int i = 0; i < ColdWorkList.Count; i++) { if (ColdWorkList[i].ColdID == child.dwColdID && (byte)ColdWorkList[i].ColdClass == child.byClassID) { isContains = true; if (child.dwColdTime == 0) { ColdWorkList.RemoveAt(i); UIEventManager.Instance.TriggerUIEvent(UIEventType.RemoveColdWork, child); } else { ColdWorkInfo coldWorkItem = new ColdWorkInfo(smsgActionColdWork.sMsgActionColdWorkHead_SC.lMasterID, child.byClassID, child.dwColdID, child.dwColdTime); ColdWorkList[i] = coldWorkItem; UIEventManager.Instance.TriggerUIEvent(UIEventType.AddColdWork, coldWorkItem); //ColdWorkList[i].ColdTime = child.dwColdTime; } } } if (!isContains) { ColdWorkInfo newColdWorkItem = new ColdWorkInfo(smsgActionColdWork.sMsgActionColdWorkHead_SC.lMasterID, child.byClassID, child.dwColdID, child.dwColdTime); ColdWorkList.Add(newColdWorkItem); UIEventManager.Instance.TriggerUIEvent(UIEventType.AddColdWork, newColdWorkItem); } } }