public void SetItemObj(ItemObj itemobj) { if (itemobj == null) { Clear(); return; } mPackType = itemobj.PackType; mPackPos = itemobj.PackPos; mItemID = itemobj.GetResId(); SetResID(mItemID); SetNumber(itemobj.GetCount()); if (itemobj is DefenceObj) { DefenceObj defenceObj = itemobj as DefenceObj; if (defenceObj != null) { SetStrenLv(defenceObj.GetStrenLv()); SetStonePic(defenceObj.GetStonePic()); SetStarsLvPic(defenceObj.GetStarsLvPic()); } else { SetStrenLv(-1); SetStonePic(null); SetStarsLvPic(null); } } }
public void SyncDiffItem(role_bag_diff_info diff_info) { if (diff_info.bagType <= (int)PackageType.Invalid || diff_info.bagType >= (int)PackageType.Pack_Max) { return; } ItemObj itemObj = ItemManager.Instance.CreateItem(diff_info.item.item); if (itemObj != null) { PutItem(itemObj, (PackageType)diff_info.bagType, diff_info.item.pos); } else { RemoveItem((PackageType)diff_info.bagType, diff_info.item.pos); } ItemEvent evt = new ItemEvent(ItemEvent.UPDATE_CHANGE); evt.bagType = (PackageType)diff_info.bagType; evt.itemId = (itemObj != null) ? itemObj.GetResId() : -1; evt.pos = diff_info.item.pos; EventSystem.Instance.PushEvent(evt); }