public void UpdateBagItem(CItem Item) { if (!_updateItem(Item)) { CBagItem newitem = new CBagItem(); newitem.ItemData = Item; AddBagItem(newitem); } }
public bool getBagIndex(CItem a_item, out UInt32 a_index) { for (int i = 0; i < m_itemList.Count; ++i) { if (m_itemList[i].ItemData.ItemIndex == a_item.ItemIndex) { a_index = (UInt32)i; return(true); } } a_index = 0; return(false); }
private bool _updateItem(CItem a_item) { if (a_item.ItemCount == 0) { _deleteItem(a_item.ItemIndex); return(true); } for (int i = 0; i < m_itemList.Count; ++i) { if (m_itemList[i].ItemData.ItemIndex == a_item.ItemIndex) { m_itemList[i].ItemData = a_item; return(true); } } return(false); }
/// <summary> /// 设置背包数据 /// </summary> /// <param name="ItemData"></param> public void setPackageItemData(CItem ItemData) { m_ItemData = ItemData; }