Ejemplo n.º 1
0
    public void OnMarketPurchaseStarted(PurchasableVirtualItem pvi)
    {
        //StatusText.text = "Market Purchase started";

        Debug.Log("OnMarketPurchaseStarted: " + pvi.ItemId);
        s += "OnMarketPurchaseStarted: " + pvi.ItemId;
    }
Ejemplo n.º 2
0
		public MarketPurchaseEvent (PurchasableVirtualItem purchasableVirtualItem, String payload,
		                           Dictionary<String, String> extraInfo, Object sender) : base(sender)
		{
			PurchasableVirtualItem = purchasableVirtualItem;
			Payload = payload;
			ExtraInfo = extraInfo;
		}
Ejemplo n.º 3
0
    private void onMarketPurchase(PurchasableVirtualItem pvi, string payload, Dictionary<string, string> extra)
    {
        // pvi is the PurchasableVirtualItem that was just purchased
        // payload is a text that you can give when you initiate the purchase operation and you want to receive back upon completion
        // extra will contain platform specific information about the market purchase.
        //      Android: The "extra" dictionary will contain "orderId" and "purchaseToken".
        //      iOS: The "extra" dictionary will contain "receipt" and "token".

        #if UNITY_ANDROID
        string purchaseToken, orderId;
        if(!extra.TryGetValue("purchaseToken", out purchaseToken))
            purchaseToken = string.Empty;
        if(!extra.TryGetValue("orderId", out orderId))
            orderId = string.Empty;
        var item = ((PurchaseWithMarket)pvi.PurchaseType).MarketItem;

        FuseSDK.RegisterAndroidInAppPurchase(FuseMisc.IAPState.PURCHASED, purchaseToken, item.ProductId, orderId,
            DateTime.Now, payload, item.Price, item.MarketCurrencyCode);
        #elif UNITY_IOS
        string token, receipt;
        if(!extra.TryGetValue("token", out token))
            token = string.Empty;
        if(!extra.TryGetValue("receipt", out receipt))
            receipt = string.Empty;
        var item = ((PurchaseWithMarket)pvi.PurchaseType).MarketItem;

        FuseSDK.RegisterIOSInAppPurchase(item.ProductId, token, System.Text.Encoding.UTF8.GetBytes(receipt), FuseMisc.IAPState.PURCHASED);
        #endif
    }
Ejemplo n.º 4
0
    public void onMarketRefund(PurchasableVirtualItem pvi)
    {
        int id = GetID(pvi.ItemId);

        if(id > 0)
            frogPackages.LockPackage(id);
    }
    public void onMarketPurchaseStarted(PurchasableVirtualItem pvi)
    {
        // pvi - the PurchasableVirtualItem whose purchase operation has just started
        print ("onMarketPurchaseStarted. item_id=" + pvi.ItemId);

        // ... your game specific implementation here ...
    }
Ejemplo n.º 6
0
 public void OnItemPurchased(PurchasableVirtualItem pvi, string s1)
 {
     Debug.Log("OnItemPurchased: " + pvi.ItemId);
     s += "OnItemPurchased: " + pvi.ItemId;
     //StatusText.text = s;
     CurrentInGameCurrency.text = Store.DIAMOND_CURRENCY.GetBalance().ToString();
 }
Ejemplo n.º 7
0
        public static void onMarketPurchaseCancelled(MarketPurchaseCancelledEvent _Event)
        {
            SoomlaWpStore.domain.PurchasableVirtualItem purchasableVirtualItem = _Event.GetPurchasableVirtualItem();
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onMarketPurchaseCancelled: " + purchasableVirtualItem.getItemId());
            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(purchasableVirtualItem.getItemId());

            StoreEvents.OnMarketPurchaseCancelled(pvi);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Buys the item with the given <c>itemId</c>.
        /// </summary>
        /// <param name="itemId">id of item to be bought</param>
        /// <param name="payload">a string you want to be assigned to the purchase. This string
        /// is saved in a static variable and will be given bacl to you when the purchase is completed.</param>
        /// <exception cref="VirtualItemNotFoundException">Thrown if the item to be bought is not found.</exception>
        /// <exception cref="InsufficientFundsException">Thrown if the user does not have enough funds.</exception>
        public static void BuyItem(string itemId, string payload)
        {
            SoomlaUtils.LogDebug(TAG, "Buying: " + itemId);

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(itemId);

            pvi.Buy(payload);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Checks if there is enough funds to afford <c>itemId</c>.
        /// </summary>
        /// <param name="itemId">id of item to be checked</param>
        /// <returns>True if there are enough funds to afford the virtual item with the given item id </returns>
        public static bool CanAfford(string itemId)
        {
            SoomlaUtils.LogDebug(TAG, "Checking can afford: " + itemId);

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(itemId);

            return(pvi.CanAfford());
        }
Ejemplo n.º 10
0
            public void PushEventOnItemPurchaseStarted(PurchasableVirtualItem item)
            {
                var eventJSON = new JSONObject();

                eventJSON.AddField("itemId", item.ItemId);

                _pushEventItemPurchaseStarted(eventJSON.print());
            }
Ejemplo n.º 11
0
        /// <summary>
        /// Handles the <c>onMarketRefund</c> event, which is fired when a Market refund has been issued.
        /// </summary>
        /// <param name="message">Message that contains information about the market refund that has occurred.</param>
        public void onMarketRefund(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onMarketRefund:" + message);

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(message);

            StoreEvents.OnMarketPurchaseStarted(pvi);
        }
    public void onItemPurchased(PurchasableVirtualItem pvi, string payload)
    {
        // pvi - the PurchasableVirtualItem that was just purchased
        // payload - a text that you can give when you initiate the purchase operation
        //    and you want to receive back upon completion
        print ("onMarketPurchased. item_id=" + pvi.ItemId + ".  payload=" + payload);

        // ... your game specific implementation here ...
    }
Ejemplo n.º 13
0
            public void PushEventOnItemPurchased(PurchasableVirtualItem item, string payload)
            {
                var eventJSON = new JSONObject();

                eventJSON.AddField("itemId", item.ItemId);
                eventJSON.AddField("payload", payload);

                _pushEventItemPurchased(eventJSON.print());
            }
Ejemplo n.º 14
0
        /// <summary>
        /// Handles the <c>onMarketRefund</c> event, which is fired when a Market refund has been issued.
        /// </summary>
        /// <param name="message">Message that contains information about the market refund that has occurred.</param>
        public void onMarketRefund(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onMarketRefund:" + message);

            var eventJSON = new JSONObject(message);

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(eventJSON["itemId"].str);

            StoreEvents.OnMarketRefund(pvi);
        }
Ejemplo n.º 15
0
        protected virtual void _buyMarketItem(string productId, string payload)
        {
#if UNITY_EDITOR
            PurchasableVirtualItem item = StoreInfo.GetPurchasableItemWithProductId(productId);
            if (item == null)
            {
                throw new VirtualItemNotFoundException("ProductId", productId);
            }

            // in the editor we just give the item... no real market.
            item.Give(1);
#endif
        }
Ejemplo n.º 16
0
        public static void onItemPurchaseStarted(ItemPurchaseStartedEvent _Event, bool alsoPush)
        {
            SoomlaWpStore.domain.PurchasableVirtualItem purchasableVirtualItem = _Event.GetPurchasableVirtualItem();
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onItemPurchaseStarted:" + purchasableVirtualItem.getItemId());

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(purchasableVirtualItem.getItemId());

            StoreEvents.OnItemPurchaseStarted(pvi);

            if (alsoPush)
            {
                sep.PushEventOnItemPurchaseStarted(_Event);
            }
        }
Ejemplo n.º 17
0
        public static void onMarketPurchase(MarketPurchaseEvent _Event)
        {
            SoomlaWpStore.domain.PurchasableVirtualItem purchasableVirtualItem = _Event.GetPurchasableVirtualItem();
            String payload = _Event.GetPayload();
            String token   = _Event.GetToken();

            Debug.Log("SOOMLA/UNITY onMarketPurchase:" + purchasableVirtualItem.getItemId() + " " + payload + " " + token);

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(purchasableVirtualItem.getItemId());
            //TODO Implement extra on WP8 onMarketPurchase
            Dictionary <string, string> extra = new Dictionary <string, string>();

            StoreEvents.OnMarketPurchase(pvi, payload, extra);
        }
Ejemplo n.º 18
0
    private static void OnMarketPurchase(PurchasableVirtualItem pvi, string payload, Dictionary<string, string> extra) {
        PurchaseWithMarket purchaseWithMarket = pvi.PurchaseType as PurchaseWithMarket;

        if (purchaseWithMarket != null) {
            MarketItem marketItem = purchaseWithMarket.MarketItem;
            if (Application.platform == RuntimePlatform.Android) {
                EventTracker tracker = AdBoostUnity.getEventTracker();
                tracker.sendRevenueEvent(
                    marketItem.MarketCurrencyCode,
                    marketItem.Price,
                    pvi.ItemId
                );
            }
        }
    }
Ejemplo n.º 19
0
        /// <summary>
        /// Handles the <c>onMarketPurchaseDeferred</c> event, which is fired when a Market purchase was deferred
        /// until it can be finished by the family delegate.
        /// Note that this is an iOS only event for when users have set up "Ask to Buy" and the purchaser is
        /// selected as a family member that needs "family organizer" permission to buy.
        /// <see href="https://support.apple.com/en-us/HT201089">Apple's explanation of "Ask to Buy"</see>
        /// </summary>
        /// <param name="message">Message that contains information about the market purchase that is being
        /// deferred.</param>
        public void onMarketPurchaseDeferred(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onMarketPurchaseDeferred: " + message);

            var eventJSON = new JSONObject(message);

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(eventJSON["itemId"].str);
            string payload             = "";

            if (eventJSON.HasField("payload"))
            {
                payload = eventJSON["payload"].str;
            }
            StoreEvents.OnMarketPurchaseDeferred(pvi, payload);
        }
Ejemplo n.º 20
0
        protected virtual void _buyMarketItem(string productId, string payload)
        {
#if UNITY_EDITOR
            PurchasableVirtualItem item = StoreInfo.GetPurchasableItemWithProductId(productId);
            if (item == null)
            {
                throw new VirtualItemNotFoundException("ProductId", productId);
            }

            // simulate onMarketPurchaseStarted event
            var eventJSON = new JSONObject();
            eventJSON.AddField("itemId", item.ItemId);
            eventJSON.AddField("payload", payload);
            StoreEvents.Instance.onMarketPurchaseStarted(eventJSON.print());

            // simulate events as they happen on the device
            // the order is :
            //    onMarketPurchase
            //    give item
            //    onItemPurchase
            StoreEvents.Instance.RunLater(() => {
                eventJSON = new JSONObject();
                eventJSON.AddField("itemId", item.ItemId);
                eventJSON.AddField("payload", payload);
                var extraJSON = new JSONObject();
                        #if UNITY_IOS
                extraJSON.AddField("receipt", "fake_receipt_abcd1234");
                extraJSON.AddField("token", "fake_token_zyxw9876");
                        #elif UNITY_ANDROID
                extraJSON.AddField("orderId", "fake_orderId_abcd1234");
                extraJSON.AddField("purchaseToken", "fake_purchaseToken_zyxw9876");
                        #endif
                eventJSON.AddField("extra", extraJSON);
                StoreEvents.Instance.onMarketPurchase(eventJSON.print());

                // in the editor we just give the item... no real market.
                item.Give(1);

                // We have to make sure the ItemPurchased event will be fired AFTER the balance/currency-changed events.
                StoreEvents.Instance.RunLater(() => {
                    eventJSON = new JSONObject();
                    eventJSON.AddField("itemId", item.ItemId);
                    eventJSON.AddField("payload", payload);
                    StoreEvents.Instance.onItemPurchased(eventJSON.print());
                });
            });
#endif
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Handles an <c>onItemPurchased</c> event, which is fired when a specific
        /// <c>PurchasableVirtualItem</c> has been purchased.
        /// </summary>
        /// <param name="message">Message that contains information about the good that has been purchased.</param>
        public void onItemPurchased(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onItemPurchased:" + message);

            string[] vars = Regex.Split(message, "#SOOM#");

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(vars[0]);
            string payload             = "";

            if (vars.Length > 1)
            {
                payload = vars[1];
            }

            StoreEvents.OnItemPurchased(pvi, payload);
        }
Ejemplo n.º 22
0
 void onMarketPurchase(PurchasableVirtualItem pvi, string payload, Dictionary<string, string> extra)
 {
     if (pvi.ID == StoreAssets.FULL_VERSION_PRODUCT_ID)
     {
         fullVersion = true;
     }
     //else if (pvi.ID == StoreAssets.SEASON_3_UNLOCK_PRODUCT_ID)
     //{
     //    season_3_unlocked = true;
     //}
     //else if (pvi.ID == StoreAssets.SEASONS_ALL_UNLOCK_PRODUCT_ID)
     //{
     //    season_2_unlocked = true;
     //    season_3_unlocked = true;
     //}
 }
Ejemplo n.º 23
0
        public void onItemPurchaseStarted(string message, bool alsoPush)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onItemPurchaseStarted:" + message);

            var eventJSON = new JSONObject(message);

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(eventJSON["itemId"].str);

            StoreEvents.OnItemPurchaseStarted(pvi);

            if (alsoPush)
            {
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
                sep.PushEventOnItemPurchaseStarted(pvi);
#endif
            }
        }
Ejemplo n.º 24
0
    // On purchase complete, set purchase info and measure purchase in TUNE
    public void onMarketPurchase(PurchasableVirtualItem pvi, string payload,
	                             Dictionary<string, string> extras)
    {
        double revenue = 0;
        string currency = "";
        MATItem[] items = new MATItem[] {};
        MarketItem item = ((PurchaseWithMarket)pvi.PurchaseType).MarketItem;
        revenue = item.MarketPriceMicros / 1000000;
        currency = item.MarketCurrencyCode;

        // Create event item to store purchase item data
        MATItem matItem = new MATItem();
        matItem.name = item.MarketTitle;
        matItem.attribute1 = item.ProductId;

        // Add event item to MATItem array in order to pass to TUNE SDK
        items[items.Length] = matItem;

        // Get order ID and receipt data for purchase validation
        string receipt = "";
        string receiptSignature = "";
        string orderId = "";
        #if UNITY_ANDROID
        extras.TryGetValue("originalJson", out receipt);
        extras.TryGetValue("signature", out receiptSignature);
        extras.TryGetValue("orderId", out orderId);
        #elif UNITY_IOS
        extras.TryGetValue("receiptBase64", out receipt);
        extras.TryGetValue("transactionIdentifier", out orderId);
        #endif

        // Create a MATEvent with this purchase data
        MATEvent purchaseEvent = new MATEvent("purchase");
        purchaseEvent.revenue = revenue;
        purchaseEvent.currencyCode = currency;
        purchaseEvent.advertiserRefId = orderId;
        purchaseEvent.receipt = receipt;
        purchaseEvent.receiptSignature = receiptSignature;

        // Set event item if it exists
        if (items.Length != 0) {
            purchaseEvent.eventItems = items;
        }
        // Measure "purchase" event
        MATBinding.MeasureEvent(purchaseEvent);
    }
Ejemplo n.º 25
0
 public void onMarketPurchase(PurchasableVirtualItem pvi, string payload, Dictionary<string, string> extra)
 {
     if (pvi.ItemId.Equals(RunningBackAssets.SPEED_BOOST_GOOD.ItemId))
     {
         int availableBoosters = SecurePlayerPrefs.GetInt(Constants.AVAILABLE_BOOSTERS, Constants.SECURE_PASS);
         availableBoosters++;
         SecurePlayerPrefs.SetInt(Constants.AVAILABLE_BOOSTERS, availableBoosters, Constants.SECURE_PASS);
     }
     else if (pvi.ItemId.Equals(RunningBackAssets.SPEED_BOOST_10_GOOD.ItemId))
     {
         int availableBoosters = SecurePlayerPrefs.GetInt(Constants.AVAILABLE_BOOSTERS, Constants.SECURE_PASS);
         availableBoosters+= 10;
         SecurePlayerPrefs.SetInt(Constants.AVAILABLE_BOOSTERS, availableBoosters, Constants.SECURE_PASS);
     }
     else if (pvi.ItemId.Equals(RunningBackAssets.SPEED_BOOST_50_GOOD.ItemId))
     {
         int availableBoosters = SecurePlayerPrefs.GetInt(Constants.AVAILABLE_BOOSTERS, Constants.SECURE_PASS);
         availableBoosters+= 50;
         SecurePlayerPrefs.SetInt(Constants.AVAILABLE_BOOSTERS, availableBoosters, Constants.SECURE_PASS);
     }
     else if (pvi.ItemId.Equals(RunningBackAssets.BREAK_TACKLE_GOOD.ItemId))
     {
         int availableBreakTackles = SecurePlayerPrefs.GetInt(Constants.AVAILABLE_BREAK_TACKLES, Constants.SECURE_PASS);
         availableBreakTackles++;
         SecurePlayerPrefs.SetInt(Constants.AVAILABLE_BREAK_TACKLES, availableBreakTackles, Constants.SECURE_PASS);
     }
     else if (pvi.ItemId.Equals(RunningBackAssets.BREAK_TACKLE_10_GOOD.ItemId))
     {
         int availableBreakTackles = SecurePlayerPrefs.GetInt(Constants.AVAILABLE_BREAK_TACKLES, Constants.SECURE_PASS);
         availableBreakTackles+= 10;
         SecurePlayerPrefs.SetInt(Constants.AVAILABLE_BREAK_TACKLES, availableBreakTackles, Constants.SECURE_PASS);
     }
     else if (pvi.ItemId.Equals(RunningBackAssets.BREAK_TACKLE_50_GOOD.ItemId))
     {
         int availableBreakTackles = SecurePlayerPrefs.GetInt(Constants.AVAILABLE_BREAK_TACKLES, Constants.SECURE_PASS);
         availableBreakTackles+= 50;
         SecurePlayerPrefs.SetInt(Constants.AVAILABLE_BREAK_TACKLES, availableBreakTackles, Constants.SECURE_PASS);
     }
     updateTexts();
     // pvi is the PurchasableVirtualItem that was just purchased
     // payload is a text that you can give when you initiate the purchase operation and you want to receive back upon completion
     // extra will contain platform specific information about the market purchase.
     //      Android: The "extra" dictionary will contain "orderId" and "purchaseToken".
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Handles the <c>onMarketItemsRefreshFinished</c> event, which is fired when items associated with market are
        /// refreshed (prices, titles ...).
        /// </summary>
        /// <param name="message">Message that contains information about the process that is occurring.</param>
        public void onMarketItemsRefreshFinished(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onMarketItemsRefreshFinished: " + message);

            var eventJSON = new JSONObject(message);

            List <VirtualItem> virtualItems = new List <VirtualItem>();
            List <MarketItem>  marketItems  = new List <MarketItem>();

            foreach (var micJSON in eventJSON.list)
            {
                string productId          = micJSON[StoreJSONConsts.MARKETITEM_PRODUCT_ID].str;
                string marketPrice        = micJSON[StoreJSONConsts.MARKETITEM_MARKETPRICE].str;
                string marketTitle        = micJSON[StoreJSONConsts.MARKETITEM_MARKETTITLE].str;
                string marketDescription  = micJSON[StoreJSONConsts.MARKETITEM_MARKETDESC].str;
                string marketCurrencyCode = micJSON[StoreJSONConsts.MARKETITEM_MARKETCURRENCYCODE].str;
                long   marketPriceMicros  = System.Convert.ToInt64(micJSON[StoreJSONConsts.MARKETITEM_MARKETPRICEMICROS].n);
                try {
                    PurchasableVirtualItem pvi = StoreInfo.GetPurchasableItemWithProductId(productId);
                    MarketItem             mi  = ((PurchaseWithMarket)pvi.PurchaseType).MarketItem;
                    mi.MarketPriceAndCurrency = marketPrice;
                    mi.MarketTitle            = marketTitle;
                    mi.MarketDescription      = marketDescription;
                    mi.MarketCurrencyCode     = marketCurrencyCode;
                    mi.MarketPriceMicros      = marketPriceMicros;

                    marketItems.Add(mi);
                    virtualItems.Add(pvi);
                } catch (VirtualItemNotFoundException ex) {
                    SoomlaUtils.LogDebug(TAG, ex.Message);
                }
            }

            if (virtualItems.Count > 0)
            {
                // no need to save to DB since it's already saved in native
                // before this event is received
                StoreInfo.Save(virtualItems, false);
            }

            StoreEvents.OnMarketItemsRefreshFinished(marketItems);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Handles the <c>onMarketPurchase</c> event, which is fired when a Market purchase has occurred.
        /// </summary>
        /// <param name="message">Message that contains information about the market purchase.</param>
        public void onMarketPurchase(string message)
        {
            Debug.Log("SOOMLA/UNITY onMarketPurchase:" + message);

            string[] vars = Regex.Split(message, "#SOOM#");

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(vars[0]);
            string payload             = "";
            string purchaseToken       = "";

            if (vars.Length > 1)
            {
                payload = vars[1];
            }
            if (vars.Length > 2)
            {
                purchaseToken = vars[2];
            }

            StoreEvents.OnMarketPurchase(pvi, purchaseToken, payload);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Handles the <c>onMarketItemsRefreshFinished</c> event, which is fired when items associated with market are
        /// refreshed (prices, titles ...).
        /// </summary>
        /// <param name="message">Message that contains information about the process that is occurring.</param>
        public void onMarketItemsRefreshFinished(string message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onMarketItemsRefreshFinished: " + message);

            string[]          marketItemsChanges = Regex.Split(message, "#SOOM#");
            List <MarketItem> marketItems        = new List <MarketItem>();

            foreach (string mic in marketItemsChanges)
            {
                if (string.IsNullOrEmpty(mic.Trim()))
                {
                    continue;
                }

                JSONObject micJSON            = new JSONObject(mic);
                string     productId          = micJSON[JSONConsts.MARKETITEM_PRODUCT_ID].str;
                string     marketPrice        = micJSON[JSONConsts.MARKETITEM_MARKETPRICE].str;
                string     marketTitle        = micJSON[JSONConsts.MARKETITEM_MARKETTITLE].str;
                string     marketDescription  = micJSON[JSONConsts.MARKETITEM_MARKETDESC].str;
                string     marketCurrencyCode = micJSON[JSONConsts.MARKETITEM_MARKETCURRENCYCODE].str;
                long       marketPriceMicros  = System.Convert.ToInt64(micJSON[JSONConsts.MARKETITEM_MARKETPRICEMICROS].n);
                try {
                    PurchasableVirtualItem pvi = StoreInfo.GetPurchasableItemWithProductId(productId);
                    MarketItem             mi  = ((PurchaseWithMarket)pvi.PurchaseType).MarketItem;
                    mi.MarketPriceAndCurrency = marketPrice;
                    mi.MarketTitle            = marketTitle;
                    mi.MarketDescription      = marketDescription;
                    mi.MarketCurrencyCode     = marketCurrencyCode;
                    mi.MarketPriceMicros      = marketPriceMicros;
                    pvi.save();

                    marketItems.Add(mi);
                } catch (VirtualItemNotFoundException ex) {
                    SoomlaUtils.LogDebug(TAG, ex.Message);
                }
            }

            StoreEvents.OnMarketItemsRefreshFinished(marketItems);
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Handles a market purchase event.
 /// </summary>
 /// <param name="pvi">Purchasable virtual item.</param>
 /// <param name="purchaseToken">Purchase token.</param>
 public void onMarketPurchase(PurchasableVirtualItem pvi, string payload, Dictionary<string, string> extra)
 {
     mCtrl.ShowModalWindow("Success!", "You have successfully purchased the \n" + pvi.Name.ToString());
 }
Ejemplo n.º 30
0
 // soomla event - item purchased
 public void onItemPurchased(PurchasableVirtualItem pvi, string payload)
 {
     print ("onItemPurchased called");
     Calendar c = GameObject.FindObjectOfType<Calendar>();
     if (c != null)
     {
         c.ReloadCalendar();
     }
     Upgrade.PurchaseUpgrade_callback(true);
 }
Ejemplo n.º 31
0
 public MarketPurchaseStartedEvent(PurchasableVirtualItem purchasableVirtualItem, bool fraudProtection, Object sender) : base(sender)
 {
     mPurchasableVirtualItem = purchasableVirtualItem;
     mFraudProtection        = fraudProtection;
 }
		public MarketPurchaseStartedEvent (PurchasableVirtualItem purchasableVirtualItem, bool fraudProtection) : this(purchasableVirtualItem, fraudProtection, null)
		{

		}
		public MarketPurchaseStartedEvent (PurchasableVirtualItem purchasableVirtualItem, Object sender) : this(purchasableVirtualItem, false, sender)
		{
		}
Ejemplo n.º 34
0
 public void OnMarketPurchase(PurchasableVirtualItem pvi, string s1, Dictionary<string, string> arg3)
 {
     Debug.Log("OnMarketPurchase: " + pvi.ItemId);
     s += "OnMarketPurchase: " + pvi.ItemId;
     //StatusText.text = s;
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Handles a market refund event.
 /// </summary>
 /// <param name="pvi">Purchasable virtual item.</param>
 public void onMarketRefund(PurchasableVirtualItem pvi)
 {
     mCtrl.ShowModalWindow("Refunded!", pvi.ToString() + "\n has been refunded successfully!");
 }
Ejemplo n.º 36
0
 public ItemPurchaseStartedEvent(PurchasableVirtualItem item) : this(item, null)
 {
 }
Ejemplo n.º 37
0
 // Play of successfully purchased sound
 void onMarketPurchase(PurchasableVirtualItem item, string payload, Dictionary<string, string> extra)
 {
     if (payload != developerPayload) return;
     AudioAssistant.Shot ("Buy");
 }
Ejemplo n.º 38
0
 // Play of successfully purchased sound
 void onItemPurchased(PurchasableVirtualItem item, string payload)
 {
     if (payload != developerPayload) return;
     AudioAssistant.Shot ("Buy");
 }
Ejemplo n.º 39
0
			public void PushEventOnItemPurchaseStarted(PurchasableVirtualItem item) {
				var eventJSON = new JSONObject();
				eventJSON.AddField("itemId", item.ItemId);

				_pushEventItemPurchaseStarted(eventJSON.print());
			}
Ejemplo n.º 40
0
 public ItemPurchaseStartedEvent(PurchasableVirtualItem item, Object sender) : base(sender)
 {
     mItem = item;
 }
Ejemplo n.º 41
0
 public MarketRefundEvent(PurchasableVirtualItem purchasableVirtualItem) : this(purchasableVirtualItem, null)
 {
 }
Ejemplo n.º 42
0
 /// <summary>
 /// Handles an item purchase cancelled event.
 /// </summary>
 /// <param name="pvi">Purchasable virtual item.</param>
 public void onMarketPurchaseCancelled(PurchasableVirtualItem pvi)
 {
     mCtrl.ShowModalWindow("Cancelled", "The purchase has been cancelled.");
 }
Ejemplo n.º 43
0
 /// <summary>
 /// Handles a market purchase started event.
 /// </summary>
 /// <param name="pvi">Purchasable virtual item.</param>
 public void onMarketPurchaseStarted(PurchasableVirtualItem pvi)
 {
 }
Ejemplo n.º 44
0
 public ItemPurchasedEvent(PurchasableVirtualItem item, String payload) : this(item, payload, null)
 {
 }
Ejemplo n.º 45
0
 /// <summary>
 /// Handles a market purchase verification started event.
 /// </summary>
 /// <param name="pvi">Purchasable virtual item.</param>
 public void onVerificationStarted(PurchasableVirtualItem pvi)
 {
 }
Ejemplo n.º 46
0
 public ItemPurchasedEvent(PurchasableVirtualItem item, String payload, Object sender) : base(sender)
 {
     mItem    = item;
     mPayload = payload;
 }
Ejemplo n.º 47
0
 /// <summary>
 /// Handles an item purchase deferred event.
 /// </summary>
 /// <param name="pvi">Purchasable virtual item.</param>
 /// <param name="payload">Developer supplied payload.</param>
 public void onMarketPurchaseDeferred(PurchasableVirtualItem pvi, string payload)
 {
 }
Ejemplo n.º 48
0
		public MarketRefundEvent (PurchasableVirtualItem purchasableVirtualItem): this(purchasableVirtualItem, null)
		{
		}
		public MarketPurchaseStartedEvent (PurchasableVirtualItem purchasableVirtualItem, bool fraudProtection, Object sender) : base(sender)
		{
			mPurchasableVirtualItem = purchasableVirtualItem;
			mFraudProtection = fraudProtection;
		}
Ejemplo n.º 50
0
 public MarketPurchaseStartedEvent(PurchasableVirtualItem purchasableVirtualItem, Object sender) : this(purchasableVirtualItem, false, sender)
 {
 }
Ejemplo n.º 51
0
 /// <summary>
 /// Handles an item purchase cancelled event.
 /// </summary>
 /// <param name="pvi">Purchasable virtual item.</param>
 public void onMarketPurchaseCancelled(PurchasableVirtualItem pvi)
 {
 }
Ejemplo n.º 52
0
 /// <summary>
 /// Handles an item purchase started event.
 /// </summary>
 /// <param name="pvi">Purchasable virtual item.</param>
 public void onItemPurchaseStarted(PurchasableVirtualItem pvi)
 {
 }
Ejemplo n.º 53
0
 public void onMarketPurchase(PurchasableVirtualItem pvi, string purchaseToken, string payload)
 {
     #if DEBUG
             //Debug.Log("Just purchased an item with itemId: " + pvi.ItemId);
         #endif
 }
Ejemplo n.º 54
0
 public MarketPurchaseStartedEvent(PurchasableVirtualItem purchasableVirtualItem) : this(purchasableVirtualItem, false, null)
 {
 }
Ejemplo n.º 55
0
		public MarketRefundEvent (PurchasableVirtualItem purchasableVirtualItem, Object sender):base(sender)
		{
			mPurchasableVirtualItem = purchasableVirtualItem;
		}
Ejemplo n.º 56
0
 /// <summary>
 /// Handles an item purchase event.
 /// </summary>
 /// <param name="pvi">Purchasable virtual item.</param>
 public void onItemPurchased(PurchasableVirtualItem pvi, string payload)
 {
     mCtrl.ShowModalWindow("Success!", "You have successfully purchased the \n" + pvi.Name);
     mCtrl.UpdateUI();
 }
    // Successfully purchased
    void onMarketPurchase(PurchasableVirtualItem item, string payload, Dictionary<string, string> extra)
    {
        string[] info = payload.Split(':');
        if (info.Length != 2) return;

        ProfileAssistant.main.local_profile[info[0]] += int.Parse(info[1]);
        ProfileAssistant.main.SaveUserInventory();
        ItemCounter.RefreshAll();
        AudioAssistant.Shot ("Buy");
    }
Ejemplo n.º 58
0
 public MarketPurchaseStartedEvent(PurchasableVirtualItem purchasableVirtualItem, bool fraudProtection) : this(purchasableVirtualItem, fraudProtection, null)
 {
 }
Ejemplo n.º 59
0
 public MarketRefundEvent(PurchasableVirtualItem purchasableVirtualItem, Object sender) : base(sender)
 {
     mPurchasableVirtualItem = purchasableVirtualItem;
 }
Ejemplo n.º 60
0
			public void PushEventOnItemPurchased(PurchasableVirtualItem item, string payload) {
				var eventJSON = new JSONObject();
				eventJSON.AddField("itemId", item.ItemId);
				eventJSON.AddField("payload", payload);

				_pushEventItemPurchased(eventJSON.print());
			}