This class holds the basic assets needed to operate the Store. You can use it to purchase products from the mobile store. This is the only class you need to initialize in order to use the SOOMLA SDK.
コード例 #1
0
        void initializesoomla()
        {
            StoreEvents.OnMarketPurchase              += onMarketPurchase;
            StoreEvents.OnMarketRefund                += onMarketRefund;
            StoreEvents.OnItemPurchased               += onItemPurchased;
            StoreEvents.OnGoodEquipped                += onGoodEquipped;
            StoreEvents.OnGoodUnEquipped              += onGoodUnequipped;
            StoreEvents.OnGoodUpgrade                 += onGoodUpgrade;
            StoreEvents.OnBillingSupported            += onBillingSupported;
            StoreEvents.OnBillingNotSupported         += onBillingNotSupported;
            StoreEvents.OnMarketPurchaseStarted       += onMarketPurchaseStarted;
            StoreEvents.OnItemPurchaseStarted         += onItemPurchaseStarted;
            StoreEvents.OnCurrencyBalanceChanged      += onCurrencyBalanceChanged;
            StoreEvents.OnGoodBalanceChanged          += onGoodBalanceChanged;
            StoreEvents.OnMarketPurchaseCancelled     += onMarketPurchaseCancelled;
            StoreEvents.OnMarketPurchaseDeferred      += onMarketPurchaseDeferred;
            StoreEvents.OnRestoreTransactionsStarted  += onRestoreTransactionsStarted;
            StoreEvents.OnRestoreTransactionsFinished += onRestoreTransactionsFinished;
            StoreEvents.OnSoomlaStoreInitialized      += onSoomlaStoreInitialized;
            StoreEvents.OnUnexpectedStoreError        += onUnexpectedStoreError;

            StoreEvents.OnVerificationStarted += onVerificationStarted;

#if UNITY_ANDROID && !UNITY_EDITOR
            StoreEvents.OnIabServiceStarted += onIabServiceStarted;
            StoreEvents.OnIabServiceStopped += onIabServiceStopped;
#endif
            SoomlaStore.Initialize(new SoomlaAssets());
        }
コード例 #2
0
 void Start()
 {
     SoomlaStore.StartIabServiceInBg();
     if (GameController.SoomlaStarted == false)
     {
         initializesoomla();
         GameController.SoomlaStarted = true;
     }
 }
コード例 #3
0
        /// <summary>
        /// Buys the purchasable virtual item.
        /// Implementation in subclasses will be according to specific type of purchase.
        /// </summary>
        /// <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="Soomla.Store.InsufficientFundsException">throws InsufficientFundsException</exception>
        public override void Buy(string payload)
        {
            SoomlaUtils.LogDebug(TAG, "Starting in-app purchase for productId: "
                                 + MarketItem.ProductId);

            JSONObject eventJSON = new JSONObject();

            eventJSON.AddField("itemId", AssociatedItem.ItemId);
            StoreEvents.Instance.onItemPurchaseStarted(eventJSON.print(), true);
            SoomlaStore.BuyMarketItem(MarketItem.ProductId, payload);
        }
コード例 #4
0
 void OnDestroy()
 {
     SoomlaStore.StopIabServiceInBg();
 }