Exemplo n.º 1
0
        private void OnGuiBodySettings()
        {
            GUILayout.BeginVertical();
            {
                var bodyStyle = new GUIStyle
                {
                    margin  = new RectOffset(4, 4, 4, 4),
                    padding = new RectOffset(5, 5, 5, 5)
                };

                _bodyScroll = GUILayout.BeginScrollView(_bodyScroll, bodyStyle);

                GUILayout.BeginHorizontal();
                {
                    EditorGUILayout.BeginVertical();
                    {
                        foreach (var mode in _settingsModes)
                        {
                            var style = new GUIStyle(EditorStyles.helpBox)
                            {
                                padding = { left = 4 }
                            };
                            EditorGUILayout.BeginVertical(style);
                            var foldoutStyle = new GUIStyle("Foldout")
                            {
                                padding   = new RectOffset(16, 5, 3, 3),
                                fontStyle = FontStyle.Normal,
                            };
                            foldoutStyle.onNormal = foldoutStyle.normal = new GUIStyleState
                            {
                                textColor = EditorGUIUtility.isProSkin
                                    ? new Color(0.8f, 0.8f, 0.8f)
                                    : new Color(0, 0, 0)
                            };
                            foldoutStyle.onFocused   = foldoutStyle.onActive = foldoutStyle.onHover =
                                foldoutStyle.focused = foldoutStyle.active = foldoutStyle.hover = new GUIStyleState
                            {
                                textColor = EditorGUIUtility.isProSkin
                                        ? new Color(0.8f, 0.8f, 0.8f)
                                        : new Color(0, 0, 0)
                            };

                            if (EditorGUILayout.BeginFoldoutHeaderGroup(_settingsMode == mode.Key, new GUIContent
                            {
                                text = mode.Value
                            }, foldoutStyle))
                            {
                                _settingsMode = mode.Key;
                            }

                            if (_settingsMode != OpenLoaderSettingsMode.None && _settingsMode == mode.Key)
                            {
                                // ReSharper disable once SwitchStatementHandlesSomeKnownEnumValuesWithDefault
                                // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault
                                switch (_settingsMode)
                                {
                                case OpenLoaderSettingsMode.Account:
                                    OnGuiSettingsAccount();
                                    break;

                                case OpenLoaderSettingsMode.Builder:
                                    OnGuiSettingsBuilder();
                                    break;

                                case OpenLoaderSettingsMode.Others:
                                    OnGuiSettingsOthers();
                                    break;
                                }
                            }

                            EditorGUILayout.EndFoldoutHeaderGroup();
                            EditorGUILayout.EndVertical();
                        }
                    }

                    EditorGUILayout.EndVertical();
                }

                GUILayout.EndHorizontal();

                EditorGUILayout.Space();

                GUILayout.EndScrollView();

                DrawOutline(GUILayoutUtility.GetLastRect(), 1f);
            }

            GUILayout.EndVertical();
        }
Exemplo n.º 2
0
 public void OpenSettings(OpenLoaderSettingsMode mode = OpenLoaderSettingsMode.None)
 {
     _settingsToggleState = true;
     _settingsMode        = mode;
 }