public void Setup(CharacterButtonInfo buttonInfo, CharacterScrollList currentScrollList) { item = buttonInfo; nameLabel.text = item.Name; // iconImage.sprite = item.icon; // priceText.text = item.price.ToString(); scrollList = currentScrollList; }
private void RemoveItem(CharacterButtonInfo itemToRemove, CharacterScrollList shopList) { for (int i = shopList.itemList.Count - 1; i >= 0; i--) { if (shopList.itemList[i] == itemToRemove) { shopList.itemList.RemoveAt(i); } } }
public void TryTransferItemToOtherShop(CharacterButtonInfo item) { // gold += item.price; // otherShop.gold -= item.price; AddItem(item, otherShop); RemoveItem(item, this); RefreshDisplay(); otherShop.RefreshDisplay(); Debug.Log("enough gold"); Debug.Log("attempted"); }
private void AddButtons() { Debug.Log("AddButtons" + itemList.Count.ToString()); for (int i = 0; i < itemList.Count; i++) { CharacterButtonInfo item = itemList[i]; Debug.Log("Button " + item.Name); GameObject newButton = buttonObjectPool.GetObject(); newButton.transform.SetParent(contentPanel); CharacterButton sampleButton = newButton.GetComponent <CharacterButton>(); sampleButton.Setup(item, this); } }
void AddItem(CharacterButtonInfo itemToAdd, CharacterScrollList characterList) { characterList.itemList.Add(itemToAdd); }