示例#1
0
        private void WindowTrampoline(int id)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            float paddingOffset = -k_WindowPadding;

            foreach (OverlayWindow win in m_Windows)
            {
                GUILayout.Space(k_WindowPadding + paddingOffset);
                paddingOffset = 0f;
                EditorGUIUtility.ResetGUIState();
                GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene);
                EditorStyles.UpdateSkinCache(1);              // EditorResources.h defines this as the index for the dark skin
                GUILayout.BeginVertical(win.m_Title, GUI.skin.window);
                win.m_SceneViewFunc(win.m_Target, m_SceneView);
                GUILayout.EndVertical();
            }
            EditorStyles.UpdateSkinCache();              // Sets the cache back according to the user selected skin
            GUILayout.EndVertical();
            Rect inputEaterRect = GUILayoutUtility.GetLastRect();

            EatMouseInput(inputEaterRect);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
示例#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();

            Rect r = new Rect(-2, 0, position.width + 4, position.height);

            background = "dockarea";
            r          = background.margin.Remove(r);
            Rect backRect = new Rect(r.x + 1, r.y, r.width - 2, DockArea.kTabHeight);

            if (Event.current.type == EventType.Repaint)
            {
                background.Draw(r, GUIContent.none, false, false, false, false);
                GUIStyle s = "dragTab";
                s.Draw(backRect, actualView.titleContent, false, false, true, hasFocus);
            }

            if (Event.current.type == EventType.ContextClick && backRect.Contains(Event.current.mousePosition))
            {
                PopupGenericMenu(actualView, new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0, 0));
            }
            ShowGenericMenu();
            if (actualView)
            {
                actualView.m_Pos = borderSize.Remove(screenPosition);
            }

            InvokeOnGUI(r);
        }
示例#3
0
        protected override void OldOnGUI()
        {
            // Call reset GUI state as first thing so GUI.color is correct when drawing window decoration.
            EditorGUIUtility.ResetGUIState();
            DoWindowDecorationStart();

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

                try
                {
                    HandleSplitView();
                    Invoke("OnGUI");
                }
                finally
                {
                    CheckNotificationStatus();

                    DoWindowDecorationEnd();
                    EditorGUI.ShowRepaints();
                }
            }
        }
        private void WindowTrampoline(int id)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            float paddingOffset = -k_WindowPadding;

            foreach (OverlayWindow win in m_Windows)
            {
                if (!m_SceneView.m_ShowSceneViewWindows && win.m_EditorWindow != m_SceneView)
                {
                    continue;
                }

                GUILayout.Space(k_WindowPadding + paddingOffset);
                paddingOffset = 0f;
                EditorGUIUtility.ResetGUIState();
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.BeginVertical(win.m_Title, GUI.skin.window);
                win.m_SceneViewFunc(win.m_Target, m_SceneView);
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            Rect inputEaterRect = GUILayoutUtility.GetLastRect();

            EatMouseInput(inputEaterRect);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
示例#5
0
        // This is the method that should be called from externally e.g. myEditor.DrawHeader ();
        // Do not make this method virtual - override OnHeaderGUI instead.
        public void DrawHeader()
        {
            // If we call DrawHeader from inside an an editor's OnInspectorGUI call, we have to do special handling.
            // (See DrawHeaderFromInsideHierarchy for details.)
            // We know we're inside the OnInspectorGUI block (or a similar vertical block) if hierarchyMode is set to true.
            if (EditorGUIUtility.hierarchyMode)
            {
                DrawHeaderFromInsideHierarchy();
            }
            else
            {
                OnHeaderGUI();
            }

            if (finishedDefaultHeaderGUI != null)
            {
                EditorGUIUtility.ResetGUIState();
                GUILayout.Space(
                    -1f                                      // move up to cover up bottom pixel of header box
                    - Styles.inspectorBig.margin.bottom
                    - Styles.inspectorBig.padding.bottom
                    - Styles.inspectorBig.overflow.bottom    // move up to bottom of content area in header
                    );

                // align with controls in the Inspector
                // see InspectorWindow.DrawEditor before calls to OnOptimizedInspectorGUI()/OnInspectorGUI()
                EditorGUIUtility.hierarchyMode = true;
                EditorGUIUtility.wideMode      = EditorGUIUtility.contextWidth > k_WideModeMinWidth;

                EditorGUILayout.BeginVertical(Styles.postLargeHeaderBackground, GUILayout.ExpandWidth(true));
                finishedDefaultHeaderGUI(this);
                EditorGUILayout.EndVertical();
            }
        }
示例#6
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
                {
                    Invoke("OnGUI");
                }
                finally
                {
                    CheckNotificationStatus();

                    DoWindowDecorationEnd();
                    EditorGUI.ShowRepaints();
                }
            }
        }
示例#7
0
        private void WindowTrampoline(int id)
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            float num = -this.k_WindowPadding;

            foreach (SceneViewOverlay.OverlayWindow current in SceneViewOverlay.m_Windows)
            {
                GUILayout.Space(this.k_WindowPadding + num);
                num = 0f;
                EditorGUIUtility.ResetGUIState();
                GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene);
                EditorStyles.UpdateSkinCache(1);
                GUILayout.BeginVertical(current.m_Title, GUI.skin.window, new GUILayoutOption[0]);
                current.m_SceneViewFunc(current.m_Target, this.m_SceneView);
                GUILayout.EndVertical();
            }
            EditorStyles.UpdateSkinCache();
            GUILayout.EndVertical();
            Rect lastRect = GUILayoutUtility.GetLastRect();

            this.EatMouseInput(lastRect);
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
        private void WindowTrampoline(int id)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            float num = -this.k_WindowPadding;

            using (List <SceneViewOverlay.OverlayWindow> .Enumerator enumerator = SceneViewOverlay.m_Windows.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    SceneViewOverlay.OverlayWindow current = enumerator.Current;
                    GUILayout.Space(this.k_WindowPadding + num);
                    num = 0.0f;
                    EditorGUIUtility.ResetGUIState();
                    GUI.skin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Scene);
                    EditorStyles.UpdateSkinCache(1);
                    GUILayout.BeginVertical(current.m_Title, GUI.skin.window, new GUILayoutOption[0]);
                    current.m_SceneViewFunc(current.m_Target, this.m_SceneView);
                    GUILayout.EndVertical();
                }
            }
            EditorStyles.UpdateSkinCache();
            GUILayout.EndVertical();
            this.EatMouseInput(GUILayoutUtility.GetLastRect());
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
示例#9
0
 protected override void OldOnGUI()
 {
     this.ClearBackground();
     EditorGUIUtility.ResetGUIState();
     base.DoWindowDecorationStart();
     if (this.background == null)
     {
         this.background             = "hostview";
         this.background.padding.top = 0;
     }
     GUILayout.BeginVertical(this.background, new GUILayoutOption[0]);
     if (this.actualView)
     {
         this.actualView.m_Pos = base.screenPosition;
     }
     this.Invoke("OnGUI");
     EditorGUIUtility.ResetGUIState();
     if (this.m_ActualView != null && this.m_ActualView.m_FadeoutTime != 0f && Event.current.type == EventType.Repaint)
     {
         this.m_ActualView.DrawNotification();
     }
     GUILayout.EndVertical();
     base.DoWindowDecorationEnd();
     EditorGUI.ShowRepaints();
 }
示例#10
0
        protected override void OldOnGUI()
        {
            base.ClearBackground();
            EditorGUIUtility.ResetGUIState();
            Rect rect = new Rect(-2f, 0f, base.position.width + 4f, base.position.height);

            this.background = "dockarea";
            rect            = this.background.margin.Remove(rect);
            Rect position = new Rect(rect.x + 1f, rect.y, rect.width - 2f, 17f);

            if (Event.current.type == EventType.Repaint)
            {
                this.background.Draw(rect, GUIContent.none, false, false, false, false);
                GUIStyle gUIStyle = "dragTab";
                gUIStyle.Draw(position, base.actualView.titleContent, false, false, true, base.hasFocus);
            }
            if (Event.current.type == EventType.ContextClick && position.Contains(Event.current.mousePosition))
            {
                base.PopupGenericMenu(base.actualView, new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0f, 0f));
            }
            base.ShowGenericMenu();
            if (base.actualView)
            {
                base.actualView.m_Pos = base.borderSize.Remove(base.screenPosition);
            }
            base.InvokeOnGUI(rect);
        }
示例#11
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);
                    }
                }
            }
        }
示例#12
0
        protected override void OldOnGUI()
        {
            ClearBackground();
            EditorGUIUtility.ResetGUIState();

            // Exit if the window was destroyed after entering play mode or on domain-reload.
            if (window == null)
            {
                return;
            }

            HandleSplitView();

            background = "dockarea";
            Rect dockAreaRect = background.margin.Remove(new Rect(0, 0, position.width, position.height));

            dockAreaRect.x = background.margin.left;
            Rect wPos = windowPosition;
            Rect containerWindowPosition = window.position;

            containerWindowPosition.width  = Mathf.Ceil(containerWindowPosition.width);
            containerWindowPosition.height = Mathf.Ceil(containerWindowPosition.height);

            bool customBorder = floatingWindow && windowPosition.y == 0;
            bool isBottomTab  = wPos.yMax == containerWindowPosition.height;

            UpdateDockAreaFromLocation(wPos, containerWindowPosition, ref dockAreaRect);
            DrawDockAreaBackground(customBorder, dockAreaRect);
            FixDockAreaRectBorders(customBorder, ref dockAreaRect);

            var viewRect    = UpdateViewRect(dockAreaRect, isBottomTab, customBorder, floatingWindow);
            var tabAreaRect = new Rect(dockAreaRect.x + 1, dockAreaRect.y - 1f, dockAreaRect.width - GetExtraButtonsWidth(), kTabHeight);

            HandleTabScrolling(tabAreaRect);

            float genericMenuLeftOffset = Styles.genericMenuLeftOffset;
            float genericMenuTopOffset  = Styles.genericMenuTopOffset;

            if (floatingWindow && isTopRightPane)
            {
                genericMenuLeftOffset = ContainerWindow.buttonStackWidth + Styles.genericMenuFloatingLeftOffset;
                genericMenuTopOffset  = Styles.genericMenuFloatingTopOffset;
            }
            ShowGenericMenu(position.width - genericMenuLeftOffset, tabAreaRect.y + genericMenuTopOffset);

            DrawTabs(tabAreaRect);
            DrawView(viewRect, dockAreaRect, floatingWindow, isBottomTab);


            DrawTabScrollers(tabAreaRect);

            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
            float DrawEditor(Rect rect, Editor editor, bool disabled, EditorGUIUtility.ComparisonViewMode comparisonViewMode)
            {
                rect.xMin += 1;
                EditorGUIUtility.ResetGUIState();

                EditorGUIUtility.wideMode           = true;
                EditorGUIUtility.labelWidth         = 120;
                EditorGUIUtility.comparisonViewMode = comparisonViewMode;
                EditorGUIUtility.leftMarginCoord    = rect.x;

                GUILayout.BeginArea(rect);
                Rect editorRect = EditorGUILayout.BeginVertical();

                {
                    using (new EditorGUI.DisabledScope(disabled))
                    {
                        if (editor == null)
                        {
                            GUI.enabled = true;
                            GUILayout.Label("None - this should not happen.", Styles.centeredLabelStyle);
                        }
                        else
                        {
                            EditorGUI.BeginChangeCheck();
                            if (editor.target is GameObject)
                            {
                                editor.DrawHeader();
                            }
                            else
                            {
                                EditorGUIUtility.hierarchyMode = true;
                                EditorGUILayout.InspectorTitlebar(true, editor);
                                EditorGUILayout.BeginVertical(EditorStyles.inspectorDefaultMargins);
                                editor.OnInspectorGUI();
                                EditorGUILayout.Space();
                                EditorGUILayout.EndVertical();
                            }

                            if (EditorGUI.EndChangeCheck())
                            {
                                m_OwnerNeedsRefresh = true;
                            }
                        }
                    }
                }

                EditorGUILayout.EndVertical();
                GUILayout.EndArea();

                // Overdraw border by one pixel in all directions.
                GUI.Label(new Rect(rect.x - 1, -1, rect.width + 2, m_PreviewSize.y + 2), GUIContent.none, Styles.borderStyle);

                return(editorRect.height);
            }
        void WindowTrampoline(int id)
        {
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            EditorGUILayout.BeginVertical(GUILayout.MinWidth(210));

            var paddingOffset = -k_WindowPadding;

            foreach (OverlayWindow win in s_Windows)
            {
                if (!m_SceneView.m_ShowSceneViewWindows && win.editorWindow != m_SceneView)
                {
                    continue;
                }

                GUILayout.Space(k_WindowPadding + paddingOffset);
                paddingOffset = 0f;
                EditorGUIUtility.ResetGUIState();
                if (win.canCollapse)
                {
                    GUILayout.BeginVertical(m_TitleStyle);

                    win.expanded = EditorGUILayout.Foldout(win.expanded, win.title);

                    if (win.expanded)
                    {
                        win.sceneViewFunc(win.target, m_SceneView);
                    }
                    GUILayout.EndVertical();
                }
                else
                {
                    GUILayout.BeginVertical(win.title, GUI.skin.window);
                    win.sceneViewFunc(win.target, m_SceneView);
                    GUILayout.EndVertical();
                }
            }

            GUILayout.EndVertical();

            var inputEaterRect = GUILayoutUtility.GetLastRect();

            EatMouseInput(inputEaterRect);

            if (Event.current.type == EventType.Repaint)
            {
                m_LastWidth = inputEaterRect.width;
            }

            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }
示例#15
0
        protected override void OldOnGUI()
        {
            var oldLabelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.ResetGUIState();

            // Exit if the window was destroyed after entering play mode or on domain-reload.
            if (window == null)
            {
                return;
            }

            var borderSize = GetBorderSize();

            Rect dockAreaRect            = new Rect(0, 0, position.width, position.height);
            Rect containerWindowPosition = window.position;

            containerWindowPosition.width  = Mathf.Ceil(containerWindowPosition.width);
            containerWindowPosition.height = Mathf.Ceil(containerWindowPosition.height);

            DrawDockAreaBackground(dockAreaRect);

            var   viewRect              = UpdateViewRect(dockAreaRect);
            var   titleBarRect          = new Rect(viewRect.x, dockAreaRect.y, viewRect.width, borderSize.top);
            float genericMenuLeftOffset = GetGenericMenuLeftOffset(floatingWindow && isTopRightPane);

            m_TabAreaRect = new Rect(titleBarRect.x, viewRect.y - kTabHeight, titleBarRect.width - (GetExtraButtonsWidth() + genericMenuLeftOffset), kTabHeight);

            DrawDockTitleBarBackground(titleBarRect);
            HandleTabScrolling(m_TabAreaRect);


            float genericMenuTopOffset = Styles.genericMenuTopOffset;

            if (floatingWindow && isTopRightPane)
            {
                genericMenuTopOffset = Styles.genericMenuFloatingTopOffset;
            }
            if (!ContainerWindow.s_Modal)
            {
                ShowGenericMenu(position.width - genericMenuLeftOffset, m_TabAreaRect.y + genericMenuTopOffset);
            }

            DrawTabs(m_TabAreaRect);
            HandleSplitView(); //fogbugz 1169963: in order to easily use the splitter in the gameView, it must be prioritized over DrawView(). Side effect for touch is that splitter picking zones might overlap other controls but the tabs still have higher priority so the user can undock the window in that case
            DrawView(viewRect, dockAreaRect);

            DrawTabScrollers(m_TabAreaRect);

            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
            EditorGUIUtility.labelWidth = oldLabelWidth;
        }
示例#16
0
        protected override void OldOnGUI()
        {
            ClearBackground();
            EditorGUIUtility.ResetGUIState();

            // Exit if the window was destroyed after entering play mode or on domain-reload.
            if (window == null)
            {
                return;
            }

            var borderSize = GetBorderSize();

            HandleSplitView();

            background = "dockarea";

            Rect dockAreaRect            = new Rect(0, 0, position.width, position.height);
            Rect wPos                    = windowPosition;
            Rect containerWindowPosition = window.position;

            containerWindowPosition.width  = Mathf.Ceil(containerWindowPosition.width);
            containerWindowPosition.height = Mathf.Ceil(containerWindowPosition.height);

            DrawDockAreaBackground(dockAreaRect);

            var viewRect     = UpdateViewRect(dockAreaRect);
            var titleBarRect = new Rect(viewRect.x, dockAreaRect.y, viewRect.width, borderSize.top);
            var tabAreaRect  = new Rect(titleBarRect.x, viewRect.y - kTabHeight, titleBarRect.width - GetExtraButtonsWidth(), kTabHeight);

            DrawDockTitleBarBackground(titleBarRect);
            HandleTabScrolling(tabAreaRect);

            float genericMenuLeftOffset = Styles.genericMenuLeftOffset;
            float genericMenuTopOffset  = Styles.genericMenuTopOffset;

            if (floatingWindow && isTopRightPane)
            {
                genericMenuLeftOffset = ContainerWindow.buttonStackWidth + Styles.genericMenuFloatingLeftOffset;
                genericMenuTopOffset  = Styles.genericMenuFloatingTopOffset;
            }
            ShowGenericMenu(position.width - genericMenuLeftOffset, tabAreaRect.y + genericMenuTopOffset);

            DrawTabs(tabAreaRect);
            DrawView(viewRect, dockAreaRect);

            DrawTabScrollers(tabAreaRect);

            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
示例#17
0
        public void InvokeOnGUI(Rect onGUIPosition, Rect viewRect)
        {
            if (!this)
            {
                return;
            }

            DoWindowDecorationStart();

            BeginOffsetArea(viewRect, GUIContent.none, Styles.tabWindowBackground);

            EditorGUIUtility.ResetGUIState();

            bool isExitGUIException = false;

            try
            {
                using (new EditorPerformanceTracker($"{GetActualViewName()}.OnGUI.{Event.current.type}"))
                {
                    m_OnGUI?.Invoke();
                }
            }
            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)
                {
                    CheckNotificationStatus();

                    EndOffsetArea();

                    EditorGUIUtility.ResetGUIState();

                    DoWindowDecorationEnd();

                    if (Event.current != null && Event.current.type == EventType.Repaint)
                    {
                        Styles.overlay.Draw(onGUIPosition, GUIContent.none, 0);
                    }
                }
            }
        }
示例#18
0
 public void InvokeOnGUI(Rect onGUIPosition)
 {
     if (Unsupported.IsDeveloperMode() && this.actualView != null && Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.F5)
     {
         this.Reload(this.actualView);
     }
     else
     {
         base.DoWindowDecorationStart();
         GUIStyle gUIStyle = "dockareaoverlay";
         if (this.actualView is GameView)
         {
             GUI.Box(onGUIPosition, GUIContent.none, gUIStyle);
         }
         HostView.BeginOffsetArea(new Rect(onGUIPosition.x + 2f, onGUIPosition.y + 17f, onGUIPosition.width - 4f, onGUIPosition.height - 17f - 2f), GUIContent.none, "TabWindowBackground");
         EditorGUIUtility.ResetGUIState();
         bool flag = false;
         try
         {
             this.Invoke("OnGUI");
         }
         catch (TargetInvocationException ex)
         {
             if (ex.InnerException is ExitGUIException)
             {
                 flag = true;
             }
             throw;
         }
         finally
         {
             if (!flag)
             {
                 if (this.actualView != null && this.actualView.m_FadeoutTime != 0f && Event.current != null && Event.current.type == EventType.Repaint)
                 {
                     this.actualView.DrawNotification();
                 }
                 HostView.EndOffsetArea();
                 EditorGUIUtility.ResetGUIState();
                 base.DoWindowDecorationEnd();
                 if (Event.current.type == EventType.Repaint)
                 {
                     gUIStyle.Draw(onGUIPosition, GUIContent.none, 0);
                 }
             }
         }
     }
 }
示例#19
0
        public void InvokeOnGUI(Rect onGUIPosition, Rect viewRect)
        {
            DoWindowDecorationStart();

            BeginOffsetArea(viewRect, GUIContent.none, "TabWindowBackground");

            EditorGUIUtility.ResetGUIState();

            bool isExitGUIException = false;

            try
            {
                var viewName = actualView != null?actualView.GetType().Name : GetType().Name;

                using (new PerformanceTracker(viewName + ".OnGUI." + Event.current.type))
                {
                    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)
                {
                    CheckNotificationStatus();

                    EndOffsetArea();

                    EditorGUIUtility.ResetGUIState();

                    DoWindowDecorationEnd();

                    if (Event.current != null && Event.current.type == EventType.Repaint)
                    {
                        HostViewStyles.overlay.Draw(onGUIPosition, GUIContent.none, 0);
                    }
                }
            }
        }
示例#20
0
        public void OnGUI()
        {
            base.ClearBackground();
            EditorGUIUtility.ResetGUIState();
            Rect rect = new Rect(-2f, 0f, base.position.width + 4f, base.position.height);

            this.background = "dockarea";
            GUIStyle style = "dockareaoverlay";

            rect = this.background.margin.Remove(rect);
            base.DoWindowDecorationStart();
            Rect position = new Rect(rect.x + 1f, rect.y, rect.width - 2f, 17f);

            if (Event.current.type == EventType.Repaint)
            {
                this.background.Draw(rect, GUIContent.none, false, false, false, false);
                GUIStyle gUIStyle = "dragTab";
                gUIStyle.Draw(position, base.actualView.titleContent, false, false, true, base.hasFocus);
            }
            if (Event.current.type == EventType.ContextClick && position.Contains(Event.current.mousePosition))
            {
                base.PopupGenericMenu(base.actualView, new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0f, 0f));
            }
            base.ShowGenericMenu();
            if (base.actualView)
            {
                base.actualView.m_Pos = base.borderSize.Remove(base.screenPosition);
                if (base.actualView is GameView)
                {
                    GUI.Box(rect, GUIContent.none, style);
                }
            }
            DockArea.BeginOffsetArea(new Rect(rect.x + 2f, rect.y + 17f, rect.width - 4f, rect.height - 17f - 2f), GUIContent.none, "TabWindowBackground");
            try
            {
                base.Invoke("OnGUI");
            }
            catch (TargetInvocationException ex)
            {
                throw ex.InnerException;
            }
            EditorGUIUtility.ResetGUIState();
            DockArea.EndOffsetArea();
            base.DoWindowDecorationEnd();
            GUI.Box(rect, GUIContent.none, style);
        }
示例#21
0
        protected override void OldOnGUI()
        {
            ClearBackground();
            EditorGUIUtility.ResetGUIState();

            // Exit if the window was destroyed after entering play mode or on domain-reload.
            if (window == null)
            {
                return;
            }

            HandleSplitView();

            background = "dockarea";
            Rect dockAreaRect = background.margin.Remove(new Rect(0, 0, position.width, position.height));

            dockAreaRect.x = background.margin.left;
            dockAreaRect.y = background.margin.top;
            Rect wPos = windowPosition;
            Rect containerWindowPosition = window.position;

            containerWindowPosition.width  = Mathf.FloorToInt(containerWindowPosition.width);
            containerWindowPosition.height = Mathf.FloorToInt(containerWindowPosition.height);

            bool floatingWindow = window.rootView.GetType() != typeof(MainView);
            bool customBorder   = floatingWindow && windowPosition.y == 0;
            bool isBottomTab    = wPos.yMax == containerWindowPosition.height;

            UpdateDockAreaFromLocation(wPos, containerWindowPosition, ref dockAreaRect);
            DrawDockAreaBackground(customBorder, dockAreaRect);
            FixDockAreaRectBorders(customBorder, ref dockAreaRect);
            HandleTabScrolling(dockAreaRect);

            var viewRect    = UpdateViewRect(dockAreaRect, isBottomTab, customBorder, floatingWindow);
            var tabAreaRect = new Rect(dockAreaRect.x + 1, dockAreaRect.y - 1f, dockAreaRect.width - Styles.tabDropdownOptions, kTabHeight);

            DrawTabs(tabAreaRect);
            ShowGenericMenu(tabAreaRect.yMin + (floatingWindow ? 10f : 8f));

            DrawView(viewRect, dockAreaRect, customBorder, floatingWindow, isBottomTab);
            DrawTabScrollers(tabAreaRect, dockAreaRect);

            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
        public void OnGUI()
        {
            this.ClearBackground();
            EditorGUIUtility.ResetGUIState();
            Rect rect = new Rect(-2f, 0.0f, this.position.width + 4f, this.position.height);

            this.background = (GUIStyle)"dockarea";
            GUIStyle style     = (GUIStyle)"dockareaoverlay";
            Rect     position1 = this.background.margin.Remove(rect);

            this.DoWindowDecorationStart();
            Rect position2 = new Rect(position1.x + 1f, position1.y, position1.width - 2f, 17f);

            if (Event.current.type == EventType.Repaint)
            {
                this.background.Draw(position1, GUIContent.none, false, false, false, false);
                (GUIStyle)"dragTab".Draw(position2, this.actualView.titleContent, false, false, true, this.hasFocus);
            }
            if (Event.current.type == EventType.ContextClick && position2.Contains(Event.current.mousePosition))
            {
                this.PopupGenericMenu(this.actualView, new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0.0f, 0.0f));
            }
            this.ShowGenericMenu();
            if ((bool)((UnityEngine.Object) this.actualView))
            {
                this.actualView.m_Pos = this.borderSize.Remove(this.screenPosition);
                if (this.actualView is GameView)
                {
                    GUI.Box(position1, GUIContent.none, style);
                }
            }
            DockArea.BeginOffsetArea(new Rect(position1.x + 2f, position1.y + 17f, position1.width - 4f, (float)((double)position1.height - 17.0 - 2.0)), GUIContent.none, (GUIStyle)"TabWindowBackground");
            try
            {
                this.Invoke("OnGUI");
            }
            catch (TargetInvocationException ex)
            {
                throw ex.InnerException;
            }
            EditorGUIUtility.ResetGUIState();
            DockArea.EndOffsetArea();
            this.DoWindowDecorationEnd();
            GUI.Box(position1, GUIContent.none, style);
        }
示例#23
0
        protected override void OldOnGUI()
        {
            // Call reset GUI state as first thing so GUI.color is correct when drawing window decoration.
            EditorGUIUtility.ResetGUIState();

            Rect maximizedViewRect = Rect.zero;

            maximizedViewRect.size = position.size;
            maximizedViewRect      = Styles.background.margin.Remove(maximizedViewRect);

            Rect backRect = new Rect(maximizedViewRect.x + 1, maximizedViewRect.y, maximizedViewRect.width - 2, DockArea.kTabHeight);

            if (Event.current.type == EventType.Repaint)
            {
                Styles.background.Draw(maximizedViewRect, GUIContent.none, false, false, false, false);
                Styles.titleBackground.Draw(backRect, false, false, true, hasFocus);
                GUI.Label(backRect, actualView.titleContent, Styles.titleLabel);
            }

            if (Event.current.type == EventType.ContextClick && backRect.Contains(Event.current.mousePosition) && !ContainerWindow.s_Modal)
            {
                PopupGenericMenu(actualView, new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0, 0));
            }

            // GetGenericMenuLeftOffset false because maximized window are not floating windows
            ShowGenericMenu(position.width - GetGenericMenuLeftOffset(false), backRect.yMin + Styles.genericMenuTopOffset);

            const float topBottomPadding = 0f;
            Rect        viewRect         = maximizedViewRect;

            viewRect.y      = backRect.yMax - topBottomPadding;
            viewRect.height = position.height - backRect.yMax + topBottomPadding;

            if (actualView)
            {
                actualView.m_Pos = new Rect(GUIUtility.GUIToScreenPoint(Vector2.zero), viewRect.size);
            }

            InvokeOnGUI(maximizedViewRect, viewRect);
        }
示例#24
0
        public void InvokeOnGUI(Rect onGUIPosition)
        {
            base.DoWindowDecorationStart();
            GUIStyle style = "dockareaoverlay";

            if (this.actualView is GameView)
            {
                GUI.Box(onGUIPosition, GUIContent.none, style);
            }
            BeginOffsetArea(new Rect(onGUIPosition.x + 2f, onGUIPosition.y + 17f, onGUIPosition.width - 4f, (onGUIPosition.height - 17f) - 2f), GUIContent.none, "TabWindowBackground");
            EditorGUIUtility.ResetGUIState();
            bool flag = false;

            try
            {
                this.Invoke("OnGUI");
            }
            catch (TargetInvocationException exception)
            {
                if (exception.InnerException is ExitGUIException)
                {
                    flag = true;
                }
                throw exception.InnerException;
            }
            finally
            {
                if (!flag)
                {
                    if (((this.actualView != null) && (this.actualView.m_FadeoutTime != 0f)) && ((Event.current != null) && (Event.current.type == EventType.Repaint)))
                    {
                        this.actualView.DrawNotification();
                    }
                    EndOffsetArea();
                    EditorGUIUtility.ResetGUIState();
                    base.DoWindowDecorationEnd();
                    GUI.Box(onGUIPosition, GUIContent.none, style);
                }
            }
        }
示例#25
0
        protected override void OldOnGUI()
        {
            ClearBackground();
            // Call reset GUI state as first thing so GUI.color is correct when drawing window decoration.
            EditorGUIUtility.ResetGUIState();

            Rect maximizedViewRect = new Rect(-2, 0, position.width + 4, position.height);

            maximizedViewRect = Styles.background.margin.Remove(maximizedViewRect);

            Rect backRect = new Rect(maximizedViewRect.x + 1, maximizedViewRect.y, maximizedViewRect.width - 2, DockArea.kTabHeight);

            if (Event.current.type == EventType.Repaint)
            {
                Styles.background.Draw(maximizedViewRect, GUIContent.none, false, false, false, false);
                Styles.dragTab.Draw(backRect, actualView.titleContent, false, false, true, hasFocus);
            }

            if (Event.current.type == EventType.ContextClick && backRect.Contains(Event.current.mousePosition))
            {
                PopupGenericMenu(actualView, new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0, 0));
            }

            ShowGenericMenu(position.width - 20, backRect.yMin + 6f);

            const float topBottomPadding = 3f;
            Rect        viewRect         = maximizedViewRect;

            viewRect.y      = backRect.yMax - topBottomPadding;
            viewRect.height = position.height - backRect.yMax + topBottomPadding;

            if (actualView)
            {
                actualView.m_Pos = new Rect(GUIUtility.GUIToScreenPoint(Vector2.zero), viewRect.size);
            }

            InvokeOnGUI(maximizedViewRect, viewRect);
        }
示例#26
0
 private void OnGUI()
 {
     EditorGUIUtility.ResetGUIState();
     this.DoWindowDecorationStart();
     if (this.background == null)
     {
         this.background             = (GUIStyle)"hostview";
         this.background.padding.top = 0;
     }
     GUILayout.BeginVertical(this.background, new GUILayoutOption[0]);
     if ((bool)((UnityEngine.Object) this.actualView))
     {
         this.actualView.m_Pos = this.screenPosition;
     }
     this.Invoke("OnGUI");
     EditorGUIUtility.ResetGUIState();
     if ((double)this.m_ActualView.m_FadeoutTime != 0.0 && Event.current.type == EventType.Repaint)
     {
         this.m_ActualView.DrawNotification();
     }
     GUILayout.EndVertical();
     this.DoWindowDecorationEnd();
     EditorGUI.ShowRepaints();
 }
示例#27
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;
            }
            GUILayout.BeginVertical(background);

            if (actualView)
            {
                actualView.m_Pos = screenPosition;
            }

            Invoke("OnGUI");
            EditorGUIUtility.ResetGUIState();

            if (m_ActualView != null)
            {
                if (m_ActualView.m_FadeoutTime != 0 && Event.current.type == EventType.Repaint)
                {
                    m_ActualView.DrawNotification();
                }
            }

            GUILayout.EndVertical();
            DoWindowDecorationEnd();

            EditorGUI.ShowRepaints();
        }
示例#28
0
        public void InvokeOnGUI(Rect onGUIPosition, Rect viewRect)
        {
            // Handle window reloading.
            if (Unsupported.IsDeveloperMode() &&
                actualView != null &&
                Event.current.type == EventType.KeyUp && Event.current.keyCode == KeyCode.F5)
            {
                if (Event.current.control)
                {
                    DebugWindow(actualView);
                }
                else
                {
                    Reload(actualView);
                }
                return;
            }

            DoWindowDecorationStart();

            BeginOffsetArea(viewRect, GUIContent.none, "TabWindowBackground");

            EditorGUIUtility.ResetGUIState();

            bool isExitGUIException = false;

            try
            {
                using (new PerformanceTracker(actualView.GetType().Name + ".OnGUI." + Event.current.type))
                {
                    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)
                {
                    CheckNotificationStatus();

                    EndOffsetArea();

                    EditorGUIUtility.ResetGUIState();

                    DoWindowDecorationEnd();

                    if (Event.current != null && Event.current.type == EventType.Repaint)
                    {
                        HostViewStyles.overlay.Draw(onGUIPosition, GUIContent.none, 0);
                    }
                }
            }
        }
示例#29
0
        public void OnGUI()
        {
            base.ClearBackground();
            EditorGUIUtility.ResetGUIState();
            SplitView splitView = base.parent as SplitView;

            if (Event.current.type == EventType.Repaint && splitView)
            {
                View child = this;
                while (splitView)
                {
                    int controlID = splitView.controlID;
                    if (controlID == GUIUtility.hotControl || GUIUtility.hotControl == 0)
                    {
                        int num = splitView.IndexOfChild(child);
                        if (splitView.vertical)
                        {
                            if (num != 0)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(0f, 0f, base.position.width, 5f), MouseCursor.SplitResizeUpDown, controlID);
                            }
                            if (num != splitView.children.Length - 1)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(0f, base.position.height - 5f, base.position.width, 5f), MouseCursor.SplitResizeUpDown, controlID);
                            }
                        }
                        else
                        {
                            if (num != 0)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(0f, 0f, 5f, base.position.height), MouseCursor.SplitResizeLeftRight, controlID);
                            }
                            if (num != splitView.children.Length - 1)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(base.position.width - 5f, 0f, 5f, base.position.height), MouseCursor.SplitResizeLeftRight, controlID);
                            }
                        }
                    }
                    child     = splitView;
                    splitView = (splitView.parent as SplitView);
                }
                splitView = (base.parent as SplitView);
            }
            bool flag = false;

            if (base.window.mainView.GetType() != typeof(MainWindow))
            {
                flag = true;
                if (base.windowPosition.y == 0f)
                {
                    this.background = "dockareaStandalone";
                }
                else
                {
                    this.background = "dockarea";
                }
            }
            else
            {
                this.background = "dockarea";
            }
            if (splitView)
            {
                Event @event = new Event(Event.current);
                @event.mousePosition += new Vector2(base.position.x, base.position.y);
                splitView.SplitGUI(@event);
                if (@event.type == EventType.Used)
                {
                    Event.current.Use();
                }
            }
            GUIStyle style    = "dockareaoverlay";
            Rect     position = this.background.margin.Remove(new Rect(0f, 0f, base.position.width, base.position.height));

            position.x = (float)this.background.margin.left;
            position.y = (float)this.background.margin.top;
            Rect  windowPosition = base.windowPosition;
            float num2           = 2f;

            if (windowPosition.x == 0f)
            {
                position.x     -= num2;
                position.width += num2;
            }
            if (windowPosition.xMax == base.window.position.width)
            {
                position.width += num2;
            }
            if (windowPosition.yMax == base.window.position.height)
            {
                position.height += ((!flag) ? 2f : 2f);
            }
            GUI.Box(position, GUIContent.none, this.background);
            if (this.tabStyle == null)
            {
                this.tabStyle = "dragtab";
            }
            this.DragTab(new Rect(position.x + 1f, position.y, position.width - 40f, 17f), this.tabStyle);
            this.tabStyle = "dragtab";
            base.ShowGenericMenu();
            base.DoWindowDecorationStart();
            if (this.m_Panes.Count > 0)
            {
                if (this.m_Panes[this.selected] is GameView)
                {
                    GUI.Box(position, GUIContent.none, style);
                }
                DockArea.BeginOffsetArea(new Rect(position.x + 2f, position.y + 17f, position.width - 4f, position.height - 17f - 2f), GUIContent.none, "TabWindowBackground");
                Vector2 vector = GUIUtility.GUIToScreenPoint(Vector2.zero);
                Rect    pos    = base.borderSize.Remove(base.position);
                pos.x = vector.x;
                pos.y = vector.y;
                this.m_Panes[this.selected].m_Pos = pos;
                EditorGUIUtility.ResetGUIState();
                try
                {
                    base.Invoke("OnGUI");
                }
                catch (TargetInvocationException ex)
                {
                    throw ex.InnerException;
                }
                EditorGUIUtility.ResetGUIState();
                if (base.actualView != null && base.actualView.m_FadeoutTime != 0f && Event.current != null && Event.current.type == EventType.Repaint)
                {
                    base.actualView.DrawNotification();
                }
                DockArea.EndOffsetArea();
            }
            base.DoWindowDecorationEnd();
            GUI.Box(position, GUIContent.none, style);
            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
示例#30
0
        public void OnGUI()
        {
            this.ClearBackground();
            EditorGUIUtility.ResetGUIState();
            SplitView parent = this.parent as SplitView;

            if (Event.current.type == EventType.Repaint && (bool)((UnityEngine.Object)parent))
            {
                View child = (View)this;
                for (; (bool)((UnityEngine.Object)parent); parent = parent.parent as SplitView)
                {
                    int controlId = parent.controlID;
                    if (controlId == GUIUtility.hotControl || GUIUtility.hotControl == 0)
                    {
                        int num = parent.IndexOfChild(child);
                        if (parent.vertical)
                        {
                            if (num != 0)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(0.0f, 0.0f, this.position.width, 5f), MouseCursor.SplitResizeUpDown, controlId);
                            }
                            if (num != parent.children.Length - 1)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(0.0f, this.position.height - 5f, this.position.width, 5f), MouseCursor.SplitResizeUpDown, controlId);
                            }
                        }
                        else
                        {
                            if (num != 0)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(0.0f, 0.0f, 5f, this.position.height), MouseCursor.SplitResizeLeftRight, controlId);
                            }
                            if (num != parent.children.Length - 1)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(this.position.width - 5f, 0.0f, 5f, this.position.height), MouseCursor.SplitResizeLeftRight, controlId);
                            }
                        }
                    }
                    child = (View)parent;
                }
                parent = this.parent as SplitView;
            }
            bool flag = false;

            if (this.window.mainView.GetType() != typeof(MainWindow))
            {
                flag = true;
                if ((double)this.windowPosition.y == 0.0)
                {
                    this.background = (GUIStyle)"dockareaStandalone";
                }
                else
                {
                    this.background = (GUIStyle)"dockarea";
                }
            }
            else
            {
                this.background = (GUIStyle)"dockarea";
            }
            if ((bool)((UnityEngine.Object)parent))
            {
                Event evt = new Event(Event.current);
                evt.mousePosition += new Vector2(this.position.x, this.position.y);
                parent.SplitGUI(evt);
                if (evt.type == EventType.Used)
                {
                    Event.current.Use();
                }
            }
            GUIStyle style    = (GUIStyle)"dockareaoverlay";
            Rect     position = this.background.margin.Remove(new Rect(0.0f, 0.0f, this.position.width, this.position.height));

            position.x = (float)this.background.margin.left;
            position.y = (float)this.background.margin.top;
            Rect  windowPosition = this.windowPosition;
            float num1           = 2f;

            if ((double)windowPosition.x == 0.0)
            {
                position.x     -= num1;
                position.width += num1;
            }
            if ((double)windowPosition.xMax == (double)this.window.position.width)
            {
                position.width += num1;
            }
            if ((double)windowPosition.yMax == (double)this.window.position.height)
            {
                position.height += !flag ? 2f : 2f;
            }
            GUI.Box(position, GUIContent.none, this.background);
            if (this.tabStyle == null)
            {
                this.tabStyle = (GUIStyle)"dragtab";
            }
            this.DragTab(new Rect(position.x + 1f, position.y, position.width - 40f, 17f), this.tabStyle);
            this.tabStyle = (GUIStyle)"dragtab";
            this.ShowGenericMenu();
            this.DoWindowDecorationStart();
            if (this.m_Panes.Count > 0)
            {
                if (this.m_Panes[this.selected] is GameView)
                {
                    GUI.Box(position, GUIContent.none, style);
                }
                DockArea.BeginOffsetArea(new Rect(position.x + 2f, position.y + 17f, position.width - 4f, (float)((double)position.height - 17.0 - 2.0)), GUIContent.none, (GUIStyle)"TabWindowBackground");
                Vector2 screenPoint = GUIUtility.GUIToScreenPoint(Vector2.zero);
                Rect    rect        = this.borderSize.Remove(this.position);
                rect.x = screenPoint.x;
                rect.y = screenPoint.y;
                this.m_Panes[this.selected].m_Pos = rect;
                EditorGUIUtility.ResetGUIState();
                try
                {
                    this.Invoke("OnGUI");
                }
                catch (TargetInvocationException ex)
                {
                    throw ex.InnerException;
                }
                EditorGUIUtility.ResetGUIState();
                if ((UnityEngine.Object) this.actualView != (UnityEngine.Object)null && (double)this.actualView.m_FadeoutTime != 0.0 && (Event.current != null && Event.current.type == EventType.Repaint))
                {
                    this.actualView.DrawNotification();
                }
                DockArea.EndOffsetArea();
            }
            this.DoWindowDecorationEnd();
            GUI.Box(position, GUIContent.none, style);
            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI((GUIView)this);
        }