/// <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)); }
/// <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); }
/// <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)); }