Beispiel #1
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;
 }
		/// <summary>
		/// see parent
		/// </returns>
		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 {
	            StoreUtils.LogError(TAG, "Couldn't determine what type of class is the given purchaseType.");
	        }
		}
		protected PurchasableVirtualItem(AndroidJavaObject jniVirtualItem) :
			base(jniVirtualItem)
		{
			StoreUtils.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>("getGoogleMarketItem")) {
						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 {
						StoreUtils.LogError(TAG, "Couldn't determine what type of class is the given purchaseType.");
					}
				} 
			}
		}
        /// <summary>
        /// see parent
        /// </returns>
        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
            {
                StoreUtils.LogError(TAG, "Couldn't determine what type of class is the given purchaseType.");
            }
        }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.LifetimeVG"/> 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 LifetimeVG(string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.SingleUsePackVG"/> class.
 /// </summary>
 /// <param name='goodItemId'>
 /// The itemId of the SingleUseVG associated with this pack.
 /// </param>
 /// <param name='amount'>
 /// The number of SingleUseVGs in the pack.
 /// </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 SingleUsePackVG(string goodItemId, int amount, string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
     this.GoodItemId = goodItemId;
     this.GoodAmount = amount;
 }
Beispiel #7
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)
 {
 }
		/// <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;
		}
Beispiel #9
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)
 {
 }
 /// <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)
 {
 }
Beispiel #11
0
		/// <summary>
		/// Initializes a new instance of the <see cref="com.soomla.unity.LifetimeVG"/> 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 LifetimeVG(string name, string description, string itemId, PurchaseType purchaseType)
			: base(name, description, itemId, purchaseType)
		{
		}
Beispiel #12
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;
 }
Beispiel #13
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)
		{
		}
		/// <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;
		}
 /// <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;
 }
 /// <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;
 }
Beispiel #17
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)
 {
 }
Beispiel #18
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;
 }
Beispiel #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.SingleUsePackVG"/> class.
 /// </summary>
 /// <param name='goodItemId'>
 /// The itemId of the SingleUseVG associated with this pack.
 /// </param>
 /// <param name='amount'>
 /// The number of SingleUseVGs in the pack.
 /// </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 SingleUsePackVG(string goodItemId, int amount, string name, string description, string itemId, PurchaseType purchaseType)
     : base(name, description, itemId, purchaseType)
 {
     this.GoodItemId = goodItemId;
     this.GoodAmount = amount;
 }
Beispiel #20
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;
 }
Beispiel #21
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)
 {
 }