Exemplo n.º 1
0
        private void DrawSectionHeader(SearchFilter.ProviderDesc desc)
        {
            GUILayout.BeginHorizontal();

            GUILayout.Space(Styles.foldoutIndent);

            GUILayout.Label(GetProviderLabelContent(desc.provider, desc.name.displayName), Styles.filterHeader);
            GUILayout.FlexibleSpace();
            if (desc.provider != null)
            {
                var avgTime    = desc.provider.avgTime;
                var loadTime   = desc.provider.loadTime;
                var enableTime = desc.provider.enableTime;
                if (avgTime > 0.99 || loadTime > 9.99 || enableTime > 9.99)
                {
                    GUIContent content = new GUIContent(avgTime.ToString("0.#") + " ms",
                                                        $"Initialization took {loadTime.ToString("0.#")} ms\r\n" +
                                                        $"Activation took {enableTime.ToString("0.#")} ms");
                    GUILayout.Label(content, avgTime < 25.0 ? Styles.filterTimeLabel : Styles.filterTimeLongLabel);
                }
            }

            EditorGUI.BeginChangeCheck();
            GUI.SetNextControlName($"Box_{m_ToggleFilterNextIndex++}");
            bool isEnabled = GUILayout.Toggle(desc.name.isEnabled, "", Styles.filterToggle, GUILayout.ExpandWidth(false));

            if (EditorGUI.EndChangeCheck())
            {
                filter.SetFilter(isEnabled, desc.name.id);
            }

            GUILayout.EndHorizontal();
        }
Exemplo n.º 2
0
        private void DrawSectionHeader(SearchFilter.ProviderDesc desc)
        {
            GUILayout.BeginHorizontal();

            if (desc.categories.Count > 0)
            {
                EditorGUI.BeginChangeCheck();
                if (m_ExpandToggleIndex == m_ToggleFilterNextIndex &&
                    (Event.current.type == EventType.Repaint || Event.current.type == EventType.Layout))
                {
                    desc.isExpanded     = !desc.isExpanded;
                    GUI.changed         = true;
                    m_ExpandToggleIndex = -1;
                }
                bool isExpanded = GUILayout.Toggle(desc.isExpanded, "", Styles.filterExpanded);
                if (EditorGUI.EndChangeCheck())
                {
                    SearchService.Filter.SetExpanded(isExpanded, desc.entry.name.id);
                }
            }
            else
            {
                GUILayout.Space(Styles.foldoutIndent);
            }

            GUILayout.Label(GetProviderLabelContent(desc.provider, desc.entry.name.displayName), Styles.filterHeader);
            GUILayout.FlexibleSpace();
            if (desc.provider != null)
            {
                var avgTime    = desc.provider.avgTime;
                var loadTime   = desc.provider.loadTime;
                var enableTime = desc.provider.enableTime;
                if (avgTime > 0.99 || loadTime > 9.99 || enableTime > 9.99)
                {
                    GUIContent content = new GUIContent(avgTime.ToString("0.#") + " ms",
                                                        $"Initialization took {loadTime.ToString("0.#")} ms\r\n" +
                                                        $"Activation took {enableTime.ToString("0.#")} ms");
                    GUILayout.Label(content, avgTime < 25.0 ? Styles.filterTimeLabel : Styles.filterTimeLongLabel);
                }
            }

            EditorGUI.BeginChangeCheck();
            GUI.SetNextControlName($"Box_{m_ToggleFilterNextIndex++}");
            bool isEnabled = GUILayout.Toggle(desc.entry.isEnabled, "", Styles.filterToggle, GUILayout.ExpandWidth(false));

            if (EditorGUI.EndChangeCheck())
            {
                SearchService.Filter.SetFilter(isEnabled, desc.entry.name.id);
                quickSearchTool.Refresh();
            }

            GUILayout.EndHorizontal();
        }
Exemplo n.º 3
0
        private void DrawSubCategories(SearchFilter.ProviderDesc desc)
        {
            foreach (var cat in desc.categories)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Space(Styles.foldoutIndent + 5);
                GUILayout.Label(cat.name.displayName, Styles.filterEntry);
                GUILayout.FlexibleSpace();

                EditorGUI.BeginChangeCheck();
                GUI.SetNextControlName($"Box_{m_ToggleFilterNextIndex++}");
                bool isEnabled = GUILayout.Toggle(cat.isEnabled, "", Styles.filterToggle);
                if (EditorGUI.EndChangeCheck())
                {
                    SearchService.Filter.SetFilter(isEnabled, desc.entry.name.id, cat.name.id);
                    quickSearchTool.Refresh();
                }

                GUILayout.EndHorizontal();
            }
        }
Exemplo n.º 4
0
        private void DrawSectionHeader(SearchFilter.ProviderDesc desc)
        {
            GUILayout.BeginHorizontal();

            if (desc.categories.Count > 0)
            {
                EditorGUI.BeginChangeCheck();
                if (m_ExpandToggleIndex == m_ToggleFilterNextIndex &&
                    (Event.current.type == EventType.Repaint || Event.current.type == EventType.Layout))
                {
                    desc.isExpanded     = !desc.isExpanded;
                    GUI.changed         = true;
                    m_ExpandToggleIndex = -1;
                }
                bool isExpanded = GUILayout.Toggle(desc.isExpanded, "", Styles.filterExpanded);
                if (EditorGUI.EndChangeCheck())
                {
                    SearchService.Filter.SetExpanded(isExpanded, desc.entry.name.id);
                }
            }
            else
            {
                GUILayout.Space(Styles.foldoutIndent);
            }

            GUILayout.Label(desc.entry.name.displayName, Styles.filterHeader);
            GUILayout.FlexibleSpace();

            EditorGUI.BeginChangeCheck();
            GUI.SetNextControlName($"Box_{m_ToggleFilterNextIndex++}");
            bool isEnabled = GUILayout.Toggle(desc.entry.isEnabled, "", Styles.filterToggle, GUILayout.ExpandWidth(false));

            if (EditorGUI.EndChangeCheck())
            {
                SearchService.Filter.SetFilter(isEnabled, desc.entry.name.id);
                quickSearchTool.Refresh();
            }

            GUILayout.EndHorizontal();
        }