GetItemBalance() public static method

Retrieves the balance of the virtual item with the given itemId.
Thrown if the item is not found.
public static GetItemBalance ( string itemId ) : int
itemId string Id of the virtual item to be fetched.
return int
Exemplo n.º 1
0
 void CheckIAP_PurchaseStatus()
 {
     if (StoreInventory.GetItemBalance("No_Ads_Item_ID") >= 1)
     {
         GameController.NO_ADS_UNLOCKED = true;
     }
 }
Exemplo n.º 2
0
        //will be called by soomla
        public void OnStoreInitialized()
        {
            Debug.Log("store init ");
            int timesPlayed = 0;

            if (PlayerPrefs.HasKey("times_played"))
            {
                timesPlayed = PlayerPrefs.GetInt("times_played");
            }

            Debug.Log(StoreInventory.GetItemBalance(MashinRunAssets.mashinRunCurrency.ItemId));
            if (timesPlayed == 0)
            {
                StoreInventory.BuyItem(MashinRunAssets.volksWagenCar.ItemId);
                StoreInventory.EquipVirtualGood(MashinRunAssets.volksWagenCar.ItemId);
            }
            timesPlayed++;
            PlayerPrefs.SetInt("times_played", timesPlayed);
            cars = DataManager.GetAllDataFromResourcesFolder
                   <GameObject>("Cars");
            Debug.Log("cars.Count " + cars.Count);
            Debug.Log("cars");
            Debug.Log("cars.Count" + cars.Count);
            camera = Camera.main;
        }
Exemplo n.º 3
0
        public void BuyCar()
        {
            Car showCasedCar = currentShowCasedCar.
                               GetComponentInChildren <Car>();

            if (StoreInventory.GetItemBalance(MashinRunAssets.
                                              MASHIN_RUN_CURRENCY_ITEM_ID) >= showCasedCar.carData.price)
            {
                showCasedCar.virtualGood.Buy("somepayload");
                UpdateUI();
            }
        }
Exemplo n.º 4
0
        public void AttemptBuyCar()
        {
            Car showCasedCar = currentShowCasedCar.
                               GetComponentInChildren <Car>();

            Debug.Log(((PurchaseWithVirtualItem)showCasedCar.virtualGood
                       .PurchaseType).Amount);
            if (StoreInventory.GetItemBalance(MashinRunAssets.
                                              MASHIN_RUN_CURRENCY_ITEM_ID) >= ((PurchaseWithVirtualItem)
                                                                               showCasedCar.virtualGood.PurchaseType).Amount /*price */)
            {
                uiManager.ShowDialog(buyDialog);
            }
            else
            {
                uiManager.ShowMessage(notEnoughMoneyMessage);
            }
        }
Exemplo n.º 5
0
        private bool checkTargetBalance(VirtualItem item)
        {
            int balance = StoreInventory.GetItemBalance(item.ItemId);

            return(balance >= Amount);
        }