/// <summary> /// 熔炼 /// </summary> /// <param name="module"></param> public void onSmeltingEquip(SocketModel module) { ItemMessage.MsgEquipResolveRep msg = MsgSerializer.Deserialize<ItemMessage.MsgEquipResolveRep>(module); List<MaterialItem> items = new List<MaterialItem>(); //mats加入背包 BagStruct bag = MonoInstancePool.getInstance<BagManager>().getMaterialBag(); for (int i = 0; i < msg.list.Count; i++) { MaterialItem item = new MaterialItem(); item.parseData(msg.list[i].id,msg.list[i].number); items.Add(item); bag.addItem(item); } EqptCtrl.instance.SmeltingCallBack(items); }
void RefreshMatItem() { List<int> newIds = new List<int>(); foreach (EquipmentItem i in curEquipItems) { foreach (int id in i.infoSmelt.GetMaterialIds()) { if (!newIds.Contains(id)) newIds.Add(id); } } mtlIds.Sort(); newIds.Sort(); bool isRefresh = false; if (mtlIds.Count != newIds.Count) { isRefresh = true; } else { for (int i = 0; i < mtlIds.Count; i++) { if (mtlIds[i] != newIds[i]) isRefresh = true; } } if (isRefresh) { foreach (MTLSlot slot in mtlSlots) { slot.Refresh(null); } int iMax = Mathf.Min(mtlSlots.Count, newIds.Count); for (int i = 0; i < iMax; i++) { MaterialItem item = new MaterialItem(); item.parseData(newIds[i]); mtlSlots[i].Refresh(item); } mtlIds = newIds; //Debug.Log("==============Additem" + newIds.Count); } }