Ejemplo n.º 1
0
        public void InvokeOnGUI(Rect onGUIPosition)
        {
            // Handle window reloading.
            if (Unsupported.IsDeveloperMode() &&
                actualView != null &&
                Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.F5)
            {
                Reload(actualView);
                return;
            }

            DoWindowDecorationStart();

            GUIStyle overlay = "dockareaoverlay";

            if (actualView is GameView) // GameView exits GUI, so draw overlay border earlier
            {
                GUI.Box(onGUIPosition, GUIContent.none, overlay);
            }

            BeginOffsetArea(new Rect(onGUIPosition.x + 2, onGUIPosition.y + DockArea.kTabHeight, onGUIPosition.width - 4, onGUIPosition.height - DockArea.kTabHeight - 2), GUIContent.none, "TabWindowBackground");
            EditorGUIUtility.ResetGUIState();
            bool isExitGUIException = false;

            try
            {
                Invoke("OnGUI");
            }
            catch (TargetInvocationException e)
            {
                if (e.InnerException is ExitGUIException)
                {
                    isExitGUIException = true;
                }
                throw;
            }
            finally
            {
                // We can't reset gui state after ExitGUI we just want to bail completely
                if (!isExitGUIException)
                {
                    if (actualView != null && actualView.m_FadeoutTime != 0 && Event.current != null && Event.current.type == EventType.Repaint)
                    {
                        actualView.DrawNotification();
                    }

                    EndOffsetArea();

                    EditorGUIUtility.ResetGUIState();

                    DoWindowDecorationEnd();

                    if (Event.current.type == EventType.Repaint)
                    {
                        overlay.Draw(onGUIPosition, GUIContent.none, 0);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected override void OldOnGUI()
        {
            ClearBackground();

            // Call reset GUI state as first thing so GUI.color is correct when drawing window decoration.
            EditorGUIUtility.ResetGUIState();
            DoWindowDecorationStart();
            if (background == null)
            {
                background = "hostview";
                // Fix annoying GUILayout issue: When using guilayout in Utility windows there was always padded 10 px at the top! Todo: Fix this in EditorResources
                background.padding.top = 0;
            }

            using (new GUILayout.VerticalScope(background))
            {
                if (actualView)
                {
                    actualView.m_Pos = screenPosition;
                }

                try
                {
                    if (EditorModes.ShouldInvokeOnGUI(m_ActualView))
                    {
                        Invoke("OnGUI");
                    }
                }
                finally
                {
                    if (m_ActualView != null)
                    {
                        if (m_ActualView.m_FadeoutTime != 0 && Event.current.type == EventType.Repaint)
                        {
                            m_ActualView.DrawNotification();
                        }
                    }

                    DoWindowDecorationEnd();
                    EditorGUI.ShowRepaints();
                }
            }
        }