Пример #1
0
        internal static void DrawDisabledWindowGui(ref bool isWorking)
        {
            SRInternalEditorUtil.BeginDrawBackground();
            SRInternalEditorUtil.DrawLogo(SRInternalEditorUtil.GetLogo());
            SRInternalEditorUtil.EndDrawBackground();

            // Draw header/content divider
            EditorGUILayout.BeginVertical(SRInternalEditorUtil.Styles.SettingsHeaderBoxStyle);
            EditorGUILayout.EndVertical();

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

            GUILayout.Label(
                "SRDebugger is currently disabled. SRDebugger must be enabled in order to access editor features.",
                SRInternalEditorUtil.Styles.ParagraphLabel);

            EditorGUILayout.HelpBox("Enabling SRDebugger will result in the tools being included in all builds of your game until it is disabled again.", MessageType.Warning);

            GUILayout.Label("• " + DisableSRDebuggerCompileDefine + " compiler define will be removed from all build configurations.", SRInternalEditorUtil.Styles.ListBulletPoint);
            GUILayout.Label("• Disabled SRDebugger folders will be renamed so Unity imports them.", SRInternalEditorUtil.Styles.ListBulletPoint);
            GUILayout.Label("• You can disable SRDebugger again at any time.", SRInternalEditorUtil.Styles.ListBulletPoint);

            if (isWorking && !EditorApplication.isCompiling && !EditorApplication.isUpdating)
            {
                isWorking = false;
            }

            if (isWorking)
            {
                using (new EditorGUI.DisabledGroupScope(true))
                {
                    GUILayout.Button("Working...");
                }
            }
            else if (GUILayout.Button("Enable SRDebugger"))
            {
                isWorking = true;
                try
                {
                    SetEnabled(true);
                }
                catch (Exception)
                {
                    isWorking = false;
                    throw;
                }
            }
        }
Пример #2
0
        public override void OnInspectorGUI()
        {
            SRInternalEditorUtil.DrawLogo(SRInternalEditorUtil.GetLogo());

            GUILayout.Label(
                "This asset contains the runtime settings used by SRDebugger. It is recommended that this asset be edited only via the SRDebugger Settings window.",
                EditorStyles.wordWrappedLabel);

            EditorGUILayout.Separator();

            if (GUILayout.Button("Open SRDebugger Settings Window"))
            {
                SRDebuggerSettingsWindow.Open();
            }

            if (!_override)
            {
                if (GUILayout.Button("Override Warning"))
                {
                    _override = true;
                }
            }
            else
            {
                GUILayout.Label(
                    "You have been warned...",
                    EditorStyles.wordWrappedLabel);
            }

            EditorGUILayout.Separator();

            if (_override)
            {
                base.OnInspectorGUI();
            }
        }
Пример #3
0
        private void OnGUI()
        {
            // Draw header area
            SRInternalEditorUtil.BeginDrawBackground();
            SRInternalEditorUtil.DrawLogo(SRInternalEditorUtil.GetLogo());
            SRInternalEditorUtil.EndDrawBackground();

            // Draw header/content divider
            EditorGUILayout.BeginVertical(SRInternalEditorUtil.Styles.SettingsHeaderBoxStyle);
            EditorGUILayout.EndVertical();

            Settings settings;

            if (!SettingsReady(out settings))
            {
                return;
            }

            // Draw tab buttons
            var rect = EditorGUILayout.BeginVertical(GUI.skin.box);

            --rect.width;
            var height = 18;

            EditorGUI.BeginChangeCheck();
            EditorGUI.BeginDisabledGroup(!_enableTabChange);

            for (var i = 0; i < _tabs.Length; ++i)
            {
                var xStart = Mathf.RoundToInt(i * rect.width / _tabs.Length);
                var xEnd   = Mathf.RoundToInt((i + 1) * rect.width / _tabs.Length);

                var pos = new Rect(rect.x + xStart, rect.y, xEnd - xStart, height);

                if (GUI.Toggle(pos, (int)_selectedTab == i, new GUIContent(_tabs[i]), EditorStyles.toolbarButton))
                {
                    _selectedTab = (Tabs)i;
                }
            }

            GUILayoutUtility.GetRect(10f, height);

            EditorGUI.EndDisabledGroup();

            if (EditorGUI.EndChangeCheck())
            {
                _scrollPosition            = Vector2.zero;
                GUIUtility.keyboardControl = 0;
            }

            // Draw selected tab

            switch (_selectedTab)
            {
            case Tabs.General:
                DrawTabGeneral(settings);
                break;

            case Tabs.Layout:
                DrawTabLayout(settings);
                break;

            case Tabs.Bug_Reporter:
                DrawTabBugReporter(settings);
                break;

            case Tabs.Shortcuts:
                DrawTabShortcuts(settings);
                break;

            case Tabs.Advanced:
                DrawTabAdvanced(settings);
                break;
            }

            EditorGUILayout.EndVertical();

            // Display rating prompt and link buttons

            EditorGUILayout.LabelField(SRDebugEditorStrings.Current.SettingsRateBoxContents, EditorStyles.miniLabel);

            SRInternalEditorUtil.DrawFooterLayout(position.width);

            if (GUI.changed)
            {
                EditorUtility.SetDirty(settings);
            }
        }
Пример #4
0
        private void OnGUI()
        {
            // Draw header area
            SRInternalEditorUtil.BeginDrawBackground();
            SRInternalEditorUtil.DrawLogo(SRInternalEditorUtil.GetLogo());
            SRInternalEditorUtil.EndDrawBackground();

            // Draw header/content divider
            EditorGUILayout.BeginVertical(SRInternalEditorUtil.Styles.SettingsHeaderBoxStyle);
            EditorGUILayout.EndVertical();

            GUILayout.Label(
                "SRDebugger automatically scans your project to find common issues with the SRDebugger installation.");

            EditorGUILayout.Space();

            // TODO: Enable button when there are some more 'expensive' integrity checks. For now no point as alt the checks are really quick
            if (GUILayout.Button("Refresh"))
            {
                RefreshIntegrityCheck();
            }

            if (_applyingFix)
            {
                if (!EditorApplication.isCompiling && !EditorApplication.isUpdating)
                {
                    _applyingFix = false;
                    RefreshIntegrityCheck();
                }

                EditorGUI.BeginDisabledGroup(_applyingFix);
            }

            EditorGUILayout.Space();

            if (_results == null)
            {
                _results = new List <IntegrityIssue>();
            }

            EditorGUILayout.TextArea("Issues Detected: " + _results.Count, EditorStyles.boldLabel);

            EditorGUILayout.Separator();

            EditorGUILayout.Space();

            if (_results.Count == 0)
            {
                EditorGUILayout.HelpBox("No issues have been found!", MessageType.None);
            }
            else
            {
                EditorGUILayout.HelpBox("It is highly recommended to backup your project before using this tool.", MessageType.Warning);

                _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, false, false,
                                                            GUILayout.Width(position.width));

                DrawIssuesList();

                EditorGUILayout.EndScrollView();
            }

            if (_applyingFix)
            {
                EditorGUI.EndDisabledGroup();
            }
        }