Ejemplo n.º 1
0
 private void AddButtons()
 {
     for (int i = 0; i < itemList.Count; i++)
     {
         ShopItem   item   = itemList[i];
         GameObject button = GameObject.Instantiate(buttonPrefab.gameObject);
         button.transform.SetParent(contentPanel);
         button.transform.localScale = Vector3.one;
         ShopSampleButton sampleButton = button.GetComponent <ShopSampleButton>();
         sampleButton.Setup(item, this);
     }
 }
Ejemplo n.º 2
0
        public void TryTransferItemToOtherShop(ShopSampleButton button)
        {
            ShopItem item = button.Item;

            if (otherShop.gold >= item.price)
            {
                gold           += item.price;
                otherShop.gold -= item.price;
                this.RemoveItem(button);
                otherShop.AddItem(button);
                RefreshDisplay();
                otherShop.RefreshDisplay();
            }
        }
Ejemplo n.º 3
0
 private void RemoveItem(ShopSampleButton buttonToRemove)
 {
     itemList.Remove(buttonToRemove.Item);
     buttonList.Remove(buttonToRemove);
     buttonToRemove.SetScrollList(null);
 }
Ejemplo n.º 4
0
 private void AddItem(ShopSampleButton buttonToAdd)
 {
     itemList.Add(buttonToAdd.Item);
     buttonList.Add(buttonToAdd);
     buttonToAdd.SetScrollList(this);
 }