예제 #1
0
 /// <summary>
 /// Initializes the <see cref="BaseEditorUtility"/> class.
 /// </summary>
 static BaseEditorUtility()
 {
     foreach (System.Type type in ReflectionX.AllTypes)
     {
         if (!type.IsAbstract && typeof(BaseEditor).IsAssignableFrom(type))
         {
             MethodInfo initializeMethod = type.GetStaticMethod("InitializeClass");
             if (initializeMethod != null)
             {
                 initializeMethod.Invoke(null, null);
             }
             PropertyInfo featureGroupProp = type.GetStaticProperty("ProductCategory");
             if (featureGroupProp == null)
             {
                 continue;
             }
             AssetStoreProduct product = (AssetStoreProduct)featureGroupProp.GetValue(null, null);
             if (product == AssetStoreProduct.None)
             {
                 continue;
             }
             MethodInfo prefMenuMethod = type.GetStaticMethod("DisplayHandlePreferences");
             if (prefMenuMethod == null || prefMenuMethod.DeclaringType != type)
             {
                 continue;
             }
             EditorPreferenceMenu.AddPreferenceMenuItem(product, prefMenuMethod);
         }
     }
 }
예제 #2
0
        protected override void Reset()
        {
            base.Reset();

#if UNITY_EDITOR
            m_assetStoreProduct = new AssetStoreProduct(kProductName, kProductVersion, Constants.kLogoPath);
#endif
        }
예제 #3
0
        private static void EditorUpdateCallback()
        {
            // Unregister from callback
            EditorApplication.update -= EditorUpdateCallback;

            // Create instance if required
            if (AssetStoreProduct == null)
            {
                AssetStoreProduct = new AssetStoreProduct(Constants.kProductName, Constants.kProductVersion, kLogoPath);
            }
        }
 /// <summary>
 /// Displays the preferences for a feature.
 /// </summary>
 /// <param name="product">Product.</param>
 private void DisplayPreferences(AssetStoreProduct product)
 {
     m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition);
     {
         foreach (MethodInfo method in s_ProductMenuItems[product])
         {
             EditorGUILayout.LabelField(
                 method.ReflectedType.IsGenericType ?
                 string.Format(
                     "{0} ({1})",
                     method.ReflectedType.Name.ToWords().Range(0, -2),
                     ", ".Join(from t in method.ReflectedType.GetGenericArguments() select t.Name.ToWords())
                     ) : method.ReflectedType.Name.ToWords(),
                 EditorStyles.boldLabel
                 );
             EditorGUIX.DisplayHorizontalLine();
             EditorGUI.indentLevel += 1;
             method.Invoke(null, null);
             EditorGUI.indentLevel -= 1;
         }
     }
     EditorGUILayout.EndScrollView();
     // bug report button
     DisplayBugReportButton(product);
     // forum link button
     if (
         s_ProductForumUrls.ContainsKey(product) &&
         !string.IsNullOrEmpty(s_ProductForumUrls[product]) &&
         EditorGUIX.DisplayButton(string.Format("Get Help with {0}", product.ToString().ToWords()))
         )
     {
         OpenUrl(s_ProductForumUrls[product]);
     }
     // asset store page
     if (
         s_ProductPageUrls.ContainsKey(product) &&
         !string.IsNullOrEmpty(s_ProductPageUrls[product]) &&
         EditorGUIX.DisplayButton(
             string.Format("Review {0} on the Unity Asset Store", product.ToString().ToWords())
             )
         )
     {
         OpenUrl(s_ProductPageUrls[product]);
     }
     // products page
     if (EditorGUIX.DisplayButton("More Products by Candlelight Interactive"))
     {
         OpenUrl(s_PublisherPage);
     }
 }
 /// <summary>
 /// Displays the bug report button.
 /// </summary>
 /// <param name="product">Product.</param>
 private static void DisplayBugReportButton(AssetStoreProduct product)
 {
     if (EditorGUIX.DisplayButton(string.Format("Report a Problem with {0}", product.ToString().ToWords())))
     {
         OpenUrl(
             string.Format(
                 "mailto:{0}?subject={1} Bug Report&body=1) What happened?\n\n2) How often does it happen?\n\n" +
                 "3) How can I reproduce it using the example you attached?",
                 s_BugReportEmailAddress, product.ToString().ToWords()
                 ),
             "Error Creating Bug Report",
             "Please ensure an application is associated with email links."
             );
     }
 }
예제 #6
0
        private void Initialise()
        {
            m_assetStoreProduct = new AssetStoreProduct(kProductName, kProductVersion, Constants.kLogoPath);
//			SetupRateNPSettings();

#if USES_BILLING
            // Rebuilding asset bundles is required
            if (m_billingSettings.Products != null)
            {
                foreach (BillingProduct _billingProduct in m_billingSettings.Products)
                {
                    _billingProduct.RebuildObject();
                }
            }
#endif
        }
예제 #7
0
        protected override void OnEnable()
        {
            base.OnEnable();

#if UNITY_EDITOR
            m_assetStoreProduct = new AssetStoreProduct(kProductName, kProductVersion, Constants.kLogoPath);
#endif

            // Set debug mode
            if (m_applicationSettings.IsDebugMode)
            {
                DebugPRO.Console.RemoveIgnoreTag(Constants.kDebugTag);
            }
            else
            {
                DebugPRO.Console.AddIgnoreTag(Constants.kDebugTag);
            }
        }
        /// <summary>
        /// Adds the preference menu item.
        /// </summary>
        /// <param name="product">Product.</param>
        /// <param name="method">Method.</param>
        public static void AddPreferenceMenuItem(AssetStoreProduct product, MethodInfo method)
        {
            if (!s_ProductMenuItems.ContainsKey(product))
            {
                s_ProductMenuItems.Add(product, new List <MethodInfo>());
            }
            s_ProductTabIndices.Clear();
            int productIndex = 0;

            foreach (AssetStoreProduct p in s_ProductMenuItems.Keys)
            {
                if (p == AssetStoreProduct.None)
                {
                    continue;
                }
                s_ProductTabIndices[p] = productIndex;
                ++productIndex;
                if (p == AssetStoreProduct.Other)
                {
                    continue;
                }
            }
            s_ProductMenuItems[product].Add(method);
            s_ProductMenuItems[product].Sort(
                (a, b) => string.Format("{0}.{1}", a.ReflectedType, a.Name).CompareTo(
                    string.Format("{0}.{1}", b.ReflectedType, b.Name)
                    )
                );
            List <GUIContent> labels = new List <GUIContent>();

            labels.AddRange(from tabName in s_ProductMenuItems.Keys select new GUIContent(tabName.ToString().ToWords()));
            s_ProductTabLabels = labels.ToArray();
            s_TabPages.Clear();
            for (int i = 0; i < s_ProductTabLabels.Length; ++i)
            {
                s_TabPages.Add(i, () => Instance.DisplayPreferences(Instance.m_CurrentTab));
            }
        }
예제 #9
0
        private void Initialise()
        {
            // Initialise product settings
            m_assetStoreProduct = new AssetStoreProduct(kProductName, kProductVersion, Constants.kLogoPath);

            // Initialise Game Services settings
#if USES_GAME_SERVICES
            if (m_gameServicesSettings.AchievementMetadataCollection == null)
            {
                IDContainer[]         _achievementIDCollection = m_gameServicesSettings.AchievementIDCollection;
                int                   _count = _achievementIDCollection.Length;
                AchievementMetadata[] _metadataCollection = new AchievementMetadata[_count];

                for (int _iter = 0; _iter < _count; _iter++)
                {
                    _metadataCollection[_iter] = AchievementMetadata.Create(_achievementIDCollection[_iter]);
                }

                m_gameServicesSettings.AchievementMetadataCollection = _metadataCollection;
            }

            if (m_gameServicesSettings.LeaderboardMetadataCollection == null)
            {
                IDContainer[]         _leaderboardIDCollection = m_gameServicesSettings.LeaderboardIDCollection;
                int                   _count = _leaderboardIDCollection.Length;
                LeaderboardMetadata[] _metadataCollection = new LeaderboardMetadata[_count];

                for (int _iter = 0; _iter < _count; _iter++)
                {
                    _metadataCollection[_iter] = LeaderboardMetadata.Create(_leaderboardIDCollection[_iter]);
                }

                m_gameServicesSettings.LeaderboardMetadataCollection = _metadataCollection;
            }
#endif
        }
예제 #10
0
 private void InitialiseEditor()
 {
     m_assetStoreProduct = new AssetStoreProduct(kProductName,
                                                 kProductVersion,
                                                 Constants.kLogoPath);
 }
예제 #11
0
 /// <summary>
 /// Adds the preference menu item.
 /// </summary>
 /// <param name="product">Product.</param>
 /// <param name="method">Method.</param>
 public static void AddPreferenceMenuItem(AssetStoreProduct product, System.Action method)
 {
     AddPreferenceMenuItem(product, method.Method);
 }