コード例 #1
0
        protected PurchasableVirtualItem(AndroidJavaObject jniVirtualItem)
            : base(jniVirtualItem)
        {
            Utils.LogDebug(TAG, "Trying to create PurchasableVirtualItem with itemId: " +
                                jniVirtualItem.Call<string>("getItemId"));
            using(AndroidJavaObject jniPurchaseType = jniVirtualItem.Call<AndroidJavaObject>("getPurchaseType")) {
                System.IntPtr cls = AndroidJNI.FindClass("com/soomla/store/purchaseTypes/PurchaseWithMarket");
                if (AndroidJNI.IsInstanceOf(jniPurchaseType.GetRawObject(), cls)) {
                    using(AndroidJavaObject jniMarketItem = jniPurchaseType.Call<AndroidJavaObject>("getMarketItem")) {
                        PurchaseType = new PurchaseWithMarket(jniMarketItem.Call<string>("getProductId"),
                                                              jniMarketItem.Call<double>("getPrice"));
                    }
                } else {
                    cls = AndroidJNI.FindClass("com/soomla/store/purchaseTypes/PurchaseWithVirtualItem");
                    if (AndroidJNI.IsInstanceOf(jniPurchaseType.GetRawObject(), cls)) {
                        string itemId = jniPurchaseType.Call<string>("getTargetItemId");
                        int amount = jniPurchaseType.Call<int>("getAmount");

                        PurchaseType = new PurchaseWithVirtualItem(itemId, amount);
                    } else {
                        Utils.LogError(TAG, "Couldn't determine what type of class is the given purchaseType.");
                    }
                }
            }
        }
コード例 #2
0
ファイル: UpgradeVG.cs プロジェクト: BenanHamid/unity3d-store
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="goodItemId">The itemId of the <c>VirtualGood</c> associated with this upgrade.</param>
 /// <param name="nextItemId">The itemId of the <c>UpgradeVG</c> before, or if this is the first 
 /// 						<c>UpgradeVG</c> in the scale then the value is null.</param>
 /// <param name="prevItemId">The itemId of the <c>UpgradeVG</c> after, or if this is the last
 ///                 		<c>UpgradeVG</c> in the scale then the value is null.</param>
 /// <param name="name">nName.</param>
 /// <param name="description">Description.</param>
 /// <param name="itemId">Item id.</param>
 /// <param name="purchaseType">Purchase type.</param>
 public UpgradeVG(string goodItemId, string nextItemId, string prevItemId, string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
     this.GoodItemId = goodItemId;
     this.PrevItemId = prevItemId;
     this.NextItemId = nextItemId;
 }
コード例 #3
0
        /// <summary>
        /// Constructor.
        /// Generates an instance of <c>PurchasableVirtualItem</c> from a <c>JSONObject</c>.
        /// </summary>
        /// <param name="jsonItem">JSON object.</param>
        protected PurchasableVirtualItem(JSONObject jsonItem)
            : base(jsonItem)
        {
            JSONObject purchasableObj = (JSONObject)jsonItem[JSONConsts.PURCHASABLE_ITEM];
            string purchaseType = purchasableObj[JSONConsts.PURCHASE_TYPE].str;

            if (purchaseType == JSONConsts.PURCHASE_TYPE_MARKET) {
                JSONObject marketItemObj = (JSONObject)purchasableObj[JSONConsts.PURCHASE_MARKET_ITEM];

                PurchaseType = new PurchaseWithMarket(new MarketItem(marketItemObj));
            } else if (purchaseType == JSONConsts.PURCHASE_TYPE_VI) {
                string itemId = purchasableObj[JSONConsts.PURCHASE_VI_ITEMID].str;
                int amount = System.Convert.ToInt32(((JSONObject)purchasableObj[JSONConsts.PURCHASE_VI_AMOUNT]).n);

                PurchaseType = new PurchaseWithVirtualItem(itemId, amount);
            } else {
                Utils.LogError(TAG, "Couldn't determine what type of class is the given purchaseType.");
            }
        }
コード例 #4
0
        /// <summary>
        /// Constructor.
        /// Generates an instance of <c>PurchasableVirtualItem</c> from a <c>JSONObject</c>.
        /// </summary>
        /// <param name="jsonItem">JSON object.</param>
        protected PurchasableVirtualItem(JSONObject jsonItem) :
            base(jsonItem)
        {
            JSONObject purchasableObj = (JSONObject)jsonItem[JSONConsts.PURCHASABLE_ITEM];
            string     purchaseType   = purchasableObj[JSONConsts.PURCHASE_TYPE].str;

            if (purchaseType == JSONConsts.PURCHASE_TYPE_MARKET)
            {
                JSONObject marketItemObj = (JSONObject)purchasableObj[JSONConsts.PURCHASE_MARKET_ITEM];

                PurchaseType = new PurchaseWithMarket(new MarketItem(marketItemObj));
            }
            else if (purchaseType == JSONConsts.PURCHASE_TYPE_VI)
            {
                string itemId = purchasableObj[JSONConsts.PURCHASE_VI_ITEMID].str;
                int    amount = System.Convert.ToInt32(((JSONObject)purchasableObj[JSONConsts.PURCHASE_VI_AMOUNT]).n);

                PurchaseType = new PurchaseWithVirtualItem(itemId, amount);
            }
            else
            {
                Utils.LogError(TAG, "Couldn't determine what type of class is the given purchaseType.");
            }
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.VirtualCurrencyPack"/> class.
 /// </summary>
 /// <param name='name'>
 /// see parent
 /// </param>
 /// <param name='description'>
 /// see parent
 /// </param>
 /// <param name='itemId'>
 /// see parent
 /// </param>
 /// <param name='currencyAmount'>
 /// The amount of currency in the pack.
 /// </param>
 /// <param name='currencyItemId'>
 /// The itemId of the currency associated with this pack.
 /// </param>
 /// <param name='purchaseType'>
 /// see parent
 /// </param>
 public VirtualCurrencyPack(string name, string description, string itemId, int currencyAmount, string currencyItemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
     this.CurrencyAmount = currencyAmount;
     this.CurrencyItemId = currencyItemId;
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.NonConsumableItem"/> class.
 /// </summary>
 /// <param name='name'>
 /// see parent
 /// </param>
 /// <param name='description'>
 /// see parent
 /// </param>
 /// <param name='itemId'>
 /// see parent
 /// </param>
 /// <param name='purchaseType'>
 /// see parent
 /// </param>
 public NonConsumableItem(string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.VirtualGood"/> class.
 /// </summary>
 /// <param name='name'>
 /// see parent
 /// </param>
 /// <param name='description'>
 /// see parent
 /// </param>
 /// <param name='itemId'>
 /// see parent
 /// </param>
 /// <param name='purchaseType'>
 /// see parent
 /// </param>
 public VirtualGood(string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
 }
コード例 #8
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">Name.</param>
 /// <param name="description">Description.</param>
 /// <param name="itemId">Item id.</param>
 /// <param name="purchaseType">Purchase type.</param>
 public NonConsumableItem(string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
 }
コード例 #9
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">Name.</param>
 /// <param name="description">Description.</param>
 /// <param name="itemId">Item id.</param>
 /// <param name="purchaseType">Purchase type.</param>
 public LifetimeVG(string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
 }
コード例 #10
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="equippingModel">Equipping model: <c>LOCAL</c>, <c>GLOBAL</c>, or <c>CATEGORY</c>.</param>
 /// <param name="name">Name.</param>
 /// <param name="Description">description.</param>
 /// <param name="itemId">Item id.</param>
 /// <param name="purchaseType">Purchase type.</param>
 public EquippableVG(EquippingModel equippingModel, string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
     this.Equipping = equippingModel;
 }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.VirtualCurrencyPack"/> class.
 /// </summary>
 /// <param name='name'>
 /// see parent
 /// </param>
 /// <param name='description'>
 /// see parent
 /// </param>
 /// <param name='itemId'>
 /// see parent
 /// </param>
 /// <param name='currencyAmount'>
 /// The amount of currency in the pack.
 /// </param>
 /// <param name='currencyItemId'>
 /// The itemId of the currency associated with this pack.
 /// </param>
 /// <param name='purchaseType'>
 /// see parent
 /// </param>
 public VirtualCurrencyPack(string name, string description, string itemId, int currencyAmount, string currencyItemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
     this.CurrencyAmount = currencyAmount;
     this.CurrencyItemId = currencyItemId;
 }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.PurchasableVirtualItem"/> class.
 /// </summary>
 /// <param name='name'>
 /// see parent
 /// </param>
 /// <param name='description'>
 /// see parent
 /// </param>
 /// <param name='itemId'>
 /// see parent
 /// </param>
 /// <param name='purchaseType'>
 /// The way this item is purchased.
 /// </param>
 protected PurchasableVirtualItem(string name, string description, string itemId, PurchaseType purchaseType) :
     base(name, description, itemId)
 {
     this.PurchaseType = purchaseType;
 }
コード例 #13
0
ファイル: VirtualGood.cs プロジェクト: ricna/unity3d-store
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">see parent.</param>
 /// <param name="description">see parent.</param>
 /// <param name="itemId">see parent.</param>
 /// <param name="purchaseType">see parent.</param>
 public VirtualGood(string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
 }
コード例 #14
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">Name.</param>
 /// <param name="description">Description.</param>
 /// <param name="itemId">Item id.</param>
 /// <param name="purchaseType">Purchase type (the way by which this item is purchased).</param>
 protected PurchasableVirtualItem(string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId)
 {
     this.PurchaseType = purchaseType;
 }
コード例 #15
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">Name.</param>
 /// <param name="description">Description.</param>
 /// <param name="itemId">Item id.</param>
 /// <param name="purchaseType">Purchase type.</param>
 public LifetimeVG(string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
 }
コード例 #16
0
ファイル: SingleUseVG.cs プロジェクト: ricna/unity3d-store
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="name">Name.</param>
 /// <param name="description">Description.</param>
 /// <param name="itemId">Item identifier.</param>
 /// <param name="purchaseType">Purchase type.</param>
 public SingleUseVG(string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
 }
コード例 #17
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="goodItemId">The itemId of the <c>SingleUseVG</c> associated with this pack.</param>
 /// <param name="amount">The number of <c>SingleUseVG</c>S in the pack.</param>
 /// <param name="name">Name.</param>
 /// <param name="description">Description.</param>
 /// <param name="itemId">Item id.</param>
 /// <param name="purchaseType">Purchase type.</param>
 public SingleUsePackVG(string goodItemId, int amount, string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
     this.GoodItemId = goodItemId;
     this.GoodAmount = amount;
 }
コード例 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.EquippableVG"/> class.
 /// </summary>
 /// <param name='equippingModel'>
 /// The way this EquippableVG is equipped.
 /// </param>
 /// <param name='name'>
 /// see parent
 /// </param>
 /// <param name='description'>
 /// see parent
 /// </param>
 /// <param name='itemId'>
 /// see parent
 /// </param>
 /// <param name='purchaseType'>
 /// see parent
 /// </param>
 public EquippableVG(EquippingModel equippingModel, string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
     this.Equipping = equippingModel;
 }
コード例 #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.SingleUsePackVG"/> class.
 /// </summary>
 /// <param name='goodItemId'>
 /// The itemId of the VirtualGood associated with this upgrade.
 /// </param>
 /// <param name='nextItemId'>
 /// The itemId of the UpgradeVG after or if this is the first UpgradeVG in the scale then the value is null.
 /// </param>
 /// <param name='prevItemId'>
 /// The itemId of the UpgradeVG before or if this is the first UpgradeVG in the scale then the value is null.
 /// </param>
 /// <param name='name'>
 /// see parent
 /// </param>
 /// <param name='description'>
 /// see parent
 /// </param>
 /// <param name='itemId'>
 /// see parent
 /// </param>
 /// <param name='purchaseType'>
 /// see parent
 /// </param>
 public UpgradeVG(string goodItemId, string nextItemId, string prevItemId, string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
     this.GoodItemId = goodItemId;
     this.PrevItemId = prevItemId;
     this.NextItemId = nextItemId;
 }
コード例 #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.SingleUseVG"/> class.
 /// </summary>
 /// <param name='name'>
 /// see parent
 /// </param>
 /// <param name='description'>
 /// see parent
 /// </param>
 /// <param name='itemId'>
 /// see parent
 /// </param>
 /// <param name='purchaseType'>
 /// see parent
 /// </param>
 public SingleUseVG(string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
 }
コード例 #21
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="goodItemId">The itemId of the <c>SingleUseVG</c> associated with this pack.</param>
 /// <param name="amount">The number of <c>SingleUseVG</c>S in the pack.</param>
 /// <param name="name">Name.</param>
 /// <param name="description">Description.</param>
 /// <param name="itemId">Item id.</param>
 /// <param name="purchaseType">Purchase type.</param>
 public SingleUsePackVG(string goodItemId, int amount, string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
     this.GoodItemId = goodItemId;
     this.GoodAmount = amount;
 }