Exemplo n.º 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.");
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <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;
 }
Exemplo n.º 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.");
            }
        }
Exemplo n.º 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.");
            }
        }
 /// <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;
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 13
0
 /// <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)
 {
 }
Exemplo n.º 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;
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 16
0
 /// <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)
 {
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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;
 }