Example #1
0
        /// <summary>
        /// This function takes a curtain amout of <c>VirtualGood</c>s according to the given amount and the amount in the 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)
        {
            SingleUseVG good = null;

            try {
                good = (SingleUseVG)StoreInfo.GetItemByItemId(GoodItemId);
            } catch (VirtualItemNotFoundException) {
                SoomlaUtils.LogError(TAG, "SingleUseVG with itemId: " + GoodItemId + " doesn't exist! Can't give this pack.");
                return(0);
            }
            return(VirtualGoodsStorage.Remove(good, GoodAmount * amount, notify));
        }
Example #2
0
        /// <summary>
        /// Removes all upgrades from the virtual good with the given <c>goodItemId</c>.
        /// </summary>
        /// <param name="goodItemId">Id of the good whose upgrades are to be removed.</param>
        /// <exception cref="VirtualItemNotFoundException">Thrown if the item is not found.</exception>
        public static void RemoveGoodUpgrades(string goodItemId)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY Calling RemoveGoodUpgrades with: " + goodItemId);

            List <UpgradeVG> upgrades = StoreInfo.GetUpgradesForVirtualGood(goodItemId);

            foreach (UpgradeVG upgrade in upgrades)
            {
                VirtualGoodsStorage.Remove(upgrade, 1, true);
            }
            VirtualGood good = (VirtualGood)StoreInfo.GetItemByItemId(goodItemId);

            VirtualGoodsStorage.RemoveUpgrades(good);
        }
Example #3
0
        /// <summary>
        /// Takes from your user exactly one <code>LifetimeVG</code>.
        /// </summary>
        /// <param name="amount">the amount of the specific item to be taken - if this input is greater than 1,
        ///               we force amount to equal 1, because a <code>LifetimeVG</code> can only be
        ///               given once and therefore, taken once.</param>
        /// <param name="notify">Notify.</param>
        public override int Take(int amount, bool notify)
        {
            if (amount > 1)
            {
                amount = 1;
            }

            int balance = VirtualGoodsStorage.GetBalance(this);

            if (balance > 0)
            {
                return(VirtualGoodsStorage.Remove(this, amount, notify));
            }
            return(0);
        }
Example #4
0
 /// <summary>
 /// Will take a curtain amount of this single use virtual good.
 /// </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)
 {
     return(VirtualGoodsStorage.Remove(this, amount, notify));
 }