Exemplo n.º 1
0
// ReSharper disable UnusedMember.Local
// ReSharper disable once InconsistentNaming
        void OnGUI()
// ReSharper restore UnusedMember.Local
        {
            EditorWindowContentWrapper.Start();

            if (null == PanelRenderer.ChromeStyle)
            {
                PanelRenderer.ChromeStyle = StyleCache.Instance.PanelChromeSquared;
            }

            PanelRenderer.RenderStart(GuiContentCache.Instance.ReferencePanelTitle, true);

            PanelContentWrapper.Start();

            ShowHelp = PanelRenderer.ClickedTools.Count > 0 && PanelRenderer.ClickedTools.Contains("help");

            if (ShowHelp)
            {
                EditorGUILayout.HelpBox(Help.ReferenceWindow, MessageType.Info, true);
            }

            switch (EditorSettings.ReferenceTabIndex)
            {
            case 0:
                RenderSearch();
                break;

            case 1:
                RenderDescription();
                break;
            }

            PanelContentWrapper.End();

            PanelRenderer.RenderEnd();

            GUILayout.Space(2);

            EditorWindowContentWrapper.End();
        }
Exemplo n.º 2
0
// ReSharper disable UnusedMember.Local
        void OnGUI()
// ReSharper restore UnusedMember.Local
        {
            if (_doFocusOut)
            {
                _doFocusOut = false;
                GUIUtility.keyboardControl = 0;
            }

            EditorWindowContentWrapper.Start();

            if (null == PanelRenderer.ChromeStyle)
            {
                PanelRenderer.ChromeStyle = StyleCache.Instance.PanelChromeSquared;
            }

            PanelRenderer.RenderStart(GuiContentCache.Instance.PersistenceDebuggerPanelTitle, true);

            PanelContentWrapper.Start();

            if (PanelRenderer.ClickedTools.Count > 0)
            {
                if (PanelRenderer.ClickedTools.Contains("options"))
                {
                    PanelRenderer.ClickedTools.Remove("options");
                }
                ShowHelp = PanelRenderer.ClickedTools.Contains("help");
            }
            else
            {
                ShowHelp = false;
            }

            if (ShowHelp)
            {
                EditorGUILayout.HelpBox(Help.PersistenceDebugWindow, MessageType.Info, true);
            }

            EditorGUILayout.BeginHorizontal(StyleCache.Instance.Toolbar, GUILayout.Height(35));

            #region Refresh

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.Refresh, StyleCache.Instance.Button,
                                 GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                GUIUtility.keyboardControl = 0;
                ProcessInfo();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Abandon chages

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.AbandonChanges, StyleCache.Instance.Button,
                                 GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                PersistenceManager.Instance.AbandonChanges();
                HierarchyChangeProcessor.Instance.Reset();
                ProcessInfo();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Copy

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.CopyToClipboard, StyleCache.Instance.Button,
                                 GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                GUIUtility.keyboardControl = 0;
                TextEditor te = new TextEditor {
                    content = new GUIContent(_text)
                };
                te.SelectAll();
                te.Copy();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            GUILayout.FlexibleSpace();

            #region Auto-update

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            bool oldAutoUpdate = GUILayout.Toggle(EditorSettings.PersistenceWindowAutoUpdate,
                                                  EditorSettings.PersistenceWindowAutoUpdate ? GuiContentCache.Instance.AutoUpdateOn : GuiContentCache.Instance.AutoUpdateOff,
                                                  StyleCache.Instance.Toggle,
                                                  GUILayout.ExpandWidth(false), GUILayout.Height(30));

            if (EditorSettings.PersistenceWindowAutoUpdate != oldAutoUpdate)
            {
                GUIUtility.keyboardControl = 0;
                EditorSettings.PersistenceWindowAutoUpdate = oldAutoUpdate;
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Write to log

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            bool oldWriteToLog = GUILayout.Toggle(EditorSettings.PersistenceWindowWriteToLog,
                                                  GuiContentCache.Instance.WriteToLog, StyleCache.Instance.GreenToggle,
                                                  GUILayout.ExpandWidth(false), GUILayout.Height(30));

            if (EditorSettings.PersistenceWindowWriteToLog != oldWriteToLog)
            {
                GUIUtility.keyboardControl = 0;
                EditorSettings.PersistenceWindowWriteToLog = oldWriteToLog;
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(1);

            _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            //GUILayout.Label(_text, StyleCache.Instance.NormalLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            GUI.SetNextControlName(TextAreaControlName);
            _textToDisplay = EditorGUILayout.TextArea(_textToDisplay, StyleCache.Instance.RichTextLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            bool isInFocus = GUI.GetNameOfFocusedControl() == TextAreaControlName;
            _textToDisplay = isInFocus ? _text : _richText;

            GUILayout.EndScrollView();

            RenderStatus(
                EditorSettings.WatchChanges ?
                (EditorApplication.isPlaying ? "Monitoring..." : "Will monitor in play mode.") :
                "Not monitoring.",
                EditorSettings.WatchChanges && EditorApplication.isPlaying
                );

            PanelContentWrapper.End();

            PanelRenderer.RenderEnd();

            //GUILayout.Space(3);
            EditorWindowContentWrapper.End();
        }
Exemplo n.º 3
0
        void OnGUI()
// ReSharper restore UnusedMember.Local
        {
            // Note: properties have to be commited prior to Render
            // or else, we get the "ArgumentException: Getting control 2's position in a group with only 2 controls when doing Repaint" error
            if (_propertiesInvalidated)
            {
                CommitProperties();
            }

            EditorWindowContentWrapper.Start();

            if (null == PanelRenderer.ChromeStyle)
            {
                PanelRenderer.ChromeStyle = StyleCache.Instance.PanelChromeSquared;
            }

            PanelRenderer.RenderStart(GuiContentCache.Instance.MainPanelTitle, true);

            if (PanelRenderer.ClickedTools.Count > 0)
            {
                if (PanelRenderer.ClickedTools.Contains("info"))
                {
                    PanelRenderer.ClickedTools.Remove("info");
                    AboutDialog.Instance.ShowUtility(); //ShowAuxWindow();
                }
                if (PanelRenderer.ClickedTools.Contains("options"))
                {
                    PanelRenderer.ClickedTools.Remove("options");
                    OptionsDialog.Instance.ShowUtility();
                }
            }

            #region Handling bounds

// ReSharper disable CompareOfFloatsByEqualityOperator
            if (_bounds.width != position.width || _bounds.height != position.height)
// ReSharper restore CompareOfFloatsByEqualityOperator
            {
                HandleBounds(position);
                _bounds = position;
                //Toolbox.Instance.Width = position.width;
            }

            #endregion

            /**
             * 1. Help
             * */
            if (PanelRenderer.ClickedTools.Contains("help"))
            {
                // info image
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.Label(new GUIContent(TextureCache.Instance.PlayModeGameViewInfo), GUILayout.ExpandWidth(false));
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();

                GUILayout.Space(1);

                EditorGUILayout.HelpBox(Help.Main, MessageType.Info, true);
            }

            /**
             * 2. Toolbar with buttons
             * */
            Toolbar.Instance.Render();
            GUILayout.Space(5);

            /**
             * 3. Breadcrumbs
             * */
            if (null != Selection.activeGameObject)
            {
                BreadcrumbsMain.Instance.Render();
                GUILayout.Space(5);
            }

            /**
             * 4. Tabs
             * */
            MainTabBar.Instance.Render();

            /**
             * 5. Display
             * */
            EditorGUILayout.BeginVertical(StyleCache.Instance.TabBackground, GUILayout.ExpandHeight(true));

            if (_showLogo)
            {
                _logoScrollPosition = EditorGUILayout.BeginScrollView(_logoScrollPosition);
                GUILayout.Label(TextureCache.Instance.Logo, StyleCache.Instance.CenteredLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
                EditorGUILayout.EndScrollView();
            }
            else
            {
                switch (MainTabBar.Instance.TabIndex)
                {
                case ORDER_DISPLAY:
                    OrderDisplay.Instance.Render();
                    break;

                case LAYOUT_DISPLAY:
                    LayoutDisplay.Instance.Render();
                    break;

                case EVENTS_DISPLAY:
                    EventDisplay.Instance.Render();
                    break;
                }
            }

            EditorGUILayout.EndVertical();
            GUILayout.Space(2);

            PanelRenderer.RenderEnd();

            EditorWindowContentWrapper.End();

            if (GUI.changed && _showLogo)
            {
                _showLogo = false;
            }

            if (UpdateCheck.Instance.DataReady)
            {
                UpdateCheck.Instance.ShowDialog();
            }
        }
Exemplo n.º 4
0
// ReSharper disable UnusedMember.Local
        void OnGUI()
// ReSharper restore UnusedMember.Local
        {
            if (_doFocusOut)
            {
                _doFocusOut = false;
                GUIUtility.keyboardControl = 0;
            }

            EditorWindowContentWrapper.Start();

            if (null == PanelRenderer.ChromeStyle)
            {
                PanelRenderer.ChromeStyle = StyleCache.Instance.PanelChromeSquared;
            }

            PanelRenderer.RenderStart(GuiContentCache.Instance.HierarchyDebuggerPanelTitle, true);

            PanelContentWrapper.Start();

            if (PanelRenderer.ClickedTools.Count > 0)
            {
                if (PanelRenderer.ClickedTools.Contains("options"))
                {
                    PanelRenderer.ClickedTools.Remove("options");
                }
                ShowHelp = PanelRenderer.ClickedTools.Contains("help");
            }
            else
            {
                ShowHelp = false;
            }

            if (ShowHelp)
            {
                EditorGUILayout.HelpBox(Help.HierarchyDebugWindow, MessageType.Info, true);
            }

            EditorGUILayout.BeginHorizontal(StyleCache.Instance.Toolbar, GUILayout.Height(35));

            #region Refresh

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.Refresh, StyleCache.Instance.Button,
                                 GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                GUIUtility.keyboardControl = 0;
                ProcessInfo();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Fix

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            /*bool oldEnabled = GUI.enabled;
             * GUI.enabled = !Application.isPlaying;*/
            if (GUILayout.Button(GuiContentCache.Instance.FixHierarchy, StyleCache.Instance.GreenToggle,
                                 GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                var text =
                    @"eDriven will look for adapters present in the hierarchy but not listed in any of the order lists, and add them as list children.

It will also remove adapters not present in the hierarchy from all of the order lists.";

                if (EditorApplication.isPlaying)
                {
                    text += @"

Note: The play mode will be stopped in order to fix the hierarchy.";
                }

                text += @"

Are you sure you want to do this?";

                if (EditorUtility.DisplayDialog("Fix hierarchy?", text, "OK", "Cancel"))
                {
                    if (EditorApplication.isPlaying)
                    {
                        // 1. delay fixing to after the stop
                        EditorState.ShouldFixHierarchyAfterStop = true;
                        // 2. stop the play mode
                        EditorApplication.isPlaying = false;
                    }
                    else // fix immediatelly
                    {
                        FixHierarchy();
                    }
                }
            }
            /*GUI.enabled = oldEnabled;*/

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Copy

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            if (GUILayout.Button(GuiContentCache.Instance.CopyToClipboard, StyleCache.Instance.Button,
                                 GUILayout.ExpandWidth(false), GUILayout.Height(30)))
            {
                GUIUtility.keyboardControl = 0;
                TextEditor te = new TextEditor {
                    content = new GUIContent(_description)
                };
                te.SelectAll();
                te.Copy();
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            GUILayout.FlexibleSpace();

            #region Auto-update

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            bool oldAutoUpdate = GUILayout.Toggle(EditorSettings.HierarchyWindowAutoUpdate,
                                                  EditorSettings.HierarchyWindowAutoUpdate ? GuiContentCache.Instance.AutoUpdateOn : GuiContentCache.Instance.AutoUpdateOff,
                                                  StyleCache.Instance.Toggle,
                                                  GUILayout.ExpandWidth(false), GUILayout.Height(30));

            if (EditorSettings.HierarchyWindowAutoUpdate != oldAutoUpdate)
            {
                GUIUtility.keyboardControl = 0;
                EditorSettings.HierarchyWindowAutoUpdate = oldAutoUpdate;
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            #region Write to log

            EditorGUILayout.BeginVertical(GUILayout.ExpandHeight(false));
            GUILayout.FlexibleSpace();

            bool oldWriteToLog = GUILayout.Toggle(EditorSettings.HierarchyWindowWriteToLog,
                                                  GuiContentCache.Instance.WriteToLog, StyleCache.Instance.GreenToggle,
                                                  GUILayout.ExpandWidth(false), GUILayout.Height(30));

            if (EditorSettings.HierarchyWindowWriteToLog != oldWriteToLog)
            {
                GUIUtility.keyboardControl = 0;
                EditorSettings.HierarchyWindowWriteToLog = oldWriteToLog;
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            #endregion

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(1);

            _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            //GUILayout.Label(HierarchyState.Instance.State, StyleCache.Instance.NormalLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            //EditorGUILayout.TextArea("<color=#00ff00>miki</color>" + _description, StyleCache.Instance.RichTextLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            EditorGUILayout.TextArea(_descriptionRich, StyleCache.Instance.RichTextLabel, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            GUILayout.EndScrollView();

            PanelContentWrapper.End();

            PanelRenderer.RenderEnd();

            //GUILayout.Space(3);
            EditorWindowContentWrapper.End();
        }