public void StoreItem(int id) { if (itemDict.ContainsKey(id)) { Transform emptyGrid = gridPanelUI.GetEmptyGrid(); if (emptyGrid == null) { Debug.Log("背包满啦!!!"); return; } Item temp = itemDict[id]; //在空格子上创建新物品 CreateNewItem(emptyGrid, temp); } }
public void StoreItem(int itemId) { if (!ItemList.ContainsKey(itemId)) { return; } Item temp = ItemList[itemId]; //通过GridPanelUI来获取一个空的格子 Transform emptyGrid = GridPanelUI.GetEmptyGrid(); if (emptyGrid == null) { Debug.LogWarning("背包已满!"); return; } this.PutIntoGrid(temp, emptyGrid); }
public void StoreItem(int ID) { if (!ItemList.ContainsKey(ID)) { return; } Transform emptyGrid = gridPanelUI.GetEmptyGrid(); if (emptyGrid == null) { Debug.Log("Full"); return; } Item temp = ItemList[ID]; this.CreatNewItem(temp, emptyGrid); }
public void StoreItem(int itemId) { if (!ItemList.ContainsKey(itemId)) { return; } Transform emptyGrid = GridPanelUI.GetEmptyGrid(); //得到空格子的位置 if (emptyGrid == null) { Debug.LogWarning("背包已满!"); return; } Item temp = ItemList[itemId]; //通过itemId查找Dictionary中的Item this.CreateNewItem(temp, emptyGrid); }
public void StoreItem(int itemId) { if (!ItemList.ContainsKey(itemId)) { return; } Transform emptyGrid = GridPanelUI.GetEmptyGrid(); if (emptyGrid == null) { Debug.LogWarning("背包已满!!"); return; } Item temp = ItemList[itemId]; this.CreatNewItem(temp, emptyGrid); }
//添加一个Item public void StoreItem(int itemId) { if (!m_ItemList.ContainsKey(itemId)) { return; } Transform emptyGrid = m_GridPanelUI.GetEmptyGrid(); if (emptyGrid == null) { Debug.LogError("背包已满"); return; } Item currItem = m_ItemList[itemId]; this.CreateNewItem(currItem, emptyGrid); }