Exemple #1
0
        public static void Initialize(IStoreAssets storeAssets)
        {
            if (string.IsNullOrEmpty(SoomSettings.CustomSecret))
            {
                StoreUtils.LogError(TAG, "SOOMLA/UNITY MISSING customSecret !!! Stopping here !!");
                throw new ExitGUIException();
            }

            if (SoomSettings.CustomSecret == SoomSettings.ONLY_ONCE_DEFAULT)
            {
                StoreUtils.LogError(TAG, "SOOMLA/UNITY You have to change customSecret !!! Stopping here !!");
                throw new ExitGUIException();
            }

            SetupSoomSec();

#if UNITY_ANDROID && !UNITY_EDITOR
            if (string.IsNullOrEmpty(SoomSettings.AndroidPublicKey))
            {
                StoreUtils.LogError(TAG, "SOOMLA/UNITY MISSING publickKey !!! Stopping here !!");
                throw new ExitGUIException();
            }

            if (SoomSettings.AndroidPublicKey == SoomSettings.AND_PUB_KEY_DEFAULT)
            {
                StoreUtils.LogError(TAG, "SOOMLA/UNITY You have to change android publicKey !!! Stopping here !!");
                throw new ExitGUIException();
            }
#elif UNITY_IOS && !UNITY_EDITOR
            storeController_SetSSV(SoomSettings.IosSSV, "https://verify.soom.la/verify_ios?platform=unity4");
#endif

            StoreInfo.Initialize(storeAssets);

#if UNITY_ANDROID && !UNITY_EDITOR
            AndroidJNI.PushLocalFrame(100);
            //init EventHandler
            using (AndroidJavaClass jniEventHandler = new AndroidJavaClass("com.soomla.unity.EventHandler")) {
                jniEventHandler.CallStatic("initialize");
            }
            using (AndroidJavaObject jniStoreAssetsInstance = new AndroidJavaObject("com.soomla.unity.StoreAssets")) {
                using (AndroidJavaClass jniStoreControllerClass = new AndroidJavaClass("com.soomla.store.StoreController")) {
                    jniStoreController = jniStoreControllerClass.CallStatic <AndroidJavaObject>("getInstance");
                    jniStoreController.Call <bool>("initialize", jniStoreAssetsInstance, SoomSettings.AndroidPublicKey, SoomSettings.CustomSecret);
                }
            }
            AndroidJNI.PopLocalFrame(IntPtr.Zero);
#elif UNITY_IOS && !UNITY_EDITOR
            storeController_Init(SoomSettings.CustomSecret);
#endif
        }
Exemple #2
0
        /// <summary>
        /// Handles an <c>onGoodUpgrade</c> event, which is fired when a specific <c>UpgradeVG</c> has
        /// been upgraded/downgraded.
        /// </summary>
        /// <param name="message">Message that contains information about the good that has been
        /// upgraded/downgraded.</param>
        public void onGoodUpgrade(string message)
        {
            Utils.LogDebug(TAG, "SOOMLA/UNITY onGoodUpgrade:" + message);

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

            VirtualGood vg  = (VirtualGood)StoreInfo.GetItemByItemId(vars[0]);
            UpgradeVG   vgu = null;

            if (vars.Length > 1)
            {
                vgu = (UpgradeVG)StoreInfo.GetItemByItemId(vars[1]);
            }
            StoreEvents.OnGoodUpgrade(vg, vgu);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        /// <summary>
        /// Initializes the SOOMLA SDK.
        /// </summary>
        /// <param name="storeAssets">Your game's economy.</param>
        /// <exception cref="ExitGUIException">Thrown if customSecret or soomSec is missing or has not been changed.
        /// </exception>
        protected override void _initialize(IStoreAssets storeAssets)
        {
            if (SoomSettings.GPlayBP &&
                (string.IsNullOrEmpty(SoomSettings.AndroidPublicKey) ||
                 SoomSettings.AndroidPublicKey == SoomSettings.AND_PUB_KEY_DEFAULT))
            {
                Utils.LogError(TAG, "SOOMLA/UNITY You chose Google Play billing service but publicKey is not set!! Stopping here!!");
                throw new ExitGUIException();
            }

            StoreInfo.Initialize(storeAssets);

            AndroidJNI.PushLocalFrame(100);
            //init EventHandler
            using (AndroidJavaClass jniEventHandler = new AndroidJavaClass("com.soomla.unity.EventHandler")) {
                jniEventHandler.CallStatic("initialize");
            }
            using (AndroidJavaObject jniStoreAssetsInstance = new AndroidJavaObject("com.soomla.unity.StoreAssets")) {
                using (AndroidJavaClass jniStoreControllerClass = new AndroidJavaClass("com.soomla.store.StoreController")) {
                    jniStoreController = jniStoreControllerClass.CallStatic <AndroidJavaObject>("getInstance");
                    jniStoreController.Call <bool>("initialize", jniStoreAssetsInstance, SoomSettings.CustomSecret);
                }
            }

            using (AndroidJavaClass jniStoreConfigClass = new AndroidJavaClass("com.soomla.store.StoreConfig")) {
                jniStoreConfigClass.SetStatic("logDebug", SoomSettings.DebugMessages);
            }

            if (SoomSettings.GPlayBP)
            {
                using (AndroidJavaClass jniGooglePlayIabServiceClass = new AndroidJavaClass("com.soomla.store.billing.google.GooglePlayIabService")) {
                    AndroidJavaObject jniGooglePlayIabService = jniGooglePlayIabServiceClass.CallStatic <AndroidJavaObject>("getInstance");
                    jniGooglePlayIabService.Call("setPublicKey", SoomSettings.AndroidPublicKey);

                    jniGooglePlayIabServiceClass.SetStatic("AllowAndroidTestPurchases", SoomSettings.AndroidTestPurchases);
                }
            }
            AndroidJNI.PopLocalFrame(IntPtr.Zero);
        }
 /// <summary>
 /// Initializes the SOOMLA SDK.
 /// </summary>
 /// <param name="storeAssets">Your game's economy.</param>
 protected override void _initialize(IStoreAssets storeAssets)
 {
     storeController_SetSSV(SoomSettings.IosSSV, "https://verify.soom.la/verify_ios?platform=unity4");
     StoreInfo.Initialize(storeAssets);
     storeController_Init(SoomSettings.CustomSecret);
 }
Exemple #6
0
		public void onMarketPurchaseCancelled(string message) {
			StoreUtils.LogDebug(TAG, "SOOMLA/UNITY onMarketPurchaseCancelled: " + message);
			
			PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(message);
			Events.OnMarketPurchaseCancelled(pvi);
		}
Exemple #7
0
		public void onGoodUnequipped(string message) {
			StoreUtils.LogDebug(TAG, "SOOMLA/UNITY onVirtualGoodUnEquipped:" + message);
			
			EquippableVG vg = (EquippableVG)StoreInfo.GetItemByItemId(message);
			Events.OnGoodUnEquipped(vg);
		}
Exemple #8
0
		public void onMarketPurchase(string message) {
			Debug.Log ("SOOMLA/UNITY onMarketPurchase:" + message);
			
			PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(message);
			Events.OnMarketPurchase(pvi);
		}