Ejemplo n.º 1
0
        public static UnityEditor.SettingsProvider CreateSettingsProvider()
        {
            var provider = new UnityEditor.SettingsProvider("Project/Serilog", SettingsScope.Project)
            {
                label = "Serilog",

                activateHandler = (searchContext, rootElement) =>
                {
                    m_Settings = SerilogSettings.Instance;
                    var logLevelField = new EnumField("Log Level", m_Settings.LogLevel);
                    logLevelField.RegisterCallback <ChangeEvent <Enum> >(SerilogSettings_OnValueChanged);
                    rootElement.Add(logLevelField);
                },
                keywords = new HashSet <string>(new[] { "Logging", "Serilog", "Log Level" })
            };

            return(provider);
        }
        static SettingsProvider CreateProjectSettingsProvider()
        {
            var provider = AssetSettingsProvider.CreateProviderFromAssetPath("Project/Graphics", "ProjectSettings/GraphicsSettings.asset");

            provider.keywords = SettingsProvider.GetSearchKeywordsFromGUIContentProperties <Styles>()
                                .Concat(SettingsProvider.GetSearchKeywordsFromGUIContentProperties <TierSettingsEditor.Styles>())
                                .Concat(SettingsProvider.GetSearchKeywordsFromGUIContentProperties <BuiltinShadersEditor.Styles>())
                                .Concat(SettingsProvider.GetSearchKeywordsFromGUIContentProperties <ShaderStrippingEditor.Styles>())
                                .Concat(SettingsProvider.GetSearchKeywordsFromGUIContentProperties <ShaderPreloadEditor.Styles>())
                                .Concat(SettingsProvider.GetSearchKeywordsFromPath("ProjectSettings/GraphicsSettings.asset"));

            provider.activateHandler = (searchContext, rootElement) =>
            {
                (provider.settingsEditor as GraphicsSettingsInspector)?.SetSectionOpenListener(provider.Repaint);
            };

            provider.icon = EditorGUIUtility.FindTexture("UnityEngine/UI/GraphicRaycaster Icon");
            return(provider);
        }
Ejemplo n.º 3
0
        private void ProviderChanged(SettingsProvider lastSelectedProvider, SettingsProvider newlySelectedProvider)
        {
            if (m_SettingsPanel == null)
            {
                return;
            }

            m_ProviderChanging = true;
            lastSelectedProvider?.OnDeactivate();
            m_SettingsPanel.Clear();

            if (newlySelectedProvider != null)
            {
                newlySelectedProvider?.OnActivate(m_SearchText, m_SettingsPanel);
                EditorPrefs.SetString(GetPrefKeyName(titleContent.text + "_current_provider"), newlySelectedProvider.settingsPath);
            }

            SetupIMGUIForCurrentProviderIfNeeded();
            m_ProviderChanging = false;
        }
Ejemplo n.º 4
0
        private void ProviderChanged(SettingsProvider lastSelectedProvider, SettingsProvider newlySelectedProvider)
        {
            if (m_SettingsPanel == null)
            {
                return;
            }

            lastSelectedProvider?.OnDeactivate();
            m_SettingsPanel.Clear();

            if (newlySelectedProvider != null)
            {
                newlySelectedProvider?.OnActivate(m_SearchText, m_SettingsPanel);
                EditorPrefs.SetString(GetPrefKeyName(titleContent.text + "_current_provider"), newlySelectedProvider.settingsPath);
            }

            if (m_SettingsPanel.childCount == 0)
            {
                var imguiContainer = new IMGUIContainer(DrawSettingsPanel);
                imguiContainer.AddToClassList("settings-panel-imgui-container");
                m_SettingsPanel.Add(imguiContainer);
            }
        }
        static SettingsProvider CreateProjectSettingsProvider()
        {
            var provider = new AssetSettingsProvider("Project/Graphics", "ProjectSettings/GraphicsSettings.asset");

            provider.PopulateSearchKeywordsFromGUIContentProperties <Styles>();
            provider.PopulateSearchKeywordsFromGUIContentProperties <TierSettingsEditor.Styles>();
            provider.PopulateSearchKeywordsFromGUIContentProperties <BuiltinShadersEditor.Styles>();
            provider.PopulateSearchKeywordsFromGUIContentProperties <ShaderStrippingEditor.Styles>();
            provider.PopulateSearchKeywordsFromGUIContentProperties <ShaderPreloadEditor.Styles>();

            var graphicSettings = provider.CreateEditor() as GraphicsSettingsInspector;

            SettingsProvider.GetSearchKeywordsFromSerializedObject(graphicSettings.serializedObject, provider.keywords);
            SettingsProvider.GetSearchKeywordsFromSerializedObject(graphicSettings.alwaysIncludedShadersEditor.serializedObject, provider.keywords);

            provider.onEditorCreated = editor =>
            {
                (editor as GraphicsSettingsInspector).SetSectionOpenListener(provider.settingsWindow.Repaint);
            };

            provider.icon = EditorGUIUtility.FindTexture("UnityEngine/UI/GraphicRaycaster Icon");
            return(provider);
        }
Ejemplo n.º 6
0
        static SettingsProvider CreateSearchSettings()
        {
            var settings = new SettingsProvider(settingsPreferencesKey, SettingsScope.User)
            {
                keywords   = new[] { "search" },
                guiHandler = searchContext =>
                {
                    EditorGUIUtility.labelWidth = 500;
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Space(10);
                        GUILayout.BeginVertical();
                        {
                            GUILayout.Space(10);
                            DrawProviderSettings();
                        }
                        GUILayout.EndVertical();
                    }
                    GUILayout.EndHorizontal();
                }
            };

            return(settings);
        }
        internal static SettingsProvider CreateProjectSettingsProvider()
        {
            var provider = AssetSettingsProvider.CreateProviderFromAssetPath(
                "Project/Quality", "ProjectSettings/QualitySettings.asset",
                SettingsProvider.GetSearchKeywordsFromGUIContentProperties <Styles>().Concat(SettingsProvider.GetSearchKeywordsFromPath("ProjectSettings/QualitySettings.asset")));

            return(provider);
        }
 internal static SettingsProvider CreateProjectSettingsProvider()
 {
     var provider = new AssetSettingsProvider("Project/Cluster Input", "ProjectSettings/ClusterInputManager.asset");
     SettingsProvider.GetSearchKeywordsFromSerializedObject(provider.CreateEditor().serializedObject, provider.keywords);
     return provider;
 }
        internal static SettingsProvider CreateSettingsProvider()
        {
            var settingsProvider = new SettingsProvider("Preferences/2D/Grid Brush", SettingsScope.User, SettingsProvider.GetSearchKeywordsFromGUIContentProperties <GridBrushProperties>())
            {
                guiHandler = searchContext =>
                {
                    PreferencesGUI();
                }
            };

            return(settingsProvider);
        }