Пример #1
0
    void BuyVirtualItem(string itemId)
    {
        if (itemId != null)
        {
            switch (buyItemWith)
            {
            case BuyMethods.VirtualCurrency:
                if (StoreInventory.CanAfford(itemId))
                {
                    StoreInventory.BuyItem(itemId);
                }
                else
                {
                    Debug.Log("You Dont Have Enough Balance to Buy this Product !");
                }
                break;

            case BuyMethods.Upgrade:
                if (StoreInventory.CanAfford(itemId))
                {
                    StoreInventory.UpgradeGood(itemId);
                }
                else
                {
                    Debug.Log("You Dont Have Enough Balance to Buy this Product !");
                }
                break;

            case BuyMethods.Market:
                SoomlaStore.BuyMarketItem(itemId, "Developer Payload");
                break;
            }
        }
    }
Пример #2
0
        public void setupItemsAffordability()
        {
            itemsAffordability = new Dictionary <string, bool> ();

            foreach (VirtualGood vg in StoreInfo.Goods)
            {
                itemsAffordability.Add(vg.ID, StoreInventory.CanAfford(vg.ID));
            }
        }
Пример #3
0
 public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     if (itemsAffordability != null)
     {
         List <string> keys = new List <string> (itemsAffordability.Keys);
         foreach (string key in keys)
         {
             itemsAffordability[key] = StoreInventory.CanAfford(key);
         }
     }
 }
Пример #4
0
    void OnElementBuy()
    {
        if (StoreInventory.CanAfford(id))
        {
//			MAudioManager.current.PlayFx (AudioName.PurchaseClick);
            StoreInventory.BuyItem(id);
            bought();
        }
//		} else {
//			GameObject.FindGameObjectWithTag(Constants.TAG_HUD).GetComponent<HUD>().OpenMenu((int) MenuState.Shop_GoldFishMenu);
//		}
    }
Пример #5
0
 void _OnElementBuy()
 {
     if (upgrades)
     {
         int upgdLevel = StoreInventory.GetGoodUpgradeLevel(id);
         if (StoreInventory.GetItemBalance(AnimineStoreAssets.GOLD_COIN_VC_ITEM_ID) >= AnimineStoreAssets.UPGRADE_PRICE[upgdLevel])
         {
             StoreInventory.UpgradeGood(id);
         }
     }
     else
     {
         if (StoreInventory.CanAfford(id) && StoreInventory.GetItemBalance(id) < 5)
         {
             //MAudioManager.current.PlayFx (AudioName.PurchaseClick);
             StoreInventory.BuyItem(id);
         }
     }
 }
Пример #6
0
    // Update the store button prices
    public void updatePrices(string item_id)
    {
        // Default avatars and tails
        if (item_id == "default_avatar" || item_id == "default_tail" || item_id == "orange_avatar" || item_id == "orange_tail")
        {
            coin_buy_button.gameObject.SetActive(false);
            money_buy_button.gameObject.SetActive(false);
            avatar_purchase_info.SetActive(true);
            reward_description_go.SetActive(false);
        }

        // Check balance of reward avatar
        else if (RewardedAvatars.avatar_balance_index_map.ContainsKey(item_id))
        {
            coin_buy_button.gameObject.SetActive(false);
            money_buy_button.gameObject.SetActive(false);

            if (RewardedAvatars.isAvatarUnlocked(item_id))
            {
                avatar_purchase_info.SetActive(true);
                reward_description_go.SetActive(false);
            }
            else
            {
                avatar_purchase_info.SetActive(false);
                reward_description_go.SetActive(true);
                reward_description_go.GetComponent <Text>().text = RewardedAvatars.avatar_earn_text_map[item_id];
            }
        }

        // For all other avatars update the prices
        else
        {
            string[] price_list = getPrices(item_id);
            coin_buy_button.GetComponentInChildren <Text>().text  = price_list[0];
            money_buy_button.GetComponentInChildren <Text>().text = "$" + price_list[1];

            bool can_afford = StoreInventory.CanAfford(item_id);

            // If user cannot afford disable the coin buy button
            if (can_afford)
            {
                coin_buy_button.enabled = true;
            }
            else
            {
                coin_buy_button.enabled = false;
            }

            // If user already bought don't show the buy buttons
            if (StoreInventory.GetItemBalance(item_id) == 1 || StoreInventory.GetItemBalance("soap_" + item_id) == 1)
            {
                coin_buy_button.gameObject.SetActive(false);
                money_buy_button.gameObject.SetActive(false);
                reward_description_go.SetActive(false);
                avatar_purchase_info.SetActive(true);
            }
            else
            {
                coin_buy_button.gameObject.SetActive(true);
                money_buy_button.gameObject.SetActive(true);
                reward_description_go.SetActive(false);
                avatar_purchase_info.SetActive(false);
            }
        }
    }
 /// <summary>
 /// Determines whether player can afford a gacha round.
 /// </summary>
 public bool CanAffordGacha()
 {
     return(StoreInventory.CanAfford(CRCAssets.GACHA_ITEM_ID));
 }