Beispiel #1
0
 void DrawStore()
 {
     ClearStoreItems();
     foreach (InventoryItemStack itemStack in StoreInventory.ContainedStacks)
     {
         StoreItemUI itemUI = Instantiate(ItemUI, StoreItemsContainer);
         itemUI.ItemIcon.sprite     = itemStack.ContainedItem.Icon;
         itemUI.ItemAmountText.text = itemStack.Amount.ToString();
         itemUI.ItemNameText.text   = itemStack.ContainedItem.Name;
         float price = itemStack.ContainedItem.Value + (itemStack.ContainedItem.Value * (itemStack.ContainedItem.Markup / 100));
         itemUI.ItemPriceText.text = price.ToString("F2");
         itemUI.GetComponent <Button>().onClick.AddListener(
             delegate()
         {
             AddToBasket(itemStack);
         }
             );
     }
     if (StoreInventory.ContainedStacks.Count > 0)
     {
         SoldOutText.gameObject.SetActive(false);
     }
     else
     {
         SoldOutText.gameObject.SetActive(true);
     }
 }
 // Use this for initialization
 void Start()
 {
     GetComponent <Image>().sprite = item.GetComponent <Item>().getImage();
 }