示例#1
0
        private void OnGUI()
        {
            float width  = 10f;
            float width2 = 20f;
            float num    = 32f;
            float num2   = 64f;
            float width3 = 80f;

            this.InitializeToolIcons();
            bool isPlayingOrWillChangePlaymode = EditorApplication.isPlayingOrWillChangePlaymode;

            if (isPlayingOrWillChangePlaymode)
            {
                GUI.color = HostView.kPlayModeDarken;
            }
            if (Event.current.type == EventType.Repaint)
            {
                Toolbar.Styles.appToolbar.Draw(new Rect(0f, 0f, base.position.width, base.position.height), false, false, false, false);
            }
            Rect pos = new Rect(0f, 0f, 0f, 0f);

            this.ReserveWidthRight(width, ref pos);
            this.ReserveWidthRight(num * 5f, ref pos);
            this.DoToolButtons(this.GetThickArea(pos));
            this.ReserveWidthRight(width2, ref pos);
            this.ReserveWidthRight(num2 * 2f, ref pos);
            this.DoPivotButtons(this.GetThinArea(pos));
            float num3 = 100f;

            pos = new Rect((float)Mathf.RoundToInt((base.position.width - num3) / 2f), 0f, 140f, 0f);
            GUILayout.BeginArea(this.GetThickArea(pos));
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.DoPlayButtons(isPlayingOrWillChangePlaymode);
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
            pos = new Rect(base.position.width, 0f, 0f, 0f);
            this.ReserveWidthLeft(width, ref pos);
            this.ReserveWidthLeft(width3, ref pos);
            this.DoLayoutDropDown(this.GetThinArea(pos));
            this.ReserveWidthLeft(width, ref pos);
            this.ReserveWidthLeft(width3, ref pos);
            this.DoLayersDropDown(this.GetThinArea(pos));
            this.ReserveWidthLeft(width2, ref pos);
            this.ReserveWidthLeft(width3, ref pos);
            if (EditorGUI.DropdownButton(this.GetThinArea(pos), Toolbar.s_AccountContent, FocusType.Passive, Toolbar.Styles.dropdown))
            {
                this.ShowUserMenu(this.GetThinArea(pos));
            }
            this.ReserveWidthLeft(width, ref pos);
            this.ReserveWidthLeft(32f, ref pos);
            if (GUI.Button(this.GetThinArea(pos), Toolbar.s_CloudIcon))
            {
                UnityConnectServiceCollection.instance.ShowService("Hub", true, "cloud_icon");
            }
            this.ReserveWidthLeft(width, ref pos);
            this.ReserveWidthLeft(78f, ref pos);
            this.DoCollabDropDown(this.GetThinArea(pos));
            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
示例#2
0
        private void OnGUI()
        {
            float width = 10f;
            float num2  = 20f;
            float num3  = 32f;
            float num4  = 64f;
            float num5  = 80f;

            InitializeToolIcons();
            bool isPlayingOrWillChangePlaymode = EditorApplication.isPlayingOrWillChangePlaymode;

            if (isPlayingOrWillChangePlaymode)
            {
                GUI.color = (Color)HostView.kPlayModeDarken;
            }
            GUIStyle style = "AppToolbar";

            if (Event.current.type == EventType.Repaint)
            {
                style.Draw(new Rect(0f, 0f, base.position.width, base.position.height), false, false, false, false);
            }
            Rect pos = new Rect(0f, 0f, 0f, 0f);

            this.ReserveWidthRight(width, ref pos);
            this.ReserveWidthRight(num3 * 5f, ref pos);
            this.DoToolButtons(this.GetThickArea(pos));
            this.ReserveWidthRight(num2, ref pos);
            this.ReserveWidthRight(num4 * 2f, ref pos);
            this.DoPivotButtons(this.GetThinArea(pos));
            float num6 = 100f;

            pos = new Rect((base.position.width - num6) / 2f, 0f, 140f, 0f);
            GUILayout.BeginArea(this.GetThickArea(pos));
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.DoPlayButtons(isPlayingOrWillChangePlaymode);
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
            pos = new Rect(base.position.width, 0f, 0f, 0f);
            this.ReserveWidthLeft(width, ref pos);
            this.ReserveWidthLeft(num5, ref pos);
            this.DoLayoutDropDown(this.GetThinArea(pos));
            this.ReserveWidthLeft(width, ref pos);
            this.ReserveWidthLeft(num5, ref pos);
            this.DoLayersDropDown(this.GetThinArea(pos));
            this.ReserveWidthLeft(num2, ref pos);
            this.ReserveWidthLeft(num5, ref pos);
            if (EditorGUI.ButtonMouseDown(this.GetThinArea(pos), new GUIContent("Account"), FocusType.Passive, "Dropdown"))
            {
                this.ShowUserMenu(this.GetThinArea(pos));
            }
            this.ReserveWidthLeft(width, ref pos);
            this.ReserveWidthLeft(32f, ref pos);
            if (GUI.Button(this.GetThinArea(pos), s_CloudIcon, "Button"))
            {
                UnityConnectServiceCollection.instance.ShowService("Hub", true);
            }
            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
示例#3
0
        private void OnGUI()
        {
            float width1 = 10f;
            float width2 = 20f;
            float num1   = 32f;
            float num2   = 64f;
            float width3 = 80f;

            Toolbar.InitializeToolIcons();
            bool willChangePlaymode = EditorApplication.isPlayingOrWillChangePlaymode;

            if (willChangePlaymode)
            {
                GUI.color = (Color)HostView.kPlayModeDarken;
            }
            GUIStyle guiStyle = (GUIStyle)"AppToolbar";

            if (Event.current.type == EventType.Repaint)
            {
                guiStyle.Draw(new Rect(0.0f, 0.0f, this.position.width, this.position.height), false, false, false, false);
            }
            Rect pos = new Rect(0.0f, 0.0f, 0.0f, 0.0f);

            this.ReserveWidthRight(width1, ref pos);
            this.ReserveWidthRight(num1 * 5f, ref pos);
            this.DoToolButtons(this.GetThickArea(pos));
            this.ReserveWidthRight(width2, ref pos);
            this.ReserveWidthRight(num2 * 2f, ref pos);
            this.DoPivotButtons(this.GetThinArea(pos));
            pos = new Rect((float)(((double)this.position.width - 100.0) / 2.0), 0.0f, 140f, 0.0f);
            GUILayout.BeginArea(this.GetThickArea(pos));
            GUILayout.BeginHorizontal();
            this.DoPlayButtons(willChangePlaymode);
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
            pos = new Rect(this.position.width, 0.0f, 0.0f, 0.0f);
            this.ReserveWidthLeft(width1, ref pos);
            this.ReserveWidthLeft(width3, ref pos);
            this.DoLayoutDropDown(this.GetThinArea(pos));
            this.ReserveWidthLeft(width1, ref pos);
            this.ReserveWidthLeft(width3, ref pos);
            this.DoLayersDropDown(this.GetThinArea(pos));
            this.ReserveWidthLeft(width2, ref pos);
            this.ReserveWidthLeft(width3, ref pos);
            if (EditorGUI.ButtonMouseDown(this.GetThinArea(pos), new GUIContent("Account"), FocusType.Passive, (GUIStyle)"Dropdown"))
            {
                this.ShowUserMenu(this.GetThinArea(pos));
            }
            this.ReserveWidthLeft(width1, ref pos);
            this.ReserveWidthLeft(32f, ref pos);
            if (GUI.Button(this.GetThinArea(pos), Toolbar.s_CloudIcon, (GUIStyle)"Button"))
            {
                UnityConnectServiceCollection.instance.ShowService("Hub", true);
            }
            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI((GUIView)this);
        }
示例#4
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);
        }
示例#5
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;
        }
示例#6
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);
        }
        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);
        }
示例#8
0
        private void OnGUI()
        {
            Toolbar.InitializeToolIcons();
            bool isPlayingOrWillChangePlaymode = EditorApplication.isPlayingOrWillChangePlaymode;

            if (isPlayingOrWillChangePlaymode)
            {
                GUI.color = HostView.kPlayModeDarken;
            }
            GUIStyle gUIStyle = "AppToolbar";

            if (Event.current.type == EventType.Repaint)
            {
                gUIStyle.Draw(new Rect(0f, 0f, base.position.width, base.position.height), false, false, false, false);
            }
            this.DoToolButtons();
            float num  = 100f;
            float num2 = (base.position.width - num) / 2f;

            num2 = Mathf.Max(num2, 373f);
            GUILayout.BeginArea(new Rect(num2, 5f, 120f, 24f));
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.DoPlayButtons(isPlayingOrWillChangePlaymode);
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
            float num3 = 220f;

            num2 = base.position.width - num3;
            num2 = Mathf.Max(num2, 440f);
            GUILayout.BeginArea(new Rect(num2, 7f, base.position.width - num2 - 10f, 24f));
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.DoLayersDropDown();
            GUILayout.Space(6f);
            this.DoLayoutDropDown();
            GUILayout.EndArea();
            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
示例#9
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);
        }
示例#10
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);
        }
示例#11
0
        public void OldOnGUI()
        {
            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.rootView.GetType() != typeof(MainView))
            {
                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();
                }
            }
            Rect rect = this.background.margin.Remove(new Rect(0f, 0f, base.position.width, base.position.height));

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

            if (windowPosition.x == 0f)
            {
                rect.x     -= num2;
                rect.width += num2;
            }
            if (windowPosition.xMax == base.window.position.width)
            {
                rect.width += num2;
            }
            if (windowPosition.yMax == base.window.position.height)
            {
                rect.height += ((!flag) ? 2f : 2f);
            }
            if (Event.current.type == EventType.Repaint)
            {
                this.background.Draw(rect, GUIContent.none, 0);
            }
            if (this.tabStyle == null)
            {
                this.tabStyle = "dragtab";
            }
            if (this.m_Panes.Count > 0)
            {
                HostView.BeginOffsetArea(new Rect(rect.x + 2f, rect.y + 17f, rect.width - 4f, rect.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;
                HostView.EndOffsetArea();
            }
            this.DragTab(new Rect(rect.x + 1f, rect.y, rect.width - 40f, 17f), this.tabStyle);
            this.tabStyle = "dragtab";
            base.ShowGenericMenu();
            if (this.m_Panes.Count > 0)
            {
                base.InvokeOnGUI(rect);
            }
            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
示例#12
0
        protected override void OldOnGUI()
        {
            const float space = 8;
            const float standardButtonWidth = 32;
            const float dropdownWidth       = 80;
            const float playPauseStopWidth  = 140;

            InitializeToolIcons();

            bool isOrWillEnterPlaymode = EditorApplication.isPlayingOrWillChangePlaymode;

            GUI.color = isOrWillEnterPlaymode ? HostView.kPlayModeDarken : Color.white;

            if (Event.current.type == EventType.Repaint)
            {
                Styles.appToolbar.Draw(new Rect(0, 0, position.width, position.height), false, false, false, false);
            }

            // Position left aligned controls controls - start from left to right.
            Rect pos = new Rect(0, 0, 0, 0);

            ReserveWidthRight(space, ref pos);

            ReserveWidthRight(standardButtonWidth * s_ShownToolIcons.Length, ref pos);
            DoToolButtons(EditorToolGUI.GetThickArea(pos));

            ReserveWidthRight(space, ref pos);

            int playModeControlsStart = Mathf.RoundToInt((position.width - playPauseStopWidth) / 2);

            pos.x += pos.width;
            const float pivotButtonsWidth = 128;

            pos.width = pivotButtonsWidth;
            DoToolSettings(EditorToolGUI.GetThickArea(pos));

            ReserveWidthRight(standardButtonWidth, ref pos);
            DoSnapButtons(EditorToolGUI.GetThickArea(pos));

            // Position centered controls.
            pos = new Rect(playModeControlsStart, 0, 240, 0);

            if (ModeService.HasCapability(ModeCapability.Playbar, true))
            {
                GUILayout.BeginArea(EditorToolGUI.GetThickArea(pos));
                GUILayout.BeginHorizontal();
                {
                    if (!ModeService.Execute("gui_playbar", isOrWillEnterPlaymode))
                    {
                        DoPlayButtons(isOrWillEnterPlaymode);
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }

            // Position right aligned controls controls - start from right to left.
            pos = new Rect(position.width, 0, 0, 0);

            // Right spacing side
            ReserveWidthLeft(space, ref pos);
            ReserveWidthLeft(dropdownWidth, ref pos);

            if (ModeService.HasCapability(ModeCapability.LayoutWindowMenu, true))
            {
                DoLayoutDropDown(EditorToolGUI.GetThinArea(pos));
            }

            if (ModeService.HasCapability(ModeCapability.Layers, true))
            {
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(dropdownWidth, ref pos);
                DoLayersDropDown(EditorToolGUI.GetThinArea(pos));
            }

            if (Unity.MPE.ProcessService.level == Unity.MPE.ProcessLevel.UMP_MASTER)
            {
                ReserveWidthLeft(space, ref pos);

                ReserveWidthLeft(dropdownWidth, ref pos);
                if (EditorGUI.DropdownButton(EditorToolGUI.GetThinArea(pos), s_AccountContent, FocusType.Passive, Styles.dropdown))
                {
                    ShowUserMenu(EditorToolGUI.GetThinArea(pos));
                }

                ReserveWidthLeft(space, ref pos);

                ReserveWidthLeft(standardButtonWidth, ref pos);
                if (GUI.Button(EditorToolGUI.GetThinArea(pos), s_CloudIcon, Styles.command))
                {
                    ServicesEditorWindow.ShowServicesWindow();
                }
            }

            foreach (SubToolbar subToolbar in s_SubToolbars)
            {
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(subToolbar.Width, ref pos);
                subToolbar.OnGUI(EditorToolGUI.GetThinArea(pos));
            }

            if (Unsupported.IsDeveloperBuild() && ModeService.hasSwitchableModes)
            {
                EditorGUI.BeginChangeCheck();
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(dropdownWidth, ref pos);
                var selectedModeIndex = EditorGUI.Popup(EditorToolGUI.GetThinArea(pos), ModeService.currentIndex, ModeService.modeNames, Styles.dropdown);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorApplication.delayCall += () => ModeService.ChangeModeByIndex(selectedModeIndex);
                    GUIUtility.ExitGUI();
                }
            }

            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
示例#13
0
        protected override void OldOnGUI()
        {
            float space               = 10;
            float largeSpace          = 20;
            float standardButtonWidth = 32;
            float pivotButtonWidth    = 64;
            float dropdownWidth       = 80;

            InitializeToolIcons();

            bool isOrWillEnterPlaymode = EditorApplication.isPlayingOrWillChangePlaymode;

            if (isOrWillEnterPlaymode)
            {
                GUI.color = HostView.kPlayModeDarken;
            }

            if (Event.current.type == EventType.Repaint)
            {
                Styles.appToolbar.Draw(new Rect(0, 0, position.width, position.height), false, false, false, false);
            }

            // Position left aligned controls controls - start from left to right.
            Rect pos = new Rect(0, 0, 0, 0);

            ReserveWidthRight(space, ref pos);

            ReserveWidthRight(standardButtonWidth * s_ShownToolIcons.Length, ref pos);
            DoToolButtons(GetThickArea(pos));

            ReserveWidthRight(largeSpace, ref pos);

            ReserveWidthRight(pivotButtonWidth * 2, ref pos);
            DoPivotButtons(GetThinArea(pos));

            // Position centered controls.
            float playPauseStopWidth = 100;

            pos = new Rect(Mathf.RoundToInt((position.width - playPauseStopWidth) / 2), 0, 140, 0);

            GUILayout.BeginArea(GetThickArea(pos));
            GUILayout.BeginHorizontal();
            {
                DoPlayButtons(isOrWillEnterPlaymode);
            }
            GUILayout.EndHorizontal();
            GUILayout.EndArea();

            // Position right aligned controls controls - start from right to left.
            pos = new Rect(position.width, 0, 0, 0);

            // Right spacing side
            ReserveWidthLeft(space, ref pos);

            ReserveWidthLeft(dropdownWidth, ref pos);
            DoLayoutDropDown(GetThinArea(pos));

            ReserveWidthLeft(space, ref pos);

            ReserveWidthLeft(dropdownWidth, ref pos);
            DoLayersDropDown(GetThinArea(pos));

            ReserveWidthLeft(largeSpace, ref pos);

            ReserveWidthLeft(dropdownWidth, ref pos);
            if (EditorGUI.DropdownButton(GetThinArea(pos), s_AccountContent, FocusType.Passive, Styles.dropdown))
            {
                ShowUserMenu(GetThinArea(pos));
            }


            ReserveWidthLeft(space, ref pos);

            ReserveWidthLeft(32, ref pos);
            if (GUI.Button(GetThinArea(pos), s_CloudIcon))
            {
                UnityConnectServiceCollection.instance.ShowService(HubAccess.kServiceName, true, "cloud_icon"); // Should show hub when it's done
            }
            ReserveWidthLeft(space, ref pos);
            ReserveWidthLeft(kCollabButtonWidth, ref pos);
            DoCollabDropDown(GetThinArea(pos));


            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
示例#14
0
        protected override void OldOnGUI()
        {
            ClearBackground();
            // Call reset GUI state as first thing so GUI.color is correct when drawing window decoration.
            EditorGUIUtility.ResetGUIState();

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

            // Add CursorRects
            SplitView sp = parent as SplitView;

            if (Event.current.type == EventType.Repaint && sp)
            {
                View view = this;
                while (sp)
                {
                    int id = sp.controlID;

                    if (id == GUIUtility.hotControl || GUIUtility.hotControl == 0)
                    {
                        int idx = sp.IndexOfChild(view);
                        if (sp.vertical)
                        {
                            if (idx != 0)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(0, 0, position.width, SplitView.kGrabDist), MouseCursor.SplitResizeUpDown, id);
                            }
                            if (idx != sp.children.Length - 1)
                            {
                                EditorGUIUtility.AddCursorRect(
                                    new Rect(0, position.height - SplitView.kGrabDist, position.width, SplitView.kGrabDist),
                                    MouseCursor.SplitResizeUpDown, id);
                            }
                        }
                        else // horizontal
                        {
                            if (idx != 0)
                            {
                                EditorGUIUtility.AddCursorRect(new Rect(0, 0, SplitView.kGrabDist, position.height), MouseCursor.SplitResizeLeftRight,
                                                               id);
                            }
                            if (idx != sp.children.Length - 1)
                            {
                                EditorGUIUtility.AddCursorRect(
                                    new Rect(position.width - SplitView.kGrabDist, 0, SplitView.kGrabDist, position.height),
                                    MouseCursor.SplitResizeLeftRight, id);
                            }
                        }
                    }

                    view = sp;
                    sp   = sp.parent as SplitView;
                }

                // reset
                sp = parent as SplitView;
            }
            bool customBorder = false;

            if (window.rootView.GetType() != typeof(MainView))
            {
                customBorder = true;
                if (windowPosition.y == 0)
                {
                    background = "dockareaStandalone";
                }
                else
                {
                    background = "dockarea";
                }
            }
            else
            {
                background = "dockarea";
            }

            if (sp)
            {
                Event e = new Event(Event.current);
                e.mousePosition += new Vector2(position.x, position.y);
                sp.SplitGUI(e);
                if (e.type == EventType.Used)
                {
                    Event.current.Use();
                }
            }
            Rect r = background.margin.Remove(new Rect(0, 0, position.width, position.height));

            r.x = background.margin.left;
            r.y = background.margin.top;
            Rect  wPos       = windowPosition;
            float sideBorder = kSideBorders;

            if (wPos.x == 0)
            {
                r.x     -= sideBorder;
                r.width += sideBorder;
            }
            if (wPos.xMax == window.position.width)
            {
                r.width += sideBorder;
            }

            if (wPos.yMax == window.position.height)
            {
                r.height += customBorder ? 2f : kBottomBorders;
            }

            if (Event.current.type == EventType.Repaint)
            {
                background.Draw(r, GUIContent.none, 0);
            }

            if (tabStyle == null)
            {
                tabStyle = "dragtab";
            }

            if (m_Panes.Count > 0)
            {
                // Set up the pane's position, so its GUI can use this

                // Contents:
                // scroll it by -1, -1 so we top & left 1px gets culled (they are drawn already by the us, so we want to
                // not have them here (thing that the default skin relies on)
                BeginOffsetArea(new Rect(r.x + 2, r.y + kTabHeight, r.width - 4, r.height - kTabHeight - 2), GUIContent.none, "TabWindowBackground");

                Vector2 basePos = GUIUtility.GUIToScreenPoint(Vector2.zero);
                Rect    p       = borderSize.Remove(position);
                p.x = basePos.x;
                p.y = basePos.y;

                if (selected >= 0 && selected < m_Panes.Count)
                {
                    m_Panes[selected].m_Pos = p;
                }

                EndOffsetArea();
            }

            DragTab(new Rect(r.x + 1, r.y, r.width - kWindowButtonsWidth, kTabHeight), tabStyle);

            // TODO: Make this nice - right now this is meant to be overridden by Panes in Layout if they want something else. Inspector does this
            tabStyle = "dragtab";

            ShowGenericMenu();

            if (m_Panes.Count > 0)
            {
                InvokeOnGUI(r);
            }

            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }
示例#15
0
        protected override void OldOnGUI()
        {
            const float space               = 10;
            const float largeSpace          = 20;
            const float standardButtonWidth = 32;
            const float dropdownWidth       = 80;
            const float playPauseStopWidth  = 140;

            InitializeToolIcons();

            bool isOrWillEnterPlaymode = EditorApplication.isPlayingOrWillChangePlaymode;

            GUI.color = isOrWillEnterPlaymode ? HostView.kPlayModeDarken : Color.white;

            if (Event.current.type == EventType.Repaint)
            {
                Styles.appToolbar.Draw(new Rect(0, 0, position.width, position.height), false, false, false, false);
            }

            // Position left aligned controls controls - start from left to right.
            Rect pos = new Rect(0, 0, 0, 0);

            ReserveWidthRight(space, ref pos);

            ReserveWidthRight(standardButtonWidth * s_ShownToolIcons.Length, ref pos);
            DoToolButtons(EditorToolGUI.GetThickArea(pos));

            ReserveWidthRight(largeSpace, ref pos);

            int playModeControlsStart = Mathf.RoundToInt((position.width - playPauseStopWidth) / 2);

            pos.x    += pos.width;
            pos.width = (playModeControlsStart - pos.x) - largeSpace;
            DoToolSettings(EditorToolGUI.GetThickArea(pos));

            // Position centered controls.
            pos = new Rect(playModeControlsStart, 0, 240, 0);

            if (ModeService.HasCapability(ModeCapability.Playbar, true))
            {
                GUILayout.BeginArea(EditorToolGUI.GetThickArea(pos));
                GUILayout.BeginHorizontal();
                {
                    if (!ModeService.Execute("gui_playbar", isOrWillEnterPlaymode))
                    {
                        DoPlayButtons(isOrWillEnterPlaymode);
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }

            // Position right aligned controls controls - start from right to left.
            pos = new Rect(position.width, 0, 0, 0);

            // Right spacing side
            ReserveWidthLeft(space, ref pos);
            ReserveWidthLeft(dropdownWidth, ref pos);
            DoLayoutDropDown(EditorToolGUI.GetThinArea(pos));

            if (ModeService.HasCapability(ModeCapability.Layers, true))
            {
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(dropdownWidth, ref pos);
                DoLayersDropDown(EditorToolGUI.GetThinArea(pos));
            }

            ReserveWidthLeft(space, ref pos);

            ReserveWidthLeft(dropdownWidth, ref pos);
            if (EditorGUI.DropdownButton(EditorToolGUI.GetThinArea(pos), s_AccountContent, FocusType.Passive, Styles.dropdown))
            {
                ShowUserMenu(EditorToolGUI.GetThinArea(pos));
            }

            ReserveWidthLeft(space, ref pos);

            ReserveWidthLeft(32, ref pos);
            if (GUI.Button(EditorToolGUI.GetThinArea(pos), s_CloudIcon))
            {
                UnityConnectServiceCollection.instance.ShowService(HubAccess.kServiceName, true, "cloud_icon"); // Should show hub when it's done
            }
            foreach (SubToolbar subToolbar in s_SubToolbars)
            {
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(subToolbar.Width, ref pos);
                subToolbar.OnGUI(EditorToolGUI.GetThinArea(pos));
            }


            if (ModeService.modeCount > 1)
            {
                EditorGUI.BeginChangeCheck();
                ReserveWidthLeft(space, ref pos);
                ReserveWidthLeft(dropdownWidth, ref pos);
                var selectedModeIndex = EditorGUI.Popup(EditorToolGUI.GetThinArea(pos), ModeService.currentIndex, ModeService.modeNames, Styles.dropdown);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorApplication.delayCall += () => ModeService.ChangeModeByIndex(selectedModeIndex);
                    GUIUtility.ExitGUI();
                }
            }

            EditorGUI.ShowRepaints();
            Highlighter.ControlHighlightGUI(this);
        }