BuyItem() public static method

Buys the item with the given itemId.
Thrown if the item to be bought is not found. Thrown if the user does not have enough funds.
public static BuyItem ( string itemId ) : void
itemId string id of item to be bought
return void
Exemplo n.º 1
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.º 2
0
 void OnMouseUp()
 {
     try {
         Debug.Log("attempt to purchase");
         StoreInventory.BuyItem("No_Ads_Item_ID");
     }
     catch (Exception e) {
         this.GetComponent <AudioSource>().Play();
         Debug.Log("SOOMLA/UNITY" + e.Message);
     }
 }