public static VirtualCategory GetCategoryForVirtualGood(string goodItemId)
        {
            #if UNITY_ANDROID && !UNITY_EDITOR
            VirtualCategory vc = null;
            AndroidJNI.PushLocalFrame(100);
            using(AndroidJavaObject jniVirtualVategory = AndroidJNIHandler.CallStatic<AndroidJavaObject>(
                new AndroidJavaClass("com.soomla.store.data.StoreInfo"),"getCategory", goodItemId)) {
                vc = new VirtualCategory(jniVirtualVategory);
            }
            AndroidJNI.PopLocalFrame(IntPtr.Zero);
            return vc;
            #elif UNITY_IOS && !UNITY_EDITOR
            IntPtr p = IntPtr.Zero;
            int err = storeInfo_GetCategoryForVirtualGood(goodItemId, out p);

            IOS_ErrorCodes.CheckAndThrowException(err);

            string json = Marshal.PtrToStringAnsi(p);
            Marshal.FreeHGlobal(p);

            JSONObject obj = new JSONObject(json);
            return new VirtualCategory(obj);
            #else
            return null;
            #endif
        }
Exemple #2
0
        public static VirtualCategory GetCategoryForVirtualGood(string goodItemId)
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            VirtualCategory vc = null;
            AndroidJNI.PushLocalFrame(100);
            using (AndroidJavaObject jniVirtualVategory = AndroidJNIHandler.CallStatic <AndroidJavaObject>(
                       new AndroidJavaClass("com.soomla.store.data.StoreInfo"), "getCategory", goodItemId)) {
                vc = new VirtualCategory(jniVirtualVategory);
            }
            AndroidJNI.PopLocalFrame(IntPtr.Zero);
            return(vc);
#elif UNITY_IOS && !UNITY_EDITOR
            IntPtr p   = IntPtr.Zero;
            int    err = storeInfo_GetCategoryForVirtualGood(goodItemId, out p);

            IOS_ErrorCodes.CheckAndThrowException(err);

            string json = Marshal.PtrToStringAnsi(p);
            Marshal.FreeHGlobal(p);

            JSONObject obj = new JSONObject(json);
            return(new VirtualCategory(obj));
#else
            return(null);
#endif
        }
 /// <summary>
 /// Gets the category that the virtual good with the given <c>goodItemId</c> belongs to.
 /// </summary>
 /// <param name="goodItemId">Item id.</param>
 /// <returns>Category that the item with given id belongs to.</returns>
 /// <exception cref="VirtualItemNotFoundException">Exception is thrown if category is not found.</exception>
 protected override VirtualCategory _getCategoryForVirtualGood(string goodItemId)
 {
     VirtualCategory vc = null;
     AndroidJNI.PushLocalFrame(100);
     using(AndroidJavaObject jniVirtualVategory = AndroidJNIHandler.CallStatic<AndroidJavaObject>(
         new AndroidJavaClass("com.soomla.store.data.StoreInfo"),"getCategory", goodItemId)) {
         vc = new VirtualCategory(jniVirtualVategory);
     }
     AndroidJNI.PopLocalFrame(IntPtr.Zero);
     return vc;
 }
Exemple #4
0
        /// <summary>
        /// Gets the category that the virtual good with the given <c>goodItemId</c> belongs to.
        /// </summary>
        /// <param name="goodItemId">Item id.</param>
        /// <returns>Category that the item with given id belongs to.</returns>
        /// <exception cref="VirtualItemNotFoundException">Exception is thrown if category is not found.</exception>
        override protected VirtualCategory _getCategoryForVirtualGood(string goodItemId)
        {
            VirtualCategory vc = null;

            AndroidJNI.PushLocalFrame(100);
            using (AndroidJavaObject jniVirtualVategory = AndroidJNIHandler.CallStatic <AndroidJavaObject>(
                       new AndroidJavaClass("com.soomla.store.data.StoreInfo"), "getCategory", goodItemId)) {
                vc = new VirtualCategory(jniVirtualVategory);
            }
            AndroidJNI.PopLocalFrame(IntPtr.Zero);
            return(vc);
        }