public List <Item> GetTypeItemList(Item.E_TYPE _Type) { List <Item> list = new List <Item>(); Dictionary <int, List <Item> > dic = null; if (m_DicItemData.TryGetValue(_Type, out dic)) { foreach (List <Item> l in dic.Values) { list.AddRange(l); } } return(list); }
public List <Item> FindItemsToID(Item.E_TYPE _Type, int _ItemID) { Dictionary <int, List <Item> > dic = null; if (m_DicItemData.TryGetValue(_Type, out dic)) { List <Item> list; if (dic.TryGetValue(_ItemID, out list)) { List <Item> req = new List <Item>(); for (int i = 0; i < list.Count; ++i) { req.Add(list[i]); } return(req); } } return(null); }
public Item FindItem(Item.E_TYPE _Type, int _ItemID, int _UniqueID) { Dictionary <int, List <Item> > dic = null; if (m_DicItemData.TryGetValue(_Type, out dic)) { List <Item> list; if (dic.TryGetValue(_ItemID, out list)) { for (int i = 0; i < list.Count; ++i) { if (list[i].m_UniqueID == _UniqueID) { return(list[i]); } } } } return(null); }
public void DeleteItem(Item.E_TYPE _Type, int _ItemID, int _UniqueID) { Dictionary <int, List <Item> > dic = null; if (m_DicItemData.TryGetValue(_Type, out dic)) { List <Item> list; if (dic.TryGetValue(_ItemID, out list)) { for (int i = 0; i < list.Count; ++i) { if (list[i].m_UniqueID == _UniqueID) { Item item = list[i]; list.RemoveAt(i); item.IsDestoryed = true; Destroy(item.gameObject); return; } } } } }
public void DestroyItem(Item.E_TYPE _Type, int _ItemID, int _UniqueID) { m_InventoryContainer.DeleteItem(_Type, _ItemID, _UniqueID); }
public List <Item> GetTypeItemList(Item.E_TYPE _Type, int _ItemID) { return(m_InventoryContainer.FindItemsToID(_Type, _ItemID)); }
public List <Item> GetTypeItemList(Item.E_TYPE _Type) { return(m_InventoryContainer.GetTypeItemList(_Type)); }
public void InventoryOpenTheTypeToID(Item.E_TYPE _Type, int _ItemID, int[] _ExclusionNumber = null) { Open(); m_CurrentTargetType = Item.E_TYPE.NONE; SortItemRefresh(_Type, _ItemID, _ExclusionNumber); }
public void InventoryOpen(Item.E_TYPE _FindType = Item.E_TYPE.NONE) { Open(); m_CurrentTargetType = _FindType; DefaultRefresh(); }
public void SortItemRefresh(Item.E_TYPE _Type, int _ItemID, int[] _ExclusionUniqueID) { if (m_Grid == null) { m_Grid = transform.Find("MaskField/Grid"); } List <Item> list = InventoryManager.Instance.GetTypeItemList(_Type, _ItemID); if (list == null) { for (int i = 0; i < m_Grid.childCount; ++i) { m_Grid.GetChild(i).gameObject.SetActive(false); } return; } else { if (_ExclusionUniqueID != null) { int count = _ExclusionUniqueID.Length; int number = 0; while (count > 0) { for (int i = 0; i < list.Count; ++i) { if (list[i].m_UniqueID == _ExclusionUniqueID[number]) { list.RemoveAt(i); break; } } --count; ++number; } } } m_CurrentInventoryCount = list.Count; if (m_CurrentInventoryCount > 0) { if (m_CurrentInventoryCount > m_Grid.childCount) { int interval = m_CurrentInventoryCount - m_Grid.childCount; for (int i = 0; i < interval; ++i) { GameObject g = Instantiate(m_SlotPrefab, m_Grid); m_ListInventorySlot.Add(g.GetComponent <InventorySlot>()); } } else if (m_CurrentInventoryCount < m_Grid.childCount) { for (int i = m_CurrentInventoryCount - 1; i < m_Grid.childCount; ++i) { m_Grid.GetChild(i).gameObject.SetActive(false); } } for (int i = 0; i < m_CurrentInventoryCount; ++i) { m_ListInventorySlot[i].Initialize(list[i], InventorySlot.E_USETYPE.REINFORCE, m_LobbyCanvasUI); } } else { for (int i = 0; i < m_Grid.childCount; ++i) { m_Grid.GetChild(i).gameObject.SetActive(false); } } }