示例#1
0
        internal static EditorWindow ShowAppropriateViewOnEnterExitPlaymode(bool entering)
        {
            if (WindowFocusState.instance.m_CurrentlyInPlayMode == entering)
            {
                return(null);
            }
            WindowFocusState.instance.m_CurrentlyInPlayMode = entering;
            EditorWindow maximizedWindow = WindowLayout.GetMaximizedWindow();

            if (entering)
            {
                WindowFocusState.instance.m_WasMaximizedBeforePlay = (maximizedWindow != null);
                if (maximizedWindow != null)
                {
                    return(maximizedWindow);
                }
            }
            else
            {
                if (WindowFocusState.instance.m_WasMaximizedBeforePlay)
                {
                    return(maximizedWindow);
                }
            }
            if (maximizedWindow)
            {
                WindowLayout.Unmaximize(maximizedWindow);
            }
            EditorWindow editorWindow = WindowLayout.TryFocusAppropriateWindow(entering);

            if (editorWindow)
            {
                return(editorWindow);
            }
            if (entering)
            {
                EditorWindow editorWindow2 = WindowLayout.FindEditorWindowOfType(typeof(SceneView));
                GameView     gameView;
                if (editorWindow2 && editorWindow2.m_Parent is DockArea)
                {
                    DockArea dockArea = editorWindow2.m_Parent as DockArea;
                    if (dockArea)
                    {
                        WindowFocusState.instance.m_LastWindowTypeInSameDock = editorWindow2.GetType().ToString();
                        gameView = ScriptableObject.CreateInstance <GameView>();
                        dockArea.AddTab(gameView);
                        return(gameView);
                    }
                }
                gameView = ScriptableObject.CreateInstance <GameView>();
                gameView.Show(true);
                gameView.Focus();
                return(gameView);
            }
            return(editorWindow);
        }
示例#2
0
        internal static EditorWindow ShowAppropriateViewOnEnterExitPlaymode(bool entering)
        {
            if (WindowFocusState.instance.m_CurrentlyInPlayMode == entering)
            {
                return((EditorWindow)null);
            }
            WindowFocusState.instance.m_CurrentlyInPlayMode = entering;
            EditorWindow maximizedWindow = WindowLayout.GetMaximizedWindow();

            if (entering)
            {
                WindowFocusState.instance.m_WasMaximizedBeforePlay = (UnityEngine.Object)maximizedWindow != (UnityEngine.Object)null;
                if ((UnityEngine.Object)maximizedWindow != (UnityEngine.Object)null)
                {
                    return(maximizedWindow);
                }
            }
            else if (WindowFocusState.instance.m_WasMaximizedBeforePlay)
            {
                return(maximizedWindow);
            }
            if ((bool)((UnityEngine.Object)maximizedWindow))
            {
                WindowLayout.Unmaximize(maximizedWindow);
            }
            EditorWindow editorWindow = WindowLayout.TryFocusAppropriateWindow(entering);

            if ((bool)((UnityEngine.Object)editorWindow) || !entering)
            {
                return(editorWindow);
            }
            EditorWindow editorWindowOfType = WindowLayout.FindEditorWindowOfType(typeof(SceneView));

            if ((bool)((UnityEngine.Object)editorWindowOfType) && editorWindowOfType.m_Parent is DockArea)
            {
                DockArea parent = editorWindowOfType.m_Parent as DockArea;
                if ((bool)((UnityEngine.Object)parent))
                {
                    WindowFocusState.instance.m_LastWindowTypeInSameDock = editorWindowOfType.GetType().ToString();
                    GameView instance = ScriptableObject.CreateInstance <GameView>();
                    parent.AddTab((EditorWindow)instance);
                    return((EditorWindow)instance);
                }
            }
            GameView instance1 = ScriptableObject.CreateInstance <GameView>();

            instance1.Show(true);
            instance1.Focus();
            return((EditorWindow)instance1);
        }