Пример #1
0
        private void DrawTabAdvanced(Settings settings)
        {
            _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition, false, true);

            GUILayout.Label("Console", SRInternalEditorUtil.Styles.InspectorHeaderStyle);

            settings.CollapseDuplicateLogEntries =
                EditorGUILayout.Toggle(
                    new GUIContent("Collapse Log Entries", "Collapse duplicate log entries into single log."),
                    settings.CollapseDuplicateLogEntries);

            settings.RichTextInConsole =
                EditorGUILayout.Toggle(
                    new GUIContent("Rich Text in Console", "Parse rich text tags in console log entries."),
                    settings.RichTextInConsole);

            settings.MaximumConsoleEntries =
                EditorGUILayout.IntSlider(
                    new GUIContent("Max Console Entries",
                                   "The maximum size of the console buffer. Higher values may cause performance issues on slower devices."),
                    settings.MaximumConsoleEntries, 100, 6000);

            EditorGUILayout.Separator();
            GUILayout.Label("Display", SRInternalEditorUtil.Styles.InspectorHeaderStyle);

            settings.EnableBackgroundTransparency =
                EditorGUILayout.Toggle(new GUIContent("Transparent Background"),
                                       settings.EnableBackgroundTransparency);

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.PrefixLabel(new GUIContent("Layer", "The layer the debug panel UI will be drawn to"));

            settings.DebugLayer = EditorGUILayout.LayerField(settings.DebugLayer);

            EditorGUILayout.EndHorizontal();

            settings.UseDebugCamera =
                EditorGUILayout.Toggle(
                    new GUIContent("Use Debug Camera", SRDebugEditorStrings.Current.SettingsDebugCameraTooltip),
                    settings.UseDebugCamera);

            EditorGUI.BeginDisabledGroup(!settings.UseDebugCamera);

            settings.DebugCameraDepth = EditorGUILayout.Slider(new GUIContent("Debug Camera Depth"),
                                                               settings.DebugCameraDepth, -100, 100);

            EditorGUI.EndDisabledGroup();

            settings.UIScale =
                EditorGUILayout.Slider(new GUIContent("UI Scale"), settings.UIScale, 1f, 3f);

            EditorGUILayout.Separator();
            GUILayout.Label("Enabled Tabs", SRInternalEditorUtil.Styles.InspectorHeaderStyle);

            GUILayout.Label(SRDebugEditorStrings.Current.SettingsEnabledTabsDescription, EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();

            var disabledTabs = settings.DisabledTabs.ToList();

            var tabNames  = Enum.GetNames(typeof(DefaultTabs));
            var tabValues = Enum.GetValues(typeof(DefaultTabs));

            EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins);

            var changed = false;

            for (var i = 0; i < tabNames.Length; i++)
            {
                var tabName  = tabNames[i];
                var tabValue = (DefaultTabs)(tabValues.GetValue(i));

                if (tabName == "BugReporter")
                {
                    continue;
                }

                if (tabName == "SystemInformation")
                {
                    tabName = "System Information";
                }

                EditorGUILayout.BeginHorizontal();

                var isEnabled = !disabledTabs.Contains(tabValue);

                var isNowEnabled = EditorGUILayout.ToggleLeft(tabName, isEnabled,
                                                              SRInternalEditorUtil.Styles.LeftToggleButton);

                if (isEnabled && !isNowEnabled)
                {
                    disabledTabs.Add(tabValue);
                    changed = true;
                }
                else if (!isEnabled && isNowEnabled)
                {
                    disabledTabs.Remove(tabValue);
                    changed = true;
                }

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndVertical();

            if (changed)
            {
                settings.DisabledTabs = disabledTabs;
            }

            GUILayout.Label("Other", SRInternalEditorUtil.Styles.InspectorHeaderStyle);

            settings.EnableEventSystemGeneration =
                EditorGUILayout.Toggle(
                    new GUIContent("Automatic Event System", "Automatically create a UGUI EventSystem if none is found in the scene."),
                    settings.EnableEventSystemGeneration);

#if ENABLE_INPUT_SYSTEM && ENABLE_LEGACY_INPUT_MANAGER
            using (new EditorGUI.DisabledScope(!Settings.Instance.EnableEventSystemGeneration))
            {
                Settings.Instance.UIInputMode =
                    (Settings.UIModes)EditorGUILayout.EnumPopup(new GUIContent("Input Mode"), Settings.Instance.UIInputMode);
            }
#endif

            settings.UnloadOnClose =
                EditorGUILayout.Toggle(
                    new GUIContent("Unload When Closed", "Unload the debug panel from the scene when it is closed."),
                    settings.UnloadOnClose);

            EditorGUILayout.HelpBox(
                "The panel loads again automatically when opened. You can always unload the panel by holding down the close button.",
                MessageType.Info);


            EditorGUILayout.Separator();

            if (GUILayout.Button("Run Migrations"))
            {
                Migrations.RunMigrations(true);
            }

            EditorGUILayout.Separator();

            GUILayout.Label("Disable SRDebugger (beta)", SRInternalEditorUtil.Styles.InspectorHeaderStyle);

            GUILayout.Label("Disabling will exclude any SRDebugger assets and scripts from your game.", SRInternalEditorUtil.Styles.ParagraphLabel);
            EditorGUILayout.HelpBox("This is an experimental feature. Please make sure your project is backed up via source control.", MessageType.Warning);

            GUILayout.Label("• " + SRDebugEditor.DisableSRDebuggerCompileDefine + " compiler define will be added to all build configurations.", SRInternalEditorUtil.Styles.ListBulletPoint);
            GUILayout.Label("• Some SRDebugger folders will be renamed to prevent Unity from importing them.", SRInternalEditorUtil.Styles.ListBulletPoint);
            GUILayout.Label("• Any code that interacts with SRDebugger (e.g. SROptions or SRDebug API) should use the `#if !" + SRDebugEditor.DisableSRDebuggerCompileDefine + "` preprocessor directive.", SRInternalEditorUtil.Styles.ListBulletPoint);
            GUILayout.Label("• You can enable SRDebugger again at any time.", SRInternalEditorUtil.Styles.ListBulletPoint);

            if (GUILayout.Button("Disable SRDebugger"))
            {
                EditorApplication.delayCall += () =>
                {
                    SRDebugEditor.SetEnabled(false);
                    Reset();
                };
            }


            EditorGUILayout.EndScrollView();
        }
Пример #2
0
        private void DrawTabAdvanced()
        {
            _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition, false, true);

            GUILayout.Label("Console", SRDebugEditorUtil.Styles.InspectorHeaderStyle);

            Settings.Instance.CollapseDuplicateLogEntries =
                EditorGUILayout.Toggle(
                    new GUIContent("Collapse Log Entries", "Collapse duplicate log entries into single log."),
                    Settings.Instance.CollapseDuplicateLogEntries);

            Settings.Instance.RichTextInConsole =
                EditorGUILayout.Toggle(
                    new GUIContent("Rich Text in Console", "Parse rich text tags in console log entries."),
                    Settings.Instance.RichTextInConsole);

            Settings.Instance.MaximumConsoleEntries =
                EditorGUILayout.IntSlider(
                    new GUIContent("Max Console Entries",
                                   "The maximum size of the console buffer. Higher values may cause performance issues on slower devices."),
                    Settings.Instance.MaximumConsoleEntries, 100, 6000);

            EditorGUILayout.Separator();
            GUILayout.Label("Display", SRDebugEditorUtil.Styles.InspectorHeaderStyle);

            Settings.Instance.EnableBackgroundTransparency =
                EditorGUILayout.Toggle(new GUIContent("Transparent Background"),
                                       Settings.Instance.EnableBackgroundTransparency);

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.PrefixLabel(new GUIContent("Layer", "The layer the debug panel UI will be drawn to"));

            Settings.Instance.DebugLayer = EditorGUILayout.LayerField(Settings.Instance.DebugLayer);

            EditorGUILayout.EndHorizontal();

            Settings.Instance.UseDebugCamera =
                EditorGUILayout.Toggle(
                    new GUIContent("Use Debug Camera", SRDebugStrings.Current.SettingsDebugCameraTooltip),
                    Settings.Instance.UseDebugCamera);

            EditorGUI.BeginDisabledGroup(!Settings.Instance.UseDebugCamera);

            Settings.Instance.DebugCameraDepth = EditorGUILayout.Slider(new GUIContent("Debug Camera Depth"),
                                                                        Settings.Instance.DebugCameraDepth, -100, 100);

            EditorGUI.EndDisabledGroup();

            Settings.Instance.UIScale =
                EditorGUILayout.Slider(new GUIContent("UI Scale"), Settings.Instance.UIScale, 1f, 3f);

            EditorGUILayout.Separator();
            GUILayout.Label("Enabled Tabs", SRDebugEditorUtil.Styles.InspectorHeaderStyle);

            GUILayout.Label(SRDebugStrings.Current.SettingsEnabledTabsDescription, EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();

            var disabledTabs = Settings.Instance.DisabledTabs.ToList();

            var tabNames  = Enum.GetNames(typeof(DefaultTabs));
            var tabValues = Enum.GetValues(typeof(DefaultTabs));

            EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins);

            var changed = false;

            for (var i = 0; i < tabNames.Length; i++)
            {
                var tabName  = tabNames[i];
                var tabValue = (DefaultTabs)(tabValues.GetValue(i));

                if (tabName == "BugReporter")
                {
                    continue;
                }

                if (tabName == "SystemInformation")
                {
                    tabName = "System Information";
                }

                EditorGUILayout.BeginHorizontal();

                var isEnabled = !disabledTabs.Contains(tabValue);

                var isNowEnabled = EditorGUILayout.ToggleLeft(tabName, isEnabled,
                                                              SRDebugEditorUtil.Styles.LeftToggleButton);

                if (isEnabled && !isNowEnabled)
                {
                    disabledTabs.Add(tabValue);
                    changed = true;
                }
                else if (!isEnabled && isNowEnabled)
                {
                    disabledTabs.Remove(tabValue);
                    changed = true;
                }

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndVertical();

            if (changed)
            {
                Settings.Instance.DisabledTabs = disabledTabs;
            }

            GUILayout.Label("Other", SRDebugEditorUtil.Styles.InspectorHeaderStyle);

            Settings.Instance.EnableEventSystemGeneration =
                EditorGUILayout.Toggle(
                    new GUIContent("Automatic Event System", "Automatically create a UGUI EventSystem if none is found in the scene."),
                    Settings.Instance.EnableEventSystemGeneration);

            EditorGUILayout.Separator();

            if (GUILayout.Button("Run Migrations"))
            {
                Migrations.RunMigrations(true);
            }

            EditorGUILayout.EndScrollView();
        }
Пример #3
0
        private void DrawTabAdvanced()
        {
            GUILayout.Label("Console", SRDebugEditorUtil.Styles.InspectorHeaderStyle);

            Settings.Instance.CollapseDuplicateLogEntries =
                EditorGUILayout.Toggle(
                    new GUIContent("Collapse Log Entries", "Collapse duplicate log entries into single log."),
                    Settings.Instance.CollapseDuplicateLogEntries);

            Settings.Instance.RichTextInConsole =
                EditorGUILayout.Toggle(
                    new GUIContent("Rich Text in Console", "Parse rich text tags in console log entries."),
                    Settings.Instance.RichTextInConsole);

            EditorGUILayout.Separator();
            GUILayout.Label("Display", SRDebugEditorUtil.Styles.InspectorHeaderStyle);

            Settings.Instance.EnableBackgroundTransparency =
                EditorGUILayout.Toggle(new GUIContent("Transparent Background"),
                                       Settings.Instance.EnableBackgroundTransparency);

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.PrefixLabel(new GUIContent("Layer", "The layer the debug panel UI will be drawn to"));

            Settings.Instance.DebugLayer = EditorGUILayout.LayerField(Settings.Instance.DebugLayer);

            EditorGUILayout.EndHorizontal();

            Settings.Instance.UseDebugCamera =
                EditorGUILayout.Toggle(
                    new GUIContent("Use Debug Camera", SRDebugStrings.Current.SettingsDebugCameraTooltip),
                    Settings.Instance.UseDebugCamera);

            EditorGUI.BeginDisabledGroup(!Settings.Instance.UseDebugCamera);

            Settings.Instance.DebugCameraDepth = EditorGUILayout.Slider(new GUIContent("Debug Camera Depth"),
                                                                        Settings.Instance.DebugCameraDepth, -100, 100);

            EditorGUI.EndDisabledGroup();

            EditorGUILayout.Separator();
            GUILayout.Label("Enabled Tabs", SRDebugEditorUtil.Styles.InspectorHeaderStyle);

            GUILayout.Label(SRDebugStrings.Current.SettingsEnabledTabsDescription, EditorStyles.wordWrappedLabel);
            EditorGUILayout.Space();

            var disabledTabs = Settings.Instance.DisabledTabs.ToList();

            var tabNames  = Enum.GetNames(typeof(DefaultTabs));
            var tabValues = Enum.GetValues(typeof(DefaultTabs));

            EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins);

            var changed = false;

            for (var i = 0; i < tabNames.Length; i++)
            {
                var tabName  = tabNames[i];
                var tabValue = (DefaultTabs)(tabValues.GetValue(i));

                if (tabName == "BugReporter")
                {
                    continue;
                }

                if (tabName == "SystemInformation")
                {
                    tabName = "System Information";
                }

                EditorGUILayout.BeginHorizontal();

                var isEnabled = !disabledTabs.Contains(tabValue);

                var isNowEnabled = EditorGUILayout.ToggleLeft(tabName, isEnabled,
                                                              SRDebugEditorUtil.Styles.LeftToggleButton);

                if (isEnabled && !isNowEnabled)
                {
                    disabledTabs.Add(tabValue);
                    changed = true;
                }
                else if (!isEnabled && isNowEnabled)
                {
                    disabledTabs.Remove(tabValue);
                    changed = true;
                }

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndVertical();

            if (changed)
            {
                Settings.Instance.DisabledTabs = disabledTabs;
            }

            EditorGUILayout.Separator();
            GUILayout.Label("Migrations", SRDebugEditorUtil.Styles.InspectorHeaderStyle);

            if (GUILayout.Button("Run Migrations"))
            {
                Migrations.RunMigrations(true);
            }

            // Expand content area to fit all available space
            GUILayout.FlexibleSpace();
        }