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);
     }
 }
    //on mouse down, we'll instantiate our object and set it inactive until we drag the mouse off
    public void OnMouseDown()
    {
        StoreItemUI spawnedItem = Instantiate(item);

        spawnedItem.transform.position = GameObject.Find("LoadingSlot").transform.position;
        spawnedItem.startPurchaseProcess();
    }
Exemple #3
0
 void PopulateItems()
 {
     foreach (Transform t in itemsParent)
     {
         Destroy(t.gameObject);
     }
     uiItems = new List <StoreItemUI>();
     foreach (ScriptableStoreItem item in store.storeItems.items)
     {
         GameObject  GO        = Instantiate(itemPrefab, itemsParent);
         StoreItemUI newItemUI = GO.GetComponent <StoreItemUI>();
         newItemUI.Populate(this, item);
         uiItems.Add(newItemUI);
     }
 }
Exemple #4
0
    void OnStoreItemReady(ScriptableStoreItem item, Object asset)
    {
        // event is called at startup for downloaded items, then when bought&downloaded
        if (store.state.CurrentState == TreeviewStore.State.LOADING_DOWNLOADED_ITEMS)
        {
            //add asset items to Library
        }
        else
        {
            // hide item buy loading
            StoreItemUI itemUI = GetItemUI(item);
            itemUI.RefreshState();

            //add asset items to Library
        }
    }