Ejemplo n.º 1
0
        public static void AddNonConsumableItem(string nonConsItemId)
        {
            if (!Application.isEditor)
            {
                StoreUtils.LogDebug(TAG, "SOOMLA/UNITY Calling AddNonConsumableItem with: " + nonConsItemId);
#if UNITY_ANDROID
                AndroidJNI.PushLocalFrame(100);
                using (AndroidJavaClass jniStoreInventory = new AndroidJavaClass("com.soomla.store.StoreInventory")) {
                    AndroidJNIHandler.CallStaticVoid(jniStoreInventory, "addNonConsumableItem", nonConsItemId);
                }
                AndroidJNI.PopLocalFrame(IntPtr.Zero);
#elif UNITY_IOS
                int err = storeInventory_AddNonConsumableItem(nonConsItemId);

                IOS_ErrorCodes.CheckAndThrowException(err);
#endif
            }
        }
Ejemplo n.º 2
0
        public static void TakeItem(string itemId, int amount)
        {
            if (!Application.isEditor)
            {
                StoreUtils.LogDebug(TAG, "SOOMLA/UNITY Calling TakeItem with itedId: " + itemId + " and amount: " + amount);
#if UNITY_ANDROID
                AndroidJNI.PushLocalFrame(100);
                using (AndroidJavaClass jniStoreInventory = new AndroidJavaClass("com.soomla.store.StoreInventory")) {
                    AndroidJNIHandler.CallStaticVoid(jniStoreInventory, "takeVirtualItem", itemId, amount);
                }
                AndroidJNI.PopLocalFrame(IntPtr.Zero);
#elif UNITY_IOS
                int err = storeInventory_TakeItem(itemId, amount);

                IOS_ErrorCodes.CheckAndThrowException(err);
#endif
            }
        }
Ejemplo n.º 3
0
        public static void RemoveGoodUpgrades(string goodItemId)
        {
            if (!Application.isEditor)
            {
                StoreUtils.LogDebug(TAG, "SOOMLA/UNITY Calling RemoveGoodUpgrades with: " + goodItemId);
#if UNITY_ANDROID
                AndroidJNI.PushLocalFrame(100);
                using (AndroidJavaClass jniStoreInventory = new AndroidJavaClass("com.soomla.store.StoreInventory")) {
                    AndroidJNIHandler.CallStaticVoid(jniStoreInventory, "removeUpgrades", goodItemId);
                }
                AndroidJNI.PopLocalFrame(IntPtr.Zero);
#elif UNITY_IOS
                int err = storeInventory_RemoveGoodUpgrades(goodItemId);

                IOS_ErrorCodes.CheckAndThrowException(err);
#endif
            }
        }
Ejemplo n.º 4
0
        public static void BuyItem(string itemId)
        {
            if (!Application.isEditor)
            {
                StoreUtils.LogDebug(TAG, "SOOMLA/UNITY Calling BuyItem with: " + itemId);
#if UNITY_ANDROID && !UNITY_EDITOR
                AndroidJNI.PushLocalFrame(100);
                using (AndroidJavaClass jniStoreInventory = new AndroidJavaClass("com.soomla.store.StoreInventory")) {
                    AndroidJNIHandler.CallStaticVoid(jniStoreInventory, "buy", itemId);
                }
                AndroidJNI.PopLocalFrame(IntPtr.Zero);
#elif UNITY_IOS && !UNITY_EDITOR
                int err = storeInventory_BuyItem(itemId);

                IOS_ErrorCodes.CheckAndThrowException(err);
#endif
            }
        }