示例#1
0
        public static bool DrawSearchFilter()
        {
            int n      = FILTERS.Length;
            var nCols  = 4;
            int nRows  = Mathf.CeilToInt(n / (float)nCols);
            var result = false;

            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
            {
                if (GUILayout.Button("All", EditorStyles.toolbarButton) && !FR2_Setting.IsIncludeAllType())
                {
                    FR2_Setting.IncludeAllType();
                    result = true;
                }

                if (GUILayout.Button("None", EditorStyles.toolbarButton) && FR2_Setting.GetExcludeType() != -1)
                {
                    FR2_Setting.ExcludeAllType();
                    result = true;
                }
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            for (var i = 0; i < nCols; i++)
            {
                GUILayout.BeginVertical();
                for (var j = 0; j < nRows; j++)
                {
                    int idx = i * nCols + j;
                    if (idx >= n)
                    {
                        break;
                    }

                    bool s  = !FR2_Setting.IsTypeExcluded(idx);
                    bool s1 = GUILayout.Toggle(s, FILTERS[idx].name);
                    if (s1 != s)
                    {
                        result = true;
                        FR2_Setting.ToggleTypeExclude(idx);
                    }
                }

                GUILayout.EndVertical();
                if ((i + 1) * nCols >= n)
                {
                    break;
                }
            }

            GUILayout.EndHorizontal();


            return(result);
        }
示例#2
0
            public static bool DrawSearchFilter()
            {
                var n      = FILTERS.Length;
                var nCols  = 4;
                var nRows  = Mathf.CeilToInt(n / (float)nCols);
                var result = false;

                GUILayout.BeginHorizontal();
                for (var i = 0; i < nCols; i++)
                {
                    GUILayout.BeginVertical();
                    for (var j = 0; j < nRows; j++)
                    {
                        var idx = i * nCols + j;
                        if (idx >= n)
                        {
                            break;
                        }

                        var s  = !FR2_Setting.IsTypeExcluded(idx);
                        var s1 = GUILayout.Toggle(s, FILTERS[idx].name);
                        if (s1 != s)
                        {
                            result = true;
                            FR2_Setting.ToggleTypeExclude(idx);
                        }
                    }

                    GUILayout.EndVertical();
                    if ((i + 1) * nCols >= n)
                    {
                        break;
                    }
                }

                GUILayout.EndHorizontal();

                return(result);
            }