Exemplo n.º 1
0
    public VirtualCurrency[] GetCurrencies()
    {
        VirtualCurrency[] currencies = new VirtualCurrency[Map_VirtualCurrencies.Count];
        Map_VirtualCurrencies.Values.CopyTo(currencies, 0);

        return(currencies);
    }
 /// <summary>
 /// Called when the currency balance changes.
 /// </summary>
 /// <param name="virtualCurrency">The currency whose balance was changed.</param>
 /// <param name="balance">The balance of the currency after the change.</param>
 /// <param name="amountAdded">The amount that was added to the currency balance.
 ///     (in case the amount was reduced, this will be a negative value)</param>
 private void OnCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     if (virtualCurrency.ItemId == CRCAssets.COIN_CURRENCY_ITEM_ID)
     {
         m_coinBalanceChangedDelegate.Invoke(balance);
     }
 }
    public void onGUI()
    {
        EditorGUILayout.Space();
        EditorGUILayout.LabelField ("Currencies:");
        EditorGUILayout.Space();
        EditorGUILayout.BeginVertical (GUI.skin.box);

        foreach (var currency in currencies) {
            currency.onGUI ();
        }

        if (GUILayout.Button ("Add currency...")) {
            var c = new VirtualCurrency("Name me!", new Dictionary<string, decimal>());
            config.currencies.Add(c);
            currencies.Add (new EditableCurrency(c));
        }

        EditorGUILayout.EndVertical ();

        currencies.RemoveAll (x => toRemove.Contains (x));
        foreach (var currency in toRemove) {
            config.currencies.Remove(currency.currency);
        }
        toRemove.Clear ();
    }
Exemplo n.º 4
0
    // Change the currency balance text when the balance changed
    public void OnCurrencyBalanceChanged(VirtualCurrency vc, int balance, int amountAdded)
    {
        GameObject temp_1 = GameObject.Find("store_ui_gr");

        if (temp_1 != null)
        {
            store_manager_script = temp_1.GetComponent <SOAPStoreManager>();
        }

        store_manager_script.setStoreCoinText();
        store_manager_script.setGameOverCoinText();
        store_manager_script.setPauseCoinText();

        // Unlock achievement for accumulating coins
        #if UNITY_ANDROID
        if (balance >= 20000 && balance < 100000)
        {
            Achievements.forARainyDayAchievement();
        }

        if (balance > 100000)
        {
            Achievements.mustHaveThemAllAchievement();
        }
        #endif
    }
Exemplo n.º 5
0
    private void OnCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
    {
        Debug.Log(string.Format("GNOME: CurrencyBalanceChanged - Balance: {0}", balance));
        this.tokens = balance;

        this.NotifyTokensChanged();
    }
Exemplo n.º 6
0
        public static void Init()
        {
//			List<VirtualCategory> category = StoreInfo.GetVirtualCategories();
            AndyUtils.LogDebug(TAG, "getting Virtual Goods");
            VirtualGoods = StoreInfo.GetVirtualGoods();
//			List<VirtualGood> good = StoreInfo.GetVirtualGoods ();
            AndyUtils.LogDebug(TAG, "getting Virtual Currency");
            VirtualCurrency = StoreInfo.GetVirtualCurrencies()[0];
            AndyUtils.LogDebug(TAG, "Got Virtual Currency");

            AndyUtils.LogDebug(TAG, "Seperating Virtual Goods by Category");

//			foreach (VirtualGood vg in good) {
//				Debug.Log ("AAUNITY/SOOMLA - VG name: " + vg.Name + ", id: " + vg.ItemId + ", category: " + StoreInfo.GetCategoryForVirtualGood(vg.ItemId).Name);
//				if(StoreInfo.GetCategoryForVirtualGood(vg.ItemId).Name == "Powerup") {
//					VirtualGoodPowerups.Add (vg);
//				}
//				if(StoreInfo.GetCategoryForVirtualGood(vg.ItemId).Name == "Upograde") {
//					VirtualGoodUpgrades.Add (vg);
//				}
//				if(StoreInfo.GetCategoryForVirtualGood(vg.ItemId).Name == "Unlockable") {
//					VirtualGoodUnlockables.Add(vg);
//				}
//			}
            AndyUtils.LogDebug(TAG, "Finished Seperating");

            VirtualCurrencyPacks = StoreInfo.GetVirtualCurrencyPacks();
            UpdateBalances();
        }
    public void onGUI()
    {
        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Currencies:");
        EditorGUILayout.Space();
        EditorGUILayout.BeginVertical(GUI.skin.box);

        foreach (var currency in currencies)
        {
            currency.onGUI();
        }

        if (GUILayout.Button("Add currency..."))
        {
            var c = new VirtualCurrency("Name me!", new Dictionary <string, decimal>());
            config.currencies.Add(c);
            currencies.Add(new EditableCurrency(c));
        }

        EditorGUILayout.EndVertical();

        currencies.RemoveAll(x => toRemove.Contains(x));
        foreach (var currency in toRemove)
        {
            config.currencies.Remove(currency.currency);
        }
        toRemove.Clear();
    }
Exemplo n.º 8
0
 public CurrencyBalanceChangedEvent(VirtualCurrency good, int balance, int amountAdded, object sender)
     : base(sender)
 {
     mCurrency    = good;
     mBalance     = balance;
     mAmountAdded = amountAdded;
 }
Exemplo n.º 9
0
 public void PostCurrencyBalanceChangedEvent(VirtualCurrency currency, int balance, int amountAdded)
 {
     LogEvent("CurrencyBalanceChanged");
     if (OnCurrencyBalanceChangedEvent != null)
     {
         OnCurrencyBalanceChangedEvent(currency, balance, amountAdded);
     }
 }
 public EditableCurrency(VirtualCurrency currency)
 {
     this.currency = currency;
     id            = currency.currencyId;
     foreach (var mapping in currency.mappings)
     {
         mappings.Add(new CurrencyMapping(mapping.Key, (int)mapping.Value, this));
     }
 }
Exemplo n.º 11
0
 public void OnCurrencyBalanceChanged(VirtualCurrency
                                      currency, int newBalance, int someOtherInt)
 {
     if (currency.ItemId == MashinRunAssets.
         MASHIN_RUN_CURRENCY_ITEM_ID)
     {
         moneyText.text = newBalance.ToString();
     }
 }
Exemplo n.º 12
0
    private void processCurrency(Dictionary <string, string> atts)
    {
        string          name     = atts["name"];
        VirtualCurrency currency = new VirtualCurrency(name,
                                                       atts["desc"],
                                                       atts["localID"]);

        currency.imageIconPath = atts["spriteIcon"];
        ourIAPAssets.Map_VirtualCurrencies[name] = currency;
    }
Exemplo n.º 13
0
    // Descriptions of in-game currency
    public VirtualCurrency[] GetCurrencies()
    {
        VirtualCurrency seeds = new VirtualCurrency(
            "Seed",            //Name
            "Seed currency",   //Description
            "seed"             //Currency ID
            );

        return(new VirtualCurrency[] { seeds });
    }
Exemplo n.º 14
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);
         }
     }
 }
Exemplo n.º 15
0
 public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     if (amountAdded > 0)
     {
         menuManager.SpawnGiftFlys(false, amountAdded);
     }
     else
     {
         hud.ChangeBugCount(amountAdded);
     }
 }
Exemplo n.º 16
0
    public void onCurrencyBalanceChanged(string message)
    {
        StoreUtils.LogDebug(TAG, "SOOMLA/UNITY onCurrencyBalanceChanged:" + message);

        string[] vars = Regex.Split(message, "#SOOM#");

        VirtualCurrency vc          = (VirtualCurrency)StoreInfo.GetItemByItemId(vars[0]);
        int             balance     = int.Parse(vars[1]);
        int             amountAdded = int.Parse(vars[2]);

        Events.OnCurrencyBalanceChanged(vc, balance, amountAdded);
    }
Exemplo n.º 17
0
    void UpdateValue(VirtualCurrency vc, int balance, int added)
    {
        if(vc.Name != currency) return;
	    //stop existing text animation routines,
	    //we don't want to have two running at the same time
        StopCoroutine("CountTo");

	    //if this gameobject is active and visible in our UI,
	    //start text animation to the current currency value
	    //(if it isn't active, the value will be updated in OnEnable())
        if(gameObject.activeInHierarchy)
            StartCoroutine("CountTo", balance);
    }
    // Descriptions of in-game currency
    public VirtualCurrency[] GetCurrencies()
    {
        VirtualCurrency seeds = new VirtualCurrency(
            "Seed",            //Name
            "Seed currency",   //Description
            "seed"             //Currency ID
            );
        VirtualCurrency gold = new VirtualCurrency(
            "Gold",
            "Gold currency",
            "gold");

        return(new VirtualCurrency[] { seeds, gold });
    }
 public void OnCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     if (virtualCurrency.ItemId == "charsoo_coin")
     {
         var playerInfo = Singleton.Instance.PlayerController.PlayerInfo;
         int coinCount  = playerInfo.CoinCount;
         if (coinCount != balance)
         {
             playerInfo.CoinCount = balance;
             Singleton.Instance.PlayerController.ChangePlayerInfo(playerInfo);
             Singleton.Instance.PurchaseManager.HcurrencyChanged();
         }
     }
 }
Exemplo n.º 20
0
 public IParseble Parse(JSONNode purchaseNode)
 {
     if (purchaseNode.Count == 0)
         return null;
     if(purchaseNode ["virtual_currency"] != null)
         virtualCurrency = new VirtualCurrency ().Parse (purchaseNode ["virtual_currency"]) as VirtualCurrency;
     if(purchaseNode ["virtual_items"] != null)
         virtualItems = new VirtualItems().Parse(purchaseNode ["virtual_items"]) as VirtualItems;
     if(purchaseNode ["subscription"] != null)
         subscription = new Subscription ().Parse (purchaseNode ["subscription"]) as Subscription;
     if(purchaseNode ["payment_system"] != null)
         paymentSystem = new PaymentSystem().Parse(purchaseNode ["payment_system"]) as PaymentSystem;
     if (purchaseNode ["checkout"] != null)
         checkout = new Checkout ().Parse(purchaseNode ["checkout"]) as Checkout;;
     return this;
 }
Exemplo n.º 21
0
    public MashinRunAssets()
    {
        mashinRunCurrency = new VirtualCurrency("Coin", "the currency of the mashin run game"
                                                , "com.mashinran.currency");
        moneyCategory = new VirtualCategory("money category"
                                            , new List <string>(new string[] { mashinRunCurrency.ItemId }));
        fiatCar = new EquippableVG
                      (EquippableVG.EquippingModel.GLOBAL, "fiat"
                      , "Fiat", "com.mashinrun.fiat", new PurchaseWithVirtualItem
                          (mashinRunCurrency.ItemId
                          , 2000));
        volksWagenCar = new EquippableVG
                            (EquippableVG.EquippingModel.GLOBAL, "volksWagen"
                            , "Volks wagen", "com.mashinrun.volkswagen", new PurchaseWithVirtualItem
                                (mashinRunCurrency.ItemId
                                , 0));
        sportCar = new EquippableVG(
            EquippableVG.EquippingModel.GLOBAL, "sportcar"
            , "Sport car", "com.mashinrun.sportcar", new PurchaseWithVirtualItem
                (mashinRunCurrency.ItemId, 20000));

        beetleCar = new EquippableVG(
            EquippableVG.EquippingModel.GLOBAL, "beetle"
            , "Beetle car", "com.mashinrun.beetle", new PurchaseWithVirtualItem
                (mashinRunCurrency.ItemId, 8000));

        twentyThousandCoinsPack = new VirtualCurrencyPack
                                      ("Fifty ThousandCoins", "Fifty thousand coins",
                                      "twenty_thousand_coins", 20000
                                      , mashinRunCurrency.ItemId, new PurchaseWithMarket
                                          (TWENTY_THOUSAND_COINS_PACK_ITEM_ID,
                                          20000));
        fiftyThousandCoinsPack = new VirtualCurrencyPack
                                     ("Fifty ThousandCoins", "Fifty thousand coins",
                                     "fifty_thousand_coins", 50000
                                     , mashinRunCurrency.ItemId, new PurchaseWithMarket
                                         (FIFTY_THOUSAND_COINS_PACK_ITEM_ID, 50000));

        tenThousandCoinsPack =
            new VirtualCurrencyPack("Ten ThousandCoins",
                                    "Ten thousand coins", "ten_thousand_coins"
                                    , 10000
                                    , mashinRunCurrency.ItemId, new PurchaseWithMarket
                                        ("com.mashinran.ten_thousand_coins", 10000));
    }
Exemplo n.º 22
0
 /// <summary>
 /// Handles a currency balance changed event.
 /// </summary>
 /// <param name="virtualCurrency">Virtual currency whose balance has changed.</param>
 /// <param name="balance">Balance of the given virtual currency.</param>
 /// <param name="amountAdded">Amount added to the balance.</param>
 public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
 }
Exemplo n.º 23
0
 /// <summary>
 /// Handles a currency balance changed event.
 /// </summary>
 /// <param name="virtualCurrency">Virtual currency whose balance has changed.</param>
 /// <param name="balance">Balance of the given virtual currency.</param>
 /// <param name="amountAdded">Amount added to the balance.</param>
 public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
 }
Exemplo n.º 24
0
 private void OnCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     setIt();
 }
Exemplo n.º 25
0
 public void onCurrencyBalanceChanged(VirtualCurrency vc, int balance, int amountAdded)
 {
     coinsText.text = StoreInventory.GetItemBalance(MyStoreAssets.COIN_CURRENCY_ITEM_ID).ToString();
 }
Exemplo n.º 26
0
        /** Private functions **/

        /**
         * Transforms given JObject to StoreInfo
         *
         * @param JObject
         * @throws JSONException
         */
        private static void fromJObject(JObject JObject)
        {
            mVirtualItems     = new Dictionary <String, VirtualItem>();
            mPurchasableItems = new Dictionary <String, PurchasableVirtualItem>();
            mGoodsCategories  = new Dictionary <String, VirtualCategory>();
            mGoodsUpgrades    = new Dictionary <String, List <UpgradeVG> >();
            mCurrencyPacks    = new List <VirtualCurrencyPack>();
            mGoods            = new List <VirtualGood>();
            mCategories       = new List <VirtualCategory>();
            mCurrencies       = new List <VirtualCurrency>();
            mNonConsumables   = new List <NonConsumableItem>();

            JToken value;

            if (JObject.TryGetValue(StoreJSONConsts.STORE_CURRENCIES, out value))
            {
                JArray virtualCurrencies = JObject.Value <JArray>(StoreJSONConsts.STORE_CURRENCIES);
                for (int i = 0; i < virtualCurrencies.Count; i++)
                {
                    JObject         o = virtualCurrencies.Value <JObject>(i);
                    VirtualCurrency c = new VirtualCurrency(o);
                    mCurrencies.Add(c);

                    mVirtualItems.Add(c.getItemId(), c);
                }
            }

            if (JObject.TryGetValue(StoreJSONConsts.STORE_CURRENCYPACKS, out value))
            {
                JArray currencyPacks = JObject.Value <JArray>(StoreJSONConsts.STORE_CURRENCYPACKS);
                for (int i = 0; i < currencyPacks.Count; i++)
                {
                    JObject             o    = currencyPacks.Value <JObject>(i);
                    VirtualCurrencyPack pack = new VirtualCurrencyPack(o);
                    mCurrencyPacks.Add(pack);

                    mVirtualItems.Add(pack.getItemId(), pack);

                    PurchaseType purchaseType = pack.GetPurchaseType();
                    if (purchaseType is PurchaseWithMarket)
                    {
                        mPurchasableItems.Add(((PurchaseWithMarket)purchaseType)
                                              .getMarketItem().getProductId(), pack);
                    }
                }
            }

            // The order in which VirtualGoods are created matters!
            // For example: VGU and VGP depend on other VGs
            if (JObject.TryGetValue(StoreJSONConsts.STORE_GOODS, out value))
            {
                JObject virtualGoods = JObject.Value <JObject>(StoreJSONConsts.STORE_GOODS);

                JToken valueVg;
                if (virtualGoods.TryGetValue(StoreJSONConsts.STORE_GOODS_SU, out valueVg))
                {
                    JArray suGoods = virtualGoods.Value <JArray>(StoreJSONConsts.STORE_GOODS_SU);
                    for (int i = 0; i < suGoods.Count; i++)
                    {
                        JObject     o = suGoods.Value <JObject>(i);
                        SingleUseVG g = new SingleUseVG(o);
                        addVG(g);
                    }
                }


                if (virtualGoods.TryGetValue(StoreJSONConsts.STORE_GOODS_LT, out valueVg))
                {
                    JArray ltGoods = virtualGoods.Value <JArray>(StoreJSONConsts.STORE_GOODS_LT);
                    for (int i = 0; i < ltGoods.Count; i++)
                    {
                        JObject    o = ltGoods.Value <JObject>(i);
                        LifetimeVG g = new LifetimeVG(o);
                        addVG(g);
                    }
                }


                if (virtualGoods.TryGetValue(StoreJSONConsts.STORE_GOODS_EQ, out valueVg))
                {
                    JArray eqGoods = virtualGoods.Value <JArray>(StoreJSONConsts.STORE_GOODS_EQ);
                    for (int i = 0; i < eqGoods.Count; i++)
                    {
                        JObject      o = eqGoods.Value <JObject>(i);
                        EquippableVG g = new EquippableVG(o);
                        addVG(g);
                    }
                }

                if (virtualGoods.TryGetValue(StoreJSONConsts.STORE_GOODS_PA, out valueVg))
                {
                    JArray paGoods = virtualGoods.Value <JArray>(StoreJSONConsts.STORE_GOODS_PA);
                    for (int i = 0; i < paGoods.Count; i++)
                    {
                        JObject         o = paGoods.Value <JObject>(i);
                        SingleUsePackVG g = new SingleUsePackVG(o);
                        addVG(g);
                    }
                }


                if (virtualGoods.TryGetValue(StoreJSONConsts.STORE_GOODS_UP, out valueVg))
                {
                    JArray upGoods = virtualGoods.Value <JArray>(StoreJSONConsts.STORE_GOODS_UP);
                    for (int i = 0; i < upGoods.Count; i++)
                    {
                        JObject   o = upGoods.Value <JObject>(i);
                        UpgradeVG g = new UpgradeVG(o);
                        addVG(g);

                        List <UpgradeVG> upgrades = mGoodsUpgrades[g.getGoodItemId()];
                        if (upgrades == null)
                        {
                            upgrades = new List <UpgradeVG>();
                            mGoodsUpgrades.Add(g.getGoodItemId(), upgrades);
                        }
                        upgrades.Add(g);
                    }
                }
            }

            // Categories depend on virtual goods. That's why the have to be initialized after!
            if (JObject.TryGetValue(StoreJSONConsts.STORE_CATEGORIES, out value))
            {
                JArray virtualCategories = JObject.Value <JArray>(StoreJSONConsts.STORE_CATEGORIES);
                for (int i = 0; i < virtualCategories.Count; i++)
                {
                    JObject         o        = virtualCategories.Value <JObject>(i);
                    VirtualCategory category = new VirtualCategory(o);
                    mCategories.Add(category);
                    foreach (String goodItemId in category.getGoodsItemIds())
                    {
                        mGoodsCategories.Add(goodItemId, category);
                    }
                }
            }

            if (JObject.TryGetValue(StoreJSONConsts.STORE_NONCONSUMABLES, out value))
            {
                JArray nonConsumables = JObject.Value <JArray>(StoreJSONConsts.STORE_NONCONSUMABLES);
                for (int i = 0; i < nonConsumables.Count; i++)
                {
                    JObject           o   = nonConsumables.Value <JObject>(i);
                    NonConsumableItem non = new NonConsumableItem(o);
                    mNonConsumables.Add(non);

                    mVirtualItems.Add(non.getItemId(), non);

                    PurchaseType purchaseType = non.GetPurchaseType();
                    if (purchaseType is PurchaseWithMarket)
                    {
                        mPurchasableItems.Add(((PurchaseWithMarket)purchaseType)
                                              .getMarketItem().getProductId(), non);
                    }
                }
            }
        }
 public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     ExampleLocalStoreInfo.UpdateBalances();
 }
Exemplo n.º 28
0
		public void onCurrencyBalancedChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded){
            //AndyUtils.LogDebug(TAG, "New currency balance is " + balance);
            //LocalStoreInfo.UpdateBalances();
		}
Exemplo n.º 29
0
		private static void fromJSONObject(JSONObject storeJSON)
		{
			VirtualItems = new Dictionary<string, VirtualItem> ();
			PurchasableItems = new Dictionary<string, PurchasableVirtualItem> ();
			GoodsCategories = new Dictionary<string, VirtualCategory> ();
			GoodsUpgrades = new Dictionary<string, List<UpgradeVG>> ();
			CurrencyPacks = new List<VirtualCurrencyPack> ();
			Goods = new List<VirtualGood> ();
			Categories = new List<VirtualCategory> ();
			Currencies = new List<VirtualCurrency> ();
			if (storeJSON.HasField (StoreJSONConsts.STORE_CURRENCIES)) {
				List<JSONObject> objs = storeJSON [StoreJSONConsts.STORE_CURRENCIES].list;
				foreach (JSONObject o in objs) {
					VirtualCurrency c = new VirtualCurrency (o);
					Currencies.Add (c);
				}
			}
			if (storeJSON.HasField (StoreJSONConsts.STORE_CURRENCYPACKS)) {
				List<JSONObject> objs = storeJSON [StoreJSONConsts.STORE_CURRENCYPACKS].list;
				foreach (JSONObject o in objs) {
					VirtualCurrencyPack c = new VirtualCurrencyPack (o);
					CurrencyPacks.Add (c);
				}
			}
			if (storeJSON.HasField (StoreJSONConsts.STORE_GOODS)) {
				JSONObject goods = storeJSON [StoreJSONConsts.STORE_GOODS];
				if (goods.HasField (StoreJSONConsts.STORE_GOODS_SU)) {
					List<JSONObject> suGoods = goods [StoreJSONConsts.STORE_GOODS_SU].list;
					foreach (JSONObject o in suGoods) {
						var c = new SingleUseVG (o);
						Goods.Add (c);
					}
				}
				if (goods.HasField (StoreJSONConsts.STORE_GOODS_LT)) {
					List<JSONObject> ltGoods = goods [StoreJSONConsts.STORE_GOODS_LT].list;
					foreach (JSONObject o in ltGoods) {
						LifetimeVG c = new LifetimeVG (o);
						Goods.Add (c);
					}
				}
				if (goods.HasField (StoreJSONConsts.STORE_GOODS_EQ)) {
					List<JSONObject> eqGoods = goods [StoreJSONConsts.STORE_GOODS_EQ].list;
					foreach (JSONObject o in eqGoods) {
						EquippableVG c = new EquippableVG (o);
						Goods.Add (c);
					}
				}
				if (goods.HasField (StoreJSONConsts.STORE_GOODS_PA)) {
					List<JSONObject> paGoods = goods [StoreJSONConsts.STORE_GOODS_PA].list;
					foreach (JSONObject o in paGoods) {
						SingleUsePackVG c = new SingleUsePackVG (o);
						Goods.Add (c);
					}
				}
				if (goods.HasField (StoreJSONConsts.STORE_GOODS_UP)) {
					List<JSONObject> upGoods = goods [StoreJSONConsts.STORE_GOODS_UP].list;
					foreach (JSONObject o in upGoods) {
						UpgradeVG c = new UpgradeVG (o);
						Goods.Add (c);
					}
				}
			}

			if (storeJSON.HasField(StoreJSONConsts.STORE_CATEGORIES)) {
				List<JSONObject> categories = storeJSON[StoreJSONConsts.STORE_CATEGORIES].list;
				foreach (JSONObject o in categories){
					VirtualCategory category = new VirtualCategory(o);
					Categories.Add(category);
				}
			}

			updateAggregatedLists ();
		}
Exemplo n.º 30
0
 public CurrencyBalanceChangedEvent(VirtualCurrency good, int balance, int amountAdded)
     : this(good, balance, amountAdded, null)
 {
 }
 /// <summary>
 /// Opens this <c>Gate</c> if the currency-balance changed event causes the <c>Gate</c>'s
 /// criteria to be met.
 /// </summary>
 /// <param name="virtualCurrency">Virtual currency whose balance changed.</param>
 /// <param name="balance">New balance.</param>
 /// <param name="amountAdded">Amount added.</param>
 public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     checkItemIdBalance(virtualCurrency.ItemId, balance);
 }
Exemplo n.º 32
0
	public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded) {
		// Update the UI with the new currency balance
	}
Exemplo n.º 33
0
 public EditableCurrency(VirtualCurrency currency)
 {
     this.currency = currency;
     id = currency.currencyId;
     foreach (var mapping in currency.mappings) {
         mappings.Add(new CurrencyMapping(mapping.Key, (int)mapping.Value, this));
     }
 }
Exemplo n.º 34
0
 public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     // Update the UI with the new currency balance
 }
Exemplo n.º 35
0
 public void onCurrencyBalancedChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     //AndyUtils.LogDebug(TAG, "New currency balance is " + balance);
     //LocalStoreInfo.UpdateBalances();
 }
Exemplo n.º 36
0
 private void UpdateCurrencyBalance(VirtualCurrency currency, int balance, int amountAdded)
 {
     WeakCurrency.Text   = StoreInventory.getVirtualItemBalance(StoreAssets.WEAK_CURRENCY_ITEM_ID).ToString();
     StrongCurrency.Text = StoreInventory.getVirtualItemBalance(StoreAssets.STRONG_CURRENCY_ITEM_ID).ToString();
 }
Exemplo n.º 37
0
 // updating counters, when balance of currency changed
 void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     ItemCounter.RefreshAll();
 }
Exemplo n.º 38
0
 public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     ExampleLocalStoreInfo.UpdateBalances();
 }
Exemplo n.º 39
0
        public void Prepare(int version, String JsonStoreAssets)
        {
            try
            {
                mVersion = version;

                JObject JObject = JObject.Parse(JsonStoreAssets);

                JArray virtualCurrencies = JObject.Value <JArray>(StoreJSONConsts.STORE_CURRENCIES);
                mVirtualCurrency = new VirtualCurrency[virtualCurrencies.Count];
                for (int i = 0; i < virtualCurrencies.Count; i++)
                {
                    JObject         o = virtualCurrencies.Value <JObject>(i);
                    VirtualCurrency c = new VirtualCurrency(o);
                    mVirtualCurrency[i] = c;
                }

                JArray currencyPacks = JObject.Value <JArray>(StoreJSONConsts.STORE_CURRENCYPACKS);
                mVirtualCurrencyPack = new VirtualCurrencyPack[currencyPacks.Count];
                for (int i = 0; i < currencyPacks.Count; i++)
                {
                    JObject             o    = currencyPacks.Value <JObject>(i);
                    VirtualCurrencyPack pack = new VirtualCurrencyPack(o);
                    mVirtualCurrencyPack[i] = pack;
                }

                // The order in which VirtualGoods are created matters!
                // For example: VGU and VGP depend on other VGs
                JObject            virtualGoods = JObject.Value <JObject>(StoreJSONConsts.STORE_GOODS);
                JArray             suGoods      = virtualGoods.Value <JArray>(StoreJSONConsts.STORE_GOODS_SU);
                JArray             ltGoods      = virtualGoods.Value <JArray>(StoreJSONConsts.STORE_GOODS_LT);
                JArray             eqGoods      = virtualGoods.Value <JArray>(StoreJSONConsts.STORE_GOODS_EQ);
                JArray             upGoods      = virtualGoods.Value <JArray>(StoreJSONConsts.STORE_GOODS_UP);
                JArray             paGoods      = virtualGoods.Value <JArray>(StoreJSONConsts.STORE_GOODS_PA);
                List <VirtualGood> goods        = new List <VirtualGood>();
                for (int i = 0; i < suGoods.Count; i++)
                {
                    JObject     o = suGoods.Value <JObject>(i);
                    SingleUseVG g = new SingleUseVG(o);
                    goods.Add(g);
                }
                for (int i = 0; i < ltGoods.Count; i++)
                {
                    JObject    o = ltGoods.Value <JObject>(i);
                    LifetimeVG g = new LifetimeVG(o);
                    goods.Add(g);
                }
                for (int i = 0; i < eqGoods.Count; i++)
                {
                    JObject      o = eqGoods.Value <JObject>(i);
                    EquippableVG g = new EquippableVG(o);
                    goods.Add(g);
                }
                for (int i = 0; i < paGoods.Count; i++)
                {
                    JObject         o = paGoods.Value <JObject>(i);
                    SingleUsePackVG g = new SingleUsePackVG(o);
                    goods.Add(g);
                }
                for (int i = 0; i < upGoods.Count; i++)
                {
                    JObject   o = upGoods.Value <JObject>(i);
                    UpgradeVG g = new UpgradeVG(o);
                    goods.Add(g);
                }

                mVirtualGood = new VirtualGood[goods.Count];
                for (int i = 0; i < goods.Count; i++)
                {
                    mVirtualGood[i] = goods[i];
                }

                // categories depend on virtual goods. That's why the have to be initialized after!
                JArray virtualCategories = JObject.Value <JArray>(StoreJSONConsts.STORE_CATEGORIES);
                mVirtualCategory = new VirtualCategory[virtualCategories.Count];
                for (int i = 0; i < virtualCategories.Count; i++)
                {
                    JObject         o        = virtualCategories.Value <JObject>(i);
                    VirtualCategory category = new VirtualCategory(o);
                    mVirtualCategory[i] = category;
                }

                JArray nonConsumables = JObject.Value <JArray>(StoreJSONConsts.STORE_NONCONSUMABLES);
                mNonConsumableItem = new NonConsumableItem[nonConsumables.Count];
                for (int i = 0; i < nonConsumables.Count; i++)
                {
                    JObject           o   = nonConsumables.Value <JObject>(i);
                    NonConsumableItem non = new NonConsumableItem(o);
                    mNonConsumableItem[i] = non;
                }
            }
            catch (Exception ex)
            {
                SoomlaUtils.LogError(TAG, "An error occurred while trying to prepare storeAssets" + ex.Message);
            }
        }
Exemplo n.º 40
0
    public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
    {
        Debug.Log("onCurrencyBalanceChanged");

        selectionPanel.UnselectAllButtons();
    }