コード例 #1
0
ファイル: SingleUsePackVG.cs プロジェクト: lickey10/BeerMe
        /// <summary>
        /// This function gives a curtain amout of <c>VirtualGood</c>s according to the given amount and the amount in the pack.
        /// </summary>
        /// <param name="amount">amount the amount of the specific item to be given.</param>
        /// <param name="notify">notify of change in user's balance of current virtual item.</param>
        public override int Give(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.Add(good, GoodAmount * amount, notify));
        }
コード例 #2
0
        /// <summary>
        /// Gives your user exactly one <code>LifetimeVG</code>.
        /// </summary>
        /// <param name="amount">he amount of the specific item to be given - if this input is greater than 1,
        ///               we force the amount to equal 1, because a <code>LifetimeVG</code> can only be given once..</param>
        /// <param name="notify">Notify.</param>
        public override int Give(int amount, bool notify)
        {
            if (amount > 1)
            {
                SoomlaUtils.LogDebug(TAG, "You tried to give more than one LifetimeVG."
                                     + "Will try to give one anyway.");
                amount = 1;
            }

            int balance = VirtualGoodsStorage.GetBalance(this);

            if (balance < 1)
            {
                return(VirtualGoodsStorage.Add(this, amount, notify));
            }
            return(1);
        }
コード例 #3
0
ファイル: SingleUseVG.cs プロジェクト: umardev0/Six
 /// <summary>
 /// Will give a curtain amount of this single use virtual good.
 /// </summary>
 /// <param name="amount">amount the amount of the specific item to be given.</param>
 /// <param name="notify">notify of change in user's balance of current virtual item.</param>
 public override int Give(int amount, bool notify)
 {
     return(VirtualGoodsStorage.Add(this, amount, notify));
 }