EquipVirtualGood() public static method

Equips the virtual good with the given goodItemId. Equipping means that the user decides to currently use a specific virtual good. For more details and examples com.soomla.store.domain.virtualGoods.EquippableVG.
Thrown if the item is not found.
public static EquipVirtualGood ( string goodItemId ) : void
goodItemId string Id of the good to be equipped.
return void
Exemplo n.º 1
0
 void SpawnCars()
 {
     Debug.Log("spawner car count " + cars.Count);
     try
     {
         Debug.Log("try " + "cars.Count"
                   + cars.Count);
         for (int i = 0; i < cars.Count; i++)
         {
             Debug.Log("cars[i]" + cars[i]);
             Debug.Log("showCaseTransform" + showCaseTransform);
             //instantiate cars from assets into scene
             cars[i] = Instantiate(cars[i]);
             cars[i].transform.parent =
                 platform.transform;
             cars[i].transform.position
                 = showCaseTransform.position;
             cars[i].SetActive(false);
         }
         //put currently selected car on platform
         foreach (GameObject car in cars)
         {
             Debug.Log(car.GetComponentInChildren <Car>());
             if ((car) && (car.GetComponentInChildren <Car>()) &&
                 (StoreInventory.IsVirtualGoodEquipped(car
                                                       .GetComponentInChildren <Car>().virtualGood.ItemId)))
             {
                 selectedCar = car;
                 break;
             }
         }
         if (!selectedCar) // if there's no selected car
         {
             Debug.Log("no selected car");
             //mark a bought car as selected
             foreach (GameObject car in cars)
             {
                 // at the beginning there's at least one bought car
                 if ((car) && (car.GetComponentInChildren <Car>()) &&
                     (car.GetComponentInChildren <Car>().virtualGood
                      .GetBalance() > 0))
                 {
                     selectedCar = car;
                     StoreInventory.EquipVirtualGood(car
                                                     .GetComponentInChildren <Car>().virtualGood.ItemId);
                     break;
                 }
             }
         }
         //sort by price
         cars = cars.OrderBy(o => o.GetComponentInChildren
                             <Car>().carData
                             .price).ToList <GameObject>();
         areCarsSpawned = true;
     }
     catch (Exception e)
     {
         Debug.Log("i caught this err " + e);
     }
 }
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 SelectCar()
 {
     //soomla will automatically unequip all other cars.
     //equip the current showcased car.
     StoreInventory.EquipVirtualGood(currentShowCasedCar.GetComponentInChildren <Car>
                                         ()
                                     .virtualGood.ItemId);
     selectedCar = currentShowCasedCar;
     UpdateUI();
 }