コード例 #1
0
        /// <summary>
        /// Equips the virtual good with the given <c>goodItemId</c>.
        /// Equipping means that the user decides to currently use a specific virtual good.
        /// For more details and examples <see cref="com.soomla.store.domain.virtualGoods.EquippableVG"/>.
        /// </summary>
        /// <param name="goodItemId">Id of the good to be equipped.</param>
        /// <exception cref="VirtualItemNotFoundException">Thrown if the item is not found.</exception>
        /// <exception cref="NotEnoughGoodsException"></exception>
        public static void EquipVirtualGood(string goodItemId)
        {
            SoomlaUtils.LogDebug(TAG, "Equipping: " + goodItemId);

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

            try {
                good.Equip();
            } catch (NotEnoughGoodsException e) {
                SoomlaUtils.LogError(TAG, "UNEXPECTED! Couldn't equip something");
                throw e;
            }
        }