private static int DrawFlagsEnumButton(string label, Type valueType, int value, params GUILayoutOption[] options)
        {
            string[] enumNames = Enum.GetNames(valueType);

            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.PrefixLabel(label);
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Everything", EditorStyles.toolbarButton, GUILayout.Width(120)))
                {
                    value = 0;
                    for (int i = 0; i < enumNames.Length; ++i)
                    {
                        int tValue = Convert.ToInt32(Enum.Parse(valueType, enumNames[i]));
                        value |= tValue;
                    }
                }
                if (GUILayout.Button("Nothing", EditorStyles.toolbarButton, GUILayout.Width(120)))
                {
                    value = 0;
                }
            }
            EditorGUILayout.EndHorizontal();
            EGUI.BeginIndent();
            {
                EditorGUILayout.BeginHorizontal();
                {
                    for (int i = 0; i < enumNames.Length; ++i)
                    {
                        int tValue = Convert.ToInt32(Enum.Parse(valueType, enumNames[i]));

                        bool isSelected    = (value & tValue) > 0;
                        bool newIsSelected = GUILayout.Toggle(isSelected, enumNames[i], EditorStyles.toolbarButton, options);
                        if (newIsSelected != isSelected)
                        {
                            if (newIsSelected)
                            {
                                value |= tValue;
                            }
                            else
                            {
                                value &= ~tValue;
                            }
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
            EGUI.EndIndent();

            return(value);
        }
        public static bool DrawBoxedFoldout(bool isFoldout, GUIContent title)
        {
            Rect rect = EditorGUILayout.GetControlRect(GUILayout.ExpandWidth(true));

            return(EGUI.DrawBoxedFoldout(rect, isFoldout, title));
        }
        public static void DrawVerticalLine(Color color, float thickness = 0.75f, float padding = 3.0f)
        {
            Rect rect = EditorGUILayout.GetControlRect(UnityEngine.GUILayout.Width(padding * 2 + thickness), UnityEngine.GUILayout.ExpandHeight(true));

            EGUI.DrawVerticalLine(rect, color, thickness);
        }