Beispiel #1
0
    protected void OnItemClicked(StorageItemUI storageItemUI, PointerEventData data)
    {
        int         remaining = 0;
        StorageItem item      = storageItemUI.StorageItem;

        ShopManager.Instance.AddShopItem(item.Definition.Type, 1);
        StorageManager.Instance.RemoveStorageItem(item.Definition.Type, 1, ref remaining);

        Accounts.Instance.SellItem(item.Definition.Cost);
        //shopItemUI.SetStoredQuantity(item.Quantity);
        // Debug.Log(item.Definition.DescriptiveName);
    }
Beispiel #2
0
    protected void OnItemAdded(StorageItem item)
    {
        StorageItemUI itemUI = Instantiate((Resources.Load("Prefabs/UI/StorageTile") as GameObject), content).GetComponent <StorageItemUI>();

        //Debug.Log("Trying to add item");

        itemUI.onClicked += OnItemClicked;

        itemUI.SetStorageItem(item);
        itemUI.SetStoredIcon(item.Definition.Icon);
        itemUI.SetStoredQuantity(item.Quantity);

        items.Add(item.Definition.Type, itemUI);

        if (items.Count > 0 && emptyText.enabled)
        {
            emptyText.enabled = false;
        }
    }