Exemplo n.º 1
0
        /// <summary>
        /// Handles an <c>onGoodBalanceChanged</c> event, which is fired when the balance of a specific
        /// <c>VirtualGood</c> has changed.
        /// </summary>
        /// <param name="message">Message that contains information about the good whose balance has
        /// changed.</param>
        public void onGoodBalanceChanged(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGoodBalanceChanged:" + message);

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

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

            StoreEvents.OnGoodBalanceChanged(vg, balance, amountAdded);
        }
Exemplo n.º 2
0
        public static void onGoodBalanceChanged(GoodBalanceChangedEvent _Event, bool alsoPush)
        {
            SoomlaWpStore.domain.virtualGoods.VirtualGood good = _Event.GetGood();
            int balance     = _Event.GetBalance();
            int amountAdded = _Event.GetAmountAdded();

            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGoodBalanceChanged:" + good.getItemId() + " " + balance.ToString() + " " + amountAdded.ToString());

            VirtualGood vg = (VirtualGood)StoreInfo.GetItemByItemId(good.getItemId());

            StoreInventory.RefreshOnGoodBalanceChanged(vg, balance, amountAdded);
            StoreEvents.OnGoodBalanceChanged(vg, balance, amountAdded);

            if (alsoPush)
            {
                sep.PushEventOnGoodBalanceChanged(_Event);
            }
        }
Exemplo n.º 3
0
        public void onGoodBalanceChanged(string message, bool alsoPush)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGoodBalanceChanged:" + message);

            JSONObject eventJSON = new JSONObject(message);

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

            StoreInventory.RefreshOnGoodBalanceChanged(vg, balance, amountAdded);

            StoreEvents.OnGoodBalanceChanged(vg, balance, amountAdded);

            if (alsoPush)
            {
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
                sep.PushEventOnGoodBalanceChanged(vg, balance, amountAdded);
#endif
            }
        }