Exemple #1
0
 public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     if(amountAdded > 0)
         menuManager.SpawnGiftFlys(false, amountAdded);
     else
         hud.ChangeBugCount(amountAdded);
 }
    private void UpdateCoinBalanceLabel(VirtualCurrency currency = null, float? newBalance = null)
    {
        currency = currency ?? StoreInfo.Currencies[0];

        var balance = newBalance.HasValue ? newBalance.Value : currency.GetBalance();

        BalanceLabel.text = balance + " " + currency.Name + "s";
    }
 // Descriptions of in-game currency
 public VirtualCurrency[] GetCurrencies()
 {
     VirtualCurrency seeds = new VirtualCurrency (
         "Seed", //Name
         "Seed currency", //Description
         "seed" //Currency ID
         );
     return new VirtualCurrency[] {seeds};
 }
Exemple #4
0
            public void PushEventOnCurrencyBalanceChanged(VirtualCurrency currency, int balance, int amountAdded)
            {
                var eventJSON = new JSONObject();

                eventJSON.AddField("itemId", currency.ItemId);
                eventJSON.AddField("balance", balance);
                eventJSON.AddField("amountAdded", amountAdded);

                _pushEventCurrencyBalanceChanged(eventJSON.print());
            }
Exemple #5
0
        /// <summary>
        /// Handles an <c>onCurrencyBalanceChanged</c> event, which is fired when the balance of a specific
        /// <c>VirtualCurrency</c> has changed.
        /// </summary>
        /// <param name="message">Message that contains information about the currency whose balance has
        /// changed.</param>
        public void onCurrencyBalanceChanged(string message)
        {
            SoomlaUtils.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]);

            StoreEvents.OnCurrencyBalanceChanged(vc, balance, amountAdded);
        }
        /// <summary>
        /// Takes a curtain amount of <c>VirtualCurrency</c> according to the given amount and the definition of this pack.
        /// </summary>
        /// <param name="amount">the amount of the specific item to be taken.</param>
        /// <param name="notify">notify of change in user's balance of current virtual item.</param>
        public override int Take(int amount, bool notify)
        {
            VirtualCurrency currency = null;

            try {
                currency = (VirtualCurrency)StoreInfo.GetItemByItemId(CurrencyItemId);
            } catch (VirtualItemNotFoundException) {
                SoomlaUtils.LogError(TAG, "VirtualCurrency with itemId: " + CurrencyItemId +
                                     " doesn't exist! Can't take this pack.");
                return(0);
            }
            return(VirtualCurrencyStorage.Remove(currency, CurrencyAmount * amount, notify));
        }
Exemple #7
0
        public void onCurrencyBalanceChanged(string message, bool alsoPush)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onCurrencyBalanceChanged:" + message);

            JSONObject eventJSON = new JSONObject(message);

            VirtualCurrency vc          = (VirtualCurrency)StoreInfo.GetItemByItemId(eventJSON["itemId"].str);
            int             balance     = (int)eventJSON["balance"].n;
            int             amountAdded = (int)eventJSON["amountAdded"].n;

            StoreInventory.RefreshOnCurrencyBalanceChanged(vc, balance, amountAdded);

            StoreEvents.OnCurrencyBalanceChanged(vc, balance, amountAdded);

            if (alsoPush)
            {
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
                sep.PushEventOnCurrencyBalanceChanged(vc, balance, amountAdded);
#endif
            }
        }
        public static void onCurrencyBalanceChanged(CurrencyBalanceChangedEvent _Event, bool alsoPush)
        {
            SoomlaWpStore.domain.virtualCurrencies.VirtualCurrency currency = _Event.GetCurrency();
            int balance     = _Event.GetBalance();
            int amountAdded = _Event.GetAmountAdded();

            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onCurrencyBalanceChanged" + currency.getItemId() + " " + balance.ToString() + " " + amountAdded.ToString());

            VirtualCurrency vc = (VirtualCurrency)StoreInfo.GetItemByItemId(currency.getItemId());

            StoreEvents.OnCurrencyBalanceChanged(vc, balance, amountAdded);

            StoreInventory.RefreshOnCurrencyBalanceChanged(vc, balance, amountAdded);

            //Why this line was added twice ??
            //StoreEvents.OnCurrencyBalanceChanged(vc, balance, amountAdded);

            if (alsoPush)
            {
                sep.PushEventOnCurrencyBalanceChanged(_Event);
            }
        }
		/// <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);
		}
Exemple #10
0
 public CurrencyBalanceChangedEvent(VirtualCurrency item, int balance, int amountAdded, Object sender) : base(sender)
 {
     mItem        = item;
     mBalance     = balance;
     mAmountAdded = amountAdded;
 }
Exemple #11
0
 public CurrencyBalanceChangedEvent(VirtualCurrency item, int balance, int amountAdded) : this(item, balance, amountAdded, null)
 {
 }
 /// <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)
 {
     mCtrl.UpdateUI();
 }
		public CurrencyBalanceChangedEvent (VirtualCurrency item , int balance, int amountAdded) : this(item,balance,amountAdded,null)
		{

		}
 private void OnCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance,int amountAdded)
 {
     setIt ();
 }
Exemple #15
0
 public static void RefreshOnCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     UpdateLocalBalance(virtualCurrency.ItemId, balance);
 }
		public CurrencyBalanceChangedEvent (VirtualCurrency item , int balance, int amountAdded, Object sender) : base(sender)
		{
			mItem = item ;
			mBalance = balance;
			mAmountAdded = amountAdded;
		}
Exemple #17
0
    private void OnCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
    {
        Debug.Log(string.Format("GNOME: CurrencyBalanceChanged - Balance: {0}", balance));
        this.tokens = balance;

        this.NotifyTokensChanged();
    }
Exemple #18
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)
 {
 }
Exemple #19
0
			public void PushEventOnCurrencyBalanceChanged(VirtualCurrency currency, int balance, int amountAdded) {
				var eventJSON = new JSONObject();
				eventJSON.AddField("itemId", currency.ItemId);
				eventJSON.AddField("balance", balance);
				eventJSON.AddField("amountAdded", amountAdded);

				_pushEventCurrencyBalanceChanged(eventJSON.print());
			}
 // updating counters, when balance of currency changed
 void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     ItemCounter.RefreshAll ();
 }
Exemple #21
0
 public static void RefreshOnCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     UpdateLocalBalance(virtualCurrency.ItemId, balance);
 }
 /// <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)
 {
 }