Exemplo n.º 1
0
        public void Draw()
        {
            if (refs == null)
            {
                return;
            }

            if (dirty || list == null)
            {
                ApplyFilter();
            }
            groupDrawer.Draw();

            if (showSearch)
            {
                if (toolbarSearchField == null)
                {
                    toolbarSearchField                  = "ToolbarSeachTextFieldPopup";
                    toolbarSearchFieldCancelButton      = "ToolbarSeachCancelButton";
                    toolbarSearchFieldCancelButtonEmpty = "ToolbarSeachCancelButtonEmpty";
                }

                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                {
                    var v = GUILayout.Toggle(caseSensitive, "Aa", EditorStyles.toolbarButton, GUILayout.Width(24f));
                    if (v != caseSensitive)
                    {
                        caseSensitive = v;
                        dirty         = true;
                    }

                    GUILayout.Space(2f);
                    var value = GUILayout.TextField(searchTerm, toolbarSearchField);
                    if (searchTerm != value)
                    {
                        searchTerm = value;
                        dirty      = true;
                    }

                    var style = string.IsNullOrEmpty(searchTerm) ? toolbarSearchFieldCancelButtonEmpty : toolbarSearchFieldCancelButton;
                    if (GUILayout.Button("Cancel", style))
                    {
                        searchTerm = string.Empty;
                        dirty      = true;
                    }

                    GUILayout.Space(2f);
                }
                GUILayout.EndHorizontal();
            }

            GUILayout.BeginHorizontal(EditorStyles.toolbar);
            {
                if (FR2_Unity.DrawToggleToolbar(ref FR2_Setting.showSettings, "*", 20f))
                {
                    dirty = true;
                    if (FR2_Setting.showSettings)
                    {
                        selectFilter = false;
                    }
                }

                bool v;
                if (excludeCount > 0)
                {
                    var oc = GUI.backgroundColor;
                    GUI.backgroundColor = Color.red;
                    v = GUILayout.Toggle(selectFilter, "Filter", EditorStyles.toolbarButton, GUILayout.Width(50f));
                    GUI.backgroundColor = oc;
                }
                else
                {
                    v = GUILayout.Toggle(selectFilter, "Filter", EditorStyles.toolbarButton, GUILayout.Width(50f));
                }

                if (v != selectFilter)
                {
                    selectFilter = v;
                    if (selectFilter)
                    {
                        FR2_Setting.showSettings = false;
                    }
                }

                v = GUILayout.Toggle(showSearch, "Search", EditorStyles.toolbarButton, GUILayout.Width(50f));
                if (v != showSearch)
                {
                    showSearch = v;
                    dirty      = true;
                }

                var ss = FR2_Setting.ShowSelection;
                v = GUILayout.Toggle(ss, "Selection", EditorStyles.toolbarButton, GUILayout.Width(60f));
                if (v != ss)
                {
                    FR2_Setting.ShowSelection = v;
                    dirty = true;
                }

                GUILayout.FlexibleSpace();

                var o = EditorGUIUtility.labelWidth;
                EditorGUIUtility.labelWidth = 42f;

                var ov = FR2_Setting.GroupMode;
                var vv = (Mode)EditorGUILayout.EnumPopup("Group", ov, GUILayout.Width(122f));
                if (vv != ov)
                {
                    FR2_Setting.GroupMode = vv;
                    dirty = true;
                }

                GUILayout.Space(4f);
                EditorGUIUtility.labelWidth = 30f;

                var s   = FR2_Setting.SortMode;
                var vvv = (Sort)EditorGUILayout.EnumPopup("Sort", s, GUILayout.Width(100f));
                if (vvv != s)
                {
                    FR2_Setting.SortMode = vvv;
                    RefreshSort();
                }

                EditorGUIUtility.labelWidth = o;
            }

            GUILayout.EndHorizontal();

            if (FR2_Setting.showSettings)
            {
                FR2_Setting.s.DrawSettings();
            }
            else if (selectFilter)
            {
                if (AssetType.DrawSearchFilter())
                {
                    dirty = true;
                }
            }
        }
Exemplo n.º 2
0
        protected void DrawFooter()
        {
            GUILayout.FlexibleSpace();


            GUILayout.BeginHorizontal(EditorStyles.toolbar);
            {
                Color color = GUI.contentColor;
                GUI.contentColor = EditorGUIUtility.isProSkin
                                        ? new Color(0.9f, 0.9f, 0.9f, 1f)
                                        : new Color(0.1f, 0.1f, 0.1f, 1f);

                if (FR2_Unity.DrawToggleToolbar(ref FR2_Setting.showSettings, Icon.icons.Setting, 21f))
                {
                    maskDirty();
                    if (FR2_Setting.showSettings)
                    {
                        showFilter = showIgnore = false;
                    }
                }

                GUI.contentColor = color;

                bool   v       = checkNoticeFilter();
                string content = !FR2_Setting.IsIncludeAllType() ? "*Filter" : "Filter";
                if (v)
                {
                    Color oc = GUI.backgroundColor;
                    GUI.backgroundColor = Color.red;
                    v = GUILayout.Toggle(showFilter, content, EditorStyles.toolbarButton, GUILayout.Width(50f));
                    GUI.backgroundColor = oc;
                }
                else
                {
                    v = GUILayout.Toggle(showFilter, content, EditorStyles.toolbarButton, GUILayout.Width(50f));
                }

                if (v != showFilter)
                {
                    showFilter = v;
                    if (showFilter)
                    {
                        FR2_Setting.showSettings = showIgnore = false;
                    }
                }

                v       = checkNoticeIgnore();
                content = FR2_Setting.IgnoreAsset.Count > 0 ? "*Ignore" : "Ignore";
                if (v)
                {
                    Color oc = GUI.backgroundColor;
                    GUI.backgroundColor = Color.red;
                    v = GUILayout.Toggle(showIgnore, content, EditorStyles.toolbarButton, GUILayout.Width(50f));
                    GUI.backgroundColor = oc;
                }
                else
                {
                    v = GUILayout.Toggle(showIgnore, content, EditorStyles.toolbarButton, GUILayout.Width(50f));
                }

                // var i = GUILayout.Toggle(showIgnore, content, EditorStyles.toolbarButton, GUILayout.Width(50f));
                if (v != showIgnore)
                {
                    showIgnore = v;
                    if (v)
                    {
                        showFilter = FR2_Setting.showSettings = false;
                    }
                }

                bool ss = FR2_Setting.ShowSelection;
                v = GUILayout.Toggle(ss, "Selection", EditorStyles.toolbarButton, GUILayout.Width(60f));
                if (v != ss)
                {
                    FR2_Setting.ShowSelection = v;
                    maskDirty();
                }

                if (FR2_Selection.SelectionCount > 0)
                {
                    if (GUILayout.Button("Commit Selection [" + FR2_Selection.SelectionCount + "]",
                                         EditorStyles.toolbarButton))
                    {
                        FR2_Selection.Commit();
                    }

                    if (GUILayout.Button("Clear Selection", EditorStyles.toolbarButton))
                    {
                        FR2_Selection.ClearSelection();
                    }
                }


                GUILayout.FlexibleSpace();


                if (!IsFocusingDuplicate && !IsFocusingGUIDs)
                {
                    float o = EditorGUIUtility.labelWidth;
                    EditorGUIUtility.labelWidth = 42f;

                    FR2_RefDrawer.Mode ov = FR2_Setting.GroupMode;
                    var vv = (FR2_RefDrawer.Mode)EditorGUILayout.EnumPopup("Group", ov, GUILayout.Width(122f));
                    if (vv != ov)
                    {
                        FR2_Setting.GroupMode = vv;
                        maskDirty();
                    }

                    GUILayout.Space(4f);
                    EditorGUIUtility.labelWidth = 30f;

                    FR2_RefDrawer.Sort s = FR2_Setting.SortMode;
                    var vvv = (FR2_RefDrawer.Sort)EditorGUILayout.EnumPopup("Sort", s, GUILayout.Width(100f));
                    if (vvv != s)
                    {
                        FR2_Setting.SortMode = vvv;
                        RefreshSort();
                    }

                    EditorGUIUtility.labelWidth = o;
                }
            }

            GUILayout.EndHorizontal();
        }