コード例 #1
0
ファイル: StoreInfo.cs プロジェクト: jennydvr/SimpleRunner
        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
        }
コード例 #2
0
        public static VirtualCategory GetCategoryForVirtualGood(string goodItemId)
        {
#if UNITY_ANDROID
            VirtualCategory vc = null;
            AndroidJNI.PushLocalFrame(100);
            using (AndroidJavaObject jniVirtualVategory = AndroidJNIHandler.CallStatic <AndroidJavaObject>(
                       new AndroidJavaClass("com.soomla.unity.StoreInfo"), "getCategoryForVirtualGood", goodItemId)) {
                vc = new VirtualCategory(jniVirtualVategory);
            }
            AndroidJNI.PopLocalFrame(IntPtr.Zero);
            return(vc);
#elif UNITY_IOS
            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
        }
コード例 #3
0
ファイル: VirtualGood.cs プロジェクト: akshatg/unity3d-store
 public VirtualGood(JSONObject jsonVg)
     : base(jsonVg)
 {
     this.PriceModel = AbstractPriceModel.CreatePriceModel((JSONObject)jsonVg[JSONConsts.GOOD_PRICE_MODEL]);
     int categoryId = System.Convert.ToInt32(((JSONObject)jsonVg[JSONConsts.GOOD_CATEGORY_ID]).n);
     try {
         if (categoryId > -1) {
             this.Category = StoreInfo.GetVirtualCategoryById(categoryId);
         }
     } catch (VirtualItemNotFoundException e) {
         Debug.Log("Couldn't find category with id: " + categoryId);
     }
 }
コード例 #4
0
ファイル: VirtualGood.cs プロジェクト: akshatg/unity3d-store
        public VirtualGood(AndroidJavaObject jniVirtualGood)
            : base(jniVirtualGood)
        {
            // Virtual Category
            using(AndroidJavaObject jniVirtualCategory = jniVirtualGood.Call<AndroidJavaObject>("getCategory")) {
                this.Category = new VirtualCategory(jniVirtualCategory);
            }

            // Price Model
            using(AndroidJavaObject jniPriceModel = jniVirtualGood.Call<AndroidJavaObject>("getPriceModel")) {
                this.PriceModel = AbstractPriceModel.CreatePriceModel(jniPriceModel);
            }
        }
コード例 #5
0
        /// <summary>
        /// Dibuja la categoria de items equipables
        /// </summary>
        /// <param name="maxWidth">Ancho maximo</param>
        /// <param name="maxHeight">Alto maximo</param>
        public static void DrawCategory(VirtualCategory category, float maxWidth, float maxHeight)
        {
            // Dibujo el fondo
            CategoryRect.width = maxWidth;
            CategoryRect.height = maxHeight;

            GUI.Box(CategoryRect, string.Empty);

            StuffRect.width = maxWidth - 40;
            StuffRect.height = maxHeight - 40;
            GUI.BeginGroup(StuffRect);

            // Botones de paso entre categorias
            DrawButtons(category.GoodItemIds.Count, StuffRect.width, StuffRect.height);

            // Obtengo el item
            VirtualItemDecorator item = LocalStoreInfo.Items[category.GoodItemIds[ID]];
            DrawItem(item, StuffRect.width, StuffRect.height);

            // Botones de interaccion con el item
            DrawInteractions(item, StuffRect.width, StuffRect.height);

            GUI.EndGroup();
        }
コード例 #6
0
ファイル: VirtualGood.cs プロジェクト: akshatg/unity3d-store
 public VirtualGood(string name, string description, AbstractPriceModel priceModel, string itemId, VirtualCategory category)
     : base(name, description, itemId)
 {
     this.PriceModel = priceModel;
     this.Category = category;
 }