An upgrade virtual good is one VG in a series of VGs that define an upgrade scale of an associated VirtualGood. This type of virtual good is best explained with an example: Let's say there's a strength attribute to one of the characters in your game and that strength is on a scale of 1-5. You want to provide your users with the ability to upgrade that strength. This is what you'll need to create: 1. SingleUseVG for 'strength' 2. UpgradeVG for strength 'level 1' 3. UpgradeVG for strength 'level 2' 4. UpgradeVG for strength 'level 3' 5. UpgradeVG for strength 'level 4' 6. UpgradeVG for strength 'level 5' When the user buys this UpgradeVG, we check and make sure the appropriate conditions are met and buy it for you (which actually means we upgrade the associated VirtualGood). NOTE: In case you want this item to be available for purchase with real money you will need to define the item in the market (App Store, Google Play...). Inheritance: UpgradeVG > com.soomla.store.domain.virtualGoods.VirtualGood > com.soomla.store.domain.PurchasableVirtualItem > com.soomla.store.domain.VirtualItem
Inheritance: Soomla.Store.LifetimeVG
Exemple #1
0
        public void onGoodUpgrade(string message, bool alsoPush)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGoodUpgrade:" + message);

            var eventJSON = new JSONObject(message);

            VirtualGood vg  = (VirtualGood)StoreInfo.GetItemByItemId(eventJSON["itemId"].str);
            UpgradeVG   vgu = null;

            if (eventJSON.HasField("upgradeItemId") && !string.IsNullOrEmpty(eventJSON["upgradeItemId"].str))
            {
                vgu = (UpgradeVG)StoreInfo.GetItemByItemId(eventJSON["upgradeItemId"].str);
            }

            StoreInventory.RefreshOnGoodUpgrade(vg, vgu);

            StoreEvents.OnGoodUpgrade(vg, vgu);

            if (alsoPush)
            {
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
                sep.PushEventOnGoodUpgrade(vg, vgu);
#endif
            }
        }
        /// <summary>
        /// Assigns a specific upgrade to the given virtual good.
        /// </summary>
        /// <param name="good">the virtual good to upgrade.</param>
        /// <param name="upgradeVG">the upgrade to assign.</param>
        /// <param name="notify">true will also post event.</param>
        public static void AssignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify)
        {
            SoomlaUtils.LogDebug(TAG, "Assigning upgrade " + upgradeVG.ItemId + " to virtual good: "
                                 + good.ItemId);

            instance._assignCurrentUpgrade(good, upgradeVG, notify);
        }
Exemple #3
0
        /// <summary>
        /// Retrieves the upgrade level of the virtual good with the given <c>goodItemId</c>.
        /// For Example:
        /// Let's say there's a strength attribute to one of the characters in your game and you provide
        /// your users with the ability to upgrade that strength on a scale of 1-3.
        /// This is what you've created:
        /// 1. <c>SingleUseVG</c> for "strength".
        /// 2. <c>UpgradeVG</c> for strength 'level 1'.
        /// 3. <c>UpgradeVG</c> for strength 'level 2'.
        /// 4. <c>UpgradeVG</c> for strength 'level 3'.
        /// In the example, this function will retrieve the upgrade level for "strength" (1, 2, or 3).
        /// </summary>
        /// <param name="goodItemId">Good item identifier.</param>
        /// <returns>The good upgrade level.</returns>
        /// <exception cref="VirtualItemNotFoundException">Thrown if the item is not found.</exception>
        public static int GetGoodUpgradeLevel(string goodItemId)
        {
            SoomlaUtils.LogDebug(TAG, "Checking " + goodItemId + " upgrade level");

            VirtualGood good = (VirtualGood)StoreInfo.GetItemByItemId(goodItemId);

            if (good == null)
            {
                SoomlaUtils.LogError(TAG, "You tried to get the level of a non-existant virtual good.");
                return(0);
            }
            UpgradeVG upgradeVG = VirtualGoodsStorage.GetCurrentUpgrade(good);

            if (upgradeVG == null)
            {
                return(0);                //no upgrade
            }

            UpgradeVG first = StoreInfo.GetFirstUpgradeForVirtualGood(goodItemId);
            int       level = 1;

            while (first.ItemId != upgradeVG.ItemId)
            {
                first = (UpgradeVG)StoreInfo.GetItemByItemId(first.NextItemId);
                level++;
            }

            return(level);
        }
Exemple #4
0
        /// <summary>
        /// Upgrades the virtual good with the given <c>goodItemId</c> by doing the following:
        /// 1. Checks if the good is currently upgraded or if this is the first time being upgraded.
        /// 2. If the good is currently upgraded, upgrades to the next upgrade in the series.
        /// In case there are no more upgrades available(meaning the current upgrade is the last available),
        /// the function returns.
        /// 3. If the good has never been upgraded before, the function upgrades it to the first
        /// available upgrade with the first upgrade of the series.
        /// </summary>
        /// <param name="goodItemId">Good item identifier.</param>
        /// <exception cref="VirtualItemNotFoundException">Thrown if the item is not found.</exception>
        public static void UpgradeGood(string goodItemId)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY Calling UpgradeGood with: " + goodItemId);
            VirtualGood good = (VirtualGood)StoreInfo.GetItemByItemId(goodItemId);

            UpgradeVG upgradeVG = VirtualGoodsStorage.GetCurrentUpgrade(good);

            if (upgradeVG != null)
            {
                String nextItemId = upgradeVG.NextItemId;
                if (string.IsNullOrEmpty(nextItemId))
                {
                    return;
                }
                UpgradeVG vgu = (UpgradeVG)StoreInfo.GetItemByItemId(nextItemId);
                vgu.Buy("");
            }
            else
            {
                UpgradeVG first = StoreInfo.GetFirstUpgradeForVirtualGood(goodItemId);
                if (first != null)
                {
                    first.Buy("");
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// This function refreshes a local set of objects that will hold your user's balances in memory for quick
        /// and more efficient fetching for your game UI.
        /// This way, we save many JNI or static calls to native platforms.
        ///
        /// NOTE: You don't need to call this function as it's automatically called when the game initializes.
        /// NOTE: This is less useful when you work in editor.
        /// </summary>
        public static void RefreshLocalInventory()
        {
            SoomlaUtils.LogDebug(TAG, "Refreshing local inventory");

            localItemBalances  = new Dictionary <string, int> ();
            localUpgrades      = new Dictionary <string, LocalUpgrade>();
            localEquippedGoods = new HashSet <string>();

            foreach (VirtualCurrency item in StoreInfo.Currencies)
            {
                localItemBalances[item.ItemId] = VirtualCurrencyStorage.GetBalance(item);
            }

            foreach (VirtualGood item in StoreInfo.Goods)
            {
                localItemBalances[item.ItemId] = VirtualGoodsStorage.GetBalance(item);

                UpgradeVG upgrade = VirtualGoodsStorage.GetCurrentUpgrade(item);
                if (upgrade != null)
                {
                    int upgradeLevel = GetGoodUpgradeLevel(item.ItemId);
                    localUpgrades.AddOrUpdate(item.ItemId, new LocalUpgrade {
                        itemId = upgrade.ItemId, level = upgradeLevel
                    });
                }

                if (item is EquippableVG)
                {
                    if (VirtualGoodsStorage.IsEquipped((EquippableVG)item))
                    {
                        localEquippedGoods.Add(item.ItemId);
                    }
                }
            }
        }
		protected override void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify) {
			AndroidJNI.PushLocalFrame(100);
			using(AndroidJavaClass jniStorageManager = new AndroidJavaClass("com.soomla.store.data.StorageManager")) {
				using(AndroidJavaObject jniVGStorage = jniStorageManager.CallStatic<AndroidJavaObject>("getVirtualGoodsStorage")) {
					jniVGStorage.Call("assignCurrentUpgrade", good.ItemId, upgradeVG.ItemId, notify);
				}
			}
			AndroidJNI.PopLocalFrame(IntPtr.Zero);
		}
Exemple #7
0
            public void PushEventOnGoodUpgrade(VirtualGood good, UpgradeVG upgrade)
            {
                var eventJSON = new JSONObject();

                eventJSON.AddField("itemId", good.ItemId);
                eventJSON.AddField("upgradeItemId", (upgrade == null ? null : upgrade.ItemId));

                _pushEventGoodUpgrade(eventJSON.print());
            }
Exemple #8
0
 protected override void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify)
 {
     AndroidJNI.PushLocalFrame(100);
     using (AndroidJavaClass jniStorageManager = new AndroidJavaClass("com.soomla.store.data.StorageManager")) {
         using (AndroidJavaObject jniVGStorage = jniStorageManager.CallStatic <AndroidJavaObject>("getVirtualGoodsStorage")) {
             jniVGStorage.Call("assignCurrentUpgrade", good.ItemId, upgradeVG.ItemId, notify);
         }
     }
     AndroidJNI.PopLocalFrame(IntPtr.Zero);
 }
 /// <summary>
 /// Gets the first upgrade for virtual good with the given <c>goodItemId</c>.
 /// </summary>
 /// <param name="goodItemId">Item id.</param>
 /// <returns>The first upgrade for virtual good with the given id.</returns>
 protected override UpgradeVG _getFirstUpgradeForVirtualGood(string goodItemId)
 {
     UpgradeVG vgu = null;
     AndroidJNI.PushLocalFrame(100);
     using(AndroidJavaObject jniUpgradeVG = AndroidJNIHandler.CallStatic<AndroidJavaObject>(
         new AndroidJavaClass("com.soomla.store.data.StoreInfo"),"getGoodFirstUpgrade", goodItemId)) {
         vgu = new UpgradeVG(jniUpgradeVG);
     }
     AndroidJNI.PopLocalFrame(IntPtr.Zero);
     return vgu;
 }
        /// <summary>
        /// Gets the last upgrade for the virtual good with the given <c>goodItemId</c>.
        /// </summary>
        /// <param name="goodItemId">item id</param>
        /// <returns>last upgrade for virtual good with the given id</returns>
        override protected UpgradeVG _getLastUpgradeForVirtualGood(string goodItemId)
        {
            UpgradeVG vgu = null;

            AndroidJNI.PushLocalFrame(100);
            using (AndroidJavaObject jniUpgradeVG = AndroidJNIHandler.CallStatic <AndroidJavaObject>(
                       new AndroidJavaClass("com.soomla.store.data.StoreInfo"), "getGoodLastUpgrade", goodItemId)) {
                vgu = new UpgradeVG(jniUpgradeVG);
            }
            AndroidJNI.PopLocalFrame(IntPtr.Zero);
            return(vgu);
        }
Exemple #11
0
        /// <summary>
        /// Retrieves the current upgrade of the good with the given id.
        /// </summary>
        /// <param name="goodItemId">Id of the good whose upgrade we want to fetch. </param>
        /// <returns>The good's current upgrade.</returns>
        /// <exception cref="VirtualItemNotFoundException">Thrown if the item is not found.</exception>
        public static string GetGoodCurrentUpgrade(string goodItemId)
        {
            SoomlaUtils.LogDebug(TAG, "Checking " + goodItemId + " current upgrade");

            VirtualGood good = (VirtualGood)StoreInfo.GetItemByItemId(goodItemId);

            UpgradeVG upgradeVG = VirtualGoodsStorage.GetCurrentUpgrade(good);

            if (upgradeVG == null)
            {
                return("");
            }
            return(upgradeVG.ItemId);
        }
Exemple #12
0
        /// <summary>
        /// Takes upgrade from the user, or in other words DOWNGRADES the associated
        /// <code>VirtualGood</code> (mGood).
        /// Checks if the current Upgrade is really associated with the <code>VirtualGood</code> and:
        /// </summary>
        /// <param name="amount">NOT USED HERE!.</param>
        /// <param name="notify">see parent.</param>
        public override int Take(int amount, bool notify)
        {
            VirtualGood good = null;

            try {
                good = (VirtualGood)StoreInfo.GetItemByItemId(GoodItemId);
            } catch (VirtualItemNotFoundException) {
                SoomlaUtils.LogError(TAG, "VirtualGood with itemId: " + GoodItemId
                                     + " doesn't exist! Can't downgrade.");
                return(0);
            }

            UpgradeVG upgradeVG = VirtualGoodsStorage.GetCurrentUpgrade(good);

            // Case: Upgrade is not assigned to this Virtual Good
            if (upgradeVG != this)
            {
                SoomlaUtils.LogError(TAG, "You can't take an upgrade that's not currently assigned."
                                     + "The UpgradeVG " + Name + " is not assigned to " + "the VirtualGood: "
                                     + good.Name);
                return(0);
            }

            if (!string.IsNullOrEmpty(PrevItemId))
            {
                UpgradeVG prevUpgradeVG = null;
                // Case: downgrade is not possible because previous upgrade does not exist
                try {
                    prevUpgradeVG = (UpgradeVG)StoreInfo.GetItemByItemId(PrevItemId);
                } catch (VirtualItemNotFoundException) {
                    SoomlaUtils.LogError(TAG, "Previous UpgradeVG with itemId: " + PrevItemId
                                         + " doesn't exist! Can't downgrade.");
                    return(0);
                }
                // Case: downgrade is successful!
                SoomlaUtils.LogDebug(TAG, "Downgrading " + good.Name + " to: "
                                     + prevUpgradeVG.Name);
                VirtualGoodsStorage.AssignCurrentUpgrade(good, prevUpgradeVG, notify);
            }

            // Case: first Upgrade in the series - so we downgrade to NO upgrade.
            else
            {
                SoomlaUtils.LogDebug(TAG, "Downgrading " + good.Name + " to NO-UPGRADE");
                VirtualGoodsStorage.RemoveUpgrades(good, notify);
            }

            return(base.Take(amount, notify));
        }
Exemple #13
0
    void bought(VirtualGood arg1, UpgradeVG arg2)
    {
        if (upgrades) {
            int upgdLevel = StoreInventory.GetGoodUpgradeLevel (id);
            if(upgdLevel==5){
                el_desc.text = LanguageManager.current.getText(LanguageNode.FullUpgraded);
                buy.gameObject.SetActive(false);
                el_upgradeMeter.fillAmount = 1f;
            }else{
                el_upgradeMeter.fillAmount = upgdLevel / 5f;
                el_price.text = AnimineStoreAssets.UPGRADE_PRICE [upgdLevel]+"";
            }

        }
    }
Exemple #14
0
        /// <summary>
        /// Handles an <c>onGoodUpgrade</c> event, which is fired when a specific <c>UpgradeVG</c> has
        /// been upgraded/downgraded.
        /// </summary>
        /// <param name="message">Message that contains information about the good that has been
        /// upgraded/downgraded.</param>
        public void onGoodUpgrade(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGoodUpgrade:" + message);

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

            VirtualGood vg  = (VirtualGood)StoreInfo.GetItemByItemId(vars[0]);
            UpgradeVG   vgu = null;

            if (vars.Length > 1)
            {
                vgu = (UpgradeVG)StoreInfo.GetItemByItemId(vars[1]);
            }
            StoreEvents.OnGoodUpgrade(vg, vgu);
        }
Exemple #15
0
        /// <summary>
        /// Determines if the user is in a state that allows him/her to buy an <code>UpgradeVG</code>
        ///	This method enforces allowing/rejecting of upgrades here so users won't buy them when
        /// they are not supposed to.
        /// If you want to give your users free upgrades, use the <code>give</code> function.
        /// </summary>
        /// <returns><c>true</c>, if can buy, <c>false</c> otherwise.</returns>
        protected override bool canBuy()
        {
            VirtualGood good = null;

            try {
                good = (VirtualGood)StoreInfo.GetItemByItemId(GoodItemId);
            } catch (VirtualItemNotFoundException) {
                SoomlaUtils.LogError(TAG, "VirtualGood with itemId: " + GoodItemId +
                                     " doesn't exist! Returning NO (can't buy).");
                return(false);
            }

            UpgradeVG upgradeVG = VirtualGoodsStorage.GetCurrentUpgrade(good);

            return(((upgradeVG == null && string.IsNullOrEmpty(PrevItemId)) ||
                    (upgradeVG != null && ((upgradeVG.NextItemId == this.ItemId) ||
                                           (upgradeVG.PrevItemId == this.ItemId)))) &&
                   base.canBuy());
        }
Exemple #16
0
        public static void onGoodUpgrade(GoodUpgradeEvent _Event, bool alsoPush)
        {
            SoomlaWpStore.domain.virtualGoods.VirtualGood good      = _Event.GetGood();
            SoomlaWpStore.domain.virtualGoods.UpgradeVG   upgradeVG = _Event.GetUpgradeVG();
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGoodUpgrade:" + good.getItemId() + " " + upgradeVG.getItemId());

            VirtualGood vg  = (VirtualGood)StoreInfo.GetItemByItemId(good.getItemId());
            UpgradeVG   vgu = null;

            if (upgradeVG != null)
            {
                vgu = (UpgradeVG)StoreInfo.GetItemByItemId(upgradeVG.getItemId());
            }
            StoreInventory.RefreshOnGoodUpgrade(vg, vgu);
            StoreEvents.OnGoodUpgrade(vg, vgu);

            if (alsoPush)
            {
                sep.PushEventOnGoodUpgrade(_Event);
            }
        }
Exemple #17
0
        /** A set of private functions to refresh the local inventory whenever there are changes on runtime. **/

        public static void RefreshOnGoodUpgrade(VirtualGood vg, UpgradeVG uvg)
        {
            if (uvg == null)
            {
                localUpgrades.Remove(vg.ItemId);
            }
            else
            {
                int          upgradeLevel = GetGoodUpgradeLevel(vg.ItemId);
                LocalUpgrade upgrade;
                if (localUpgrades.TryGetValue(vg.ItemId, out upgrade))
                {
                    upgrade.itemId = uvg.ItemId;
                    upgrade.level  = upgradeLevel;
                }
                else
                {
                    localUpgrades.Add(vg.ItemId, new LocalUpgrade {
                        itemId = uvg.ItemId, level = upgradeLevel
                    });
                }
            }
        }
Exemple #18
0
        protected virtual void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify)
        {
#if UNITY_EDITOR
            UpgradeVG upgrade = GetCurrentUpgrade(good);
            if (upgrade != null && upgrade.ItemId == upgradeVG.ItemId)
            {
                return;
            }

            string itemId   = good.ItemId;
            string key      = keyGoodUpgrade(itemId);
            string upItemId = upgradeVG.ItemId;

            PlayerPrefs.SetString(key, upItemId);

            if (notify)
            {
                var eventJSON = new JSONObject();
                eventJSON.AddField("itemId", good.ItemId);
                eventJSON.AddField("upgradeItemId", upgradeVG.ItemId);
                StoreEvents.Instance.onGoodUpgrade(eventJSON.print());
            }
#endif
        }
Exemple #19
0
 /// <summary>
 /// Assigns a specific upgrade to the given virtual good.
 /// </summary>
 /// <param name="good">the virtual good to upgrade.</param>
 /// <param name="upgradeVG">the upgrade to assign.</param>
 public static void AssignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG)
 {
     AssignCurrentUpgrade(good, upgradeVG, true);
 }
Exemple #20
0
		public GoodUpgradeEvent (VirtualGood item , UpgradeVG upgradeVGItem ) : this(item , upgradeVGItem , null)
		{

		}
		/// <summary>
		/// Assigns a specific upgrade to the given virtual good.
		/// </summary>
		/// <param name="good">the virtual good to upgrade.</param>
		/// <param name="upgradeVG">the upgrade to assign.</param>
		/// <param name="notify">true will also post event.</param>
		public static void AssignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify){
			SoomlaUtils.LogDebug(TAG, "Assigning upgrade " + upgradeVG.ItemId + " to virtual good: "
			                     + good.ItemId);

			instance._assignCurrentUpgrade(good, upgradeVG, notify);
		}
Exemple #22
0
 protected override void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify)
 {
     SoomlaWpStore.domain.virtualGoods.VirtualGood vg  = (SoomlaWpStore.domain.virtualGoods.VirtualGood)SoomlaWpStore.data.StoreInfo.getVirtualItem(good.ItemId);
     SoomlaWpStore.domain.virtualGoods.UpgradeVG   uvg = (SoomlaWpStore.domain.virtualGoods.UpgradeVG)SoomlaWpStore.data.StoreInfo.getVirtualItem(upgradeVG.ItemId);
     SoomlaWpStore.data.StorageManager.getVirtualGoodsStorage().assignCurrentUpgrade(vg, uvg, notify);
 }
 /// <summary>
 /// Handles a good upgraded event.
 /// </summary>
 /// <param name="good">Virtual good that is being upgraded.</param>
 /// <param name="currentUpgrade">The current upgrade that the given virtual
 /// good is being upgraded to.</param>
 public void onGoodUpgrade(VirtualGood good, UpgradeVG currentUpgrade)
 {
 }
		/// <summary>
		/// Assigns a specific upgrade to the given virtual good.
		/// </summary>
		/// <param name="good">the virtual good to upgrade.</param>
		/// <param name="upgradeVG">the upgrade to assign.</param>
		public static void AssignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG){
			AssignCurrentUpgrade(good, upgradeVG, true);
		}
        protected override void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify)
        {
            int err = vgStorage_AssignCurrentUpgrade(good.ItemId, upgradeVG.ItemId, notify);

            IOS_ErrorCodes.CheckAndThrowException(err);
        }
Exemple #26
0
 /** A set of private functions to refresh the local inventory whenever there are changes on runtime. **/
 public static void RefreshOnGoodUpgrade(VirtualGood vg, UpgradeVG uvg)
 {
     if (uvg == null) {
         localUpgrades.Remove(vg.ItemId);
     } else {
         int upgradeLevel = GetGoodUpgradeLevel(vg.ItemId);
         LocalUpgrade upgrade;
         if (localUpgrades.TryGetValue(vg.ItemId, out upgrade)) {
             upgrade.itemId = uvg.ItemId;
             upgrade.level = upgradeLevel;
         } else {
             localUpgrades.Add(vg.ItemId, new LocalUpgrade { itemId = uvg.ItemId, level = upgradeLevel });
         }
     }
 }
Exemple #27
0
		public GoodUpgradeEvent (VirtualGood item , UpgradeVG upgradeVGItem , Object sender) : base(sender)
		{
			mItem  = item ;
			mCurrentUpgradeItem  = upgradeVGItem ;
		}
Exemple #28
0
 /// <summary>
 /// Handles a good upgraded event.
 /// </summary>
 /// <param name="good">Virtual good that is being upgraded.</param>
 /// <param name="currentUpgrade">The current upgrade that the given virtual
 /// good is being upgraded to.</param>
 public void onGoodUpgrade(VirtualGood good, UpgradeVG currentUpgrade)
 {
 }
		protected override void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify) {
			int err = vgStorage_AssignCurrentUpgrade(good.ItemId, upgradeVG.ItemId, notify);
			IOS_ErrorCodes.CheckAndThrowException(err);
		}
Exemple #30
0
			public void PushEventOnGoodUpgrade(VirtualGood good, UpgradeVG upgrade) {
				var eventJSON = new JSONObject();
				eventJSON.AddField("itemId", good.ItemId);
				eventJSON.AddField("upgradeItemId", (upgrade==null ? null : upgrade.ItemId));

				_pushEventGoodUpgrade(eventJSON.print());
			}
 protected override void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify)
 {
     SoomlaWpStore.domain.virtualGoods.VirtualGood vg = (SoomlaWpStore.domain.virtualGoods.VirtualGood)SoomlaWpStore.data.StoreInfo.getVirtualItem(good.ItemId);
     SoomlaWpStore.domain.virtualGoods.UpgradeVG uvg = (SoomlaWpStore.domain.virtualGoods.UpgradeVG)SoomlaWpStore.data.StoreInfo.getVirtualItem(upgradeVG.ItemId);
     SoomlaWpStore.data.StorageManager.getVirtualGoodsStorage().assignCurrentUpgrade(vg, uvg, notify);
 }
Exemple #32
0
 public GoodUpgradeEvent(VirtualGood item, UpgradeVG upgradeVGItem, Object sender) : base(sender)
 {
     mItem = item;
     mCurrentUpgradeItem = upgradeVGItem;
 }
		protected virtual void _assignCurrentUpgrade(VirtualGood good, UpgradeVG upgradeVG, bool notify) {
#if UNITY_EDITOR
			UpgradeVG upgrade = GetCurrentUpgrade(good);
			if (upgrade != null && upgrade.ItemId == upgradeVG.ItemId) {
				return;
			}
			
			string itemId = good.ItemId;
			string key = keyGoodUpgrade(itemId);
			string upItemId = upgradeVG.ItemId;

			PlayerPrefs.SetString(key, upItemId);
			
			if (notify) {
				var eventJSON = new JSONObject();
				eventJSON.AddField("itemId", good.ItemId);
				eventJSON.AddField("upgradeItemId", upgradeVG.ItemId);
				StoreEvents.Instance.onGoodUpgrade(eventJSON.print());
			}
#endif
		}
Exemple #34
0
 private void OnGoodUpgrade(VirtualGood good, UpgradeVG currentUpgrade)
 {
     Debug.Log(string.Format("GNOME: GoodUpgrade - ItemId: {0}", good.ItemId));
 }
Exemple #35
0
 public GoodUpgradeEvent(VirtualGood item, UpgradeVG upgradeVGItem) : this(item, upgradeVGItem, null)
 {
 }