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()); }
void Start() { SoomlaStore.StartIabServiceInBg(); if (GameController.SoomlaStarted == false) { initializesoomla(); GameController.SoomlaStarted = true; } }
/// <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); }
void OnDestroy() { SoomlaStore.StopIabServiceInBg(); }