예제 #1
0
 public VirtualCurrencyPack(string name, string description, string itemId, string productId, double price, int currencyAmount, VirtualCurrency currency)
     : base(name, description, itemId)
 {
     this.MarketItem = new MarketItem(productId, MarketItem.Consumable.CONSUMABLE, price);
     this.CurrencyAmount = currencyAmount;
     this.Currency = currency;
 }
예제 #2
0
        /// <summary>
        /// see parent
        /// </returns>
        public override JSONObject toJSONObject()
        {
            JSONObject jsonObject = base.toJSONObject();

            try {
                JSONObject purchasableObj = new JSONObject(JSONObject.Type.OBJECT);

                if (PurchaseType is PurchaseWithMarket)
                {
                    purchasableObj.AddField(JSONConsts.PURCHASE_TYPE, JSONConsts.PURCHASE_TYPE_MARKET);

                    MarketItem mi = ((PurchaseWithMarket)PurchaseType).MarketItem;
                    purchasableObj.AddField(JSONConsts.PURCHASE_MARKET_ITEM, mi.toJSONObject());
                }
                else if (PurchaseType is PurchaseWithVirtualItem)
                {
                    purchasableObj.AddField(JSONConsts.PURCHASE_TYPE, JSONConsts.PURCHASE_TYPE_VI);

                    purchasableObj.AddField(JSONConsts.PURCHASE_VI_ITEMID, ((PurchaseWithVirtualItem)PurchaseType).ItemId);
                    purchasableObj.AddField(JSONConsts.PURCHASE_VI_AMOUNT, ((PurchaseWithVirtualItem)PurchaseType).Amount);
                }

                jsonObject.AddField(JSONConsts.PURCHASABLE_ITEM, purchasableObj);
            } catch (System.Exception e) {
                StoreUtils.LogError(TAG, "An error occurred while generating JSON object. " + e.Message);
            }

            return(jsonObject);
        }
예제 #3
0
 public NonConsumableItem(AndroidJavaObject jniNonConsumableItem)
     : base(jniNonConsumableItem)
 {
     // Google Market Item
     using(AndroidJavaObject jniGoogleMarketItem = jniNonConsumableItem.Call<AndroidJavaObject>("getGoogleItem")) {
         this.MarketItem = new MarketItem(jniGoogleMarketItem);
     }
 }
예제 #4
0
 public VirtualCurrencyPack(AndroidJavaObject jniVirtualCurrencyPack)
     : base(jniVirtualCurrencyPack)
 {
     this.CurrencyAmount = jniVirtualCurrencyPack.Call<int>("getCurrencyAmount");
     // Google Market Item
     AndroidJavaObject jniGoogleMarketItem = jniVirtualCurrencyPack.Call<AndroidJavaObject>("getGoogleItem");
     this.MarketItem = new MarketItem(jniGoogleMarketItem);
     // Virtual Currency
     AndroidJavaObject jniVirtualCurrency = jniVirtualCurrencyPack.Call<AndroidJavaObject>("getVirtualCurrency");
     this.Currency = new VirtualCurrency(jniVirtualCurrency);
 }
예제 #5
0
        public VirtualCurrencyPack(JSONObject jsonVcp)
            : base(jsonVcp)
        {
            this.CurrencyAmount = System.Convert.ToInt32(((JSONObject)jsonVcp[JSONConsts.CURRENCYPACK_AMOUNT]).n);
            this.MarketItem = new MarketItem(jsonVcp);

            string currencyItemId = jsonVcp[JSONConsts.CURRENCYPACK_CURRENCYITEMID].str;
            try {
                this.Currency = StoreInfo.GetVirtualCurrencyByItemId(currencyItemId);
            } catch {
                Debug.Log("Couldn't find the associated currency. itemId: " + currencyItemId);
            }
        }
예제 #6
0
 public NonConsumableItem(JSONObject jsonNon)
     : base(jsonNon)
 {
     this.MarketItem = new MarketItem(jsonNon);
 }
예제 #7
0
 public NonConsumableItem(string name, string description, string itemId, string productId, double price)
     : base(name, description, itemId)
 {
     this.MarketItem = new MarketItem(productId, MarketItem.Consumable.NONCONSUMABLE, price);
 }
예제 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.PurchaseWithMarket"/> class.
 /// </summary>
 /// <param name='marketItem'>
 /// The representation of the item in the platform's market.
 /// </param>
 public PurchaseWithMarket(MarketItem marketItem)
     : base()
 {
     this.MarketItem = marketItem;
 }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.PurchaseWithMarket"/> class.
 /// </summary>
 /// <param name='productId'>
 /// The productId to purchase in the platform's market.
 /// </param>
 /// <param name='price'>
 /// The price in the platform's market.
 /// </param>
 public PurchaseWithMarket(string productId, double price)
     : base()
 {
     this.MarketItem = new MarketItem(productId, MarketItem.Consumable.CONSUMABLE, price);
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.PurchaseWithMarket"/> class.
 /// </summary>
 /// <param name='marketItem'>
 /// The representation of the item in the platform's market.
 /// </param>
 public PurchaseWithMarket(MarketItem marketItem) :
     base()
 {
     this.MarketItem = marketItem;
 }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.PurchaseWithMarket"/> class.
 /// </summary>
 /// <param name='productId'>
 /// The productId to purchase in the platform's market.
 /// </param>
 /// <param name='price'>
 /// The price in the platform's market.
 /// </param>
 public PurchaseWithMarket(string productId, double price) :
     base()
 {
     this.MarketItem = new MarketItem(productId, MarketItem.Consumable.CONSUMABLE, price);
 }