示例#1
0
        private static void UncheckFocusToggleOnAllViews()
        {
            List <PlayModeView> playViewList;

            WindowLayout.ShowAppropriateViewOnEnterExitPlaymodeList(true, out playViewList);
            foreach (PlayModeView playView in playViewList)
            {
                if (playView is IGameViewOnPlayMenuUser)
                {
                    ((IGameViewOnPlayMenuUser)playView).playFocused = false;
                }
            }
        }
示例#2
0
        private bool IsAnyViewInMaximizeMode()
        {
            List <PlayModeView> playViewList;

            WindowLayout.ShowAppropriateViewOnEnterExitPlaymodeList(true, out playViewList);
            foreach (PlayModeView playView in playViewList)
            {
                if (playView.enterPlayModeBehavior == PlayModeView.EnterPlayModeBehavior.PlayMaximized)
                {
                    SetFocusedToggle(playView as IGameViewOnPlayMenuUser, true);
                    return(true);
                }
            }
            return(false);
        }
        private void OnPlayFocusedToggleChanged(bool newValue)
        {
            List <PlayModeView> playViewList;

            WindowLayout.ShowAppropriateViewOnEnterExitPlaymodeList(true, out playViewList);

            foreach (PlayModeView playView in playViewList)
            {
                if (playView != (m_GameView as PlayModeView))
                {
                    ((IGameViewOnPlayMenuUser)playView).playFocused = false;
                }
            }

            m_GameView.playFocused = newValue;
        }
        static internal void InitPlaymodeLayout()
        {
            InitializePlaymodeViewList();
            WindowLayout.ShowAppropriateViewOnEnterExitPlaymodeList(true, out m_PlayModeViewList);

            var fullscreenDetected = false;
            var monitorNames       = EditorFullscreenController.GetConnectedDisplayNames();

            foreach (var playModeView in m_PlayModeViewList)
            {
                if (playModeView == null)
                {
                    continue;
                }

                if (playModeView.fullscreenMonitorIdx >= monitorNames.Length)
                {
                    continue;
                }

                if (playModeView.enterPlayModeBehavior == PlayModeView.EnterPlayModeBehavior.PlayFullscreen)
                {
                    EditorFullscreenController.SetSettingsForCurrentDisplay(playModeView.fullscreenMonitorIdx);
                    EditorFullscreenController.isFullscreenOnPlay           = true;
                    EditorFullscreenController.fullscreenDisplayId          = playModeView.fullscreenMonitorIdx;
                    EditorFullscreenController.isToolbarEnabledOnFullscreen = false;
                    EditorFullscreenController.targetDisplayID = playModeView.targetDisplay;

                    if (playModeView.m_Parent is DockArea dockArea && dockArea.actualView is GameView gv)
                    {
                        playModeView.m_Parent.EnableVSync(gv.vSyncEnabled);
                        EditorFullscreenController.enableVSync       = gv.vSyncEnabled;
                        EditorFullscreenController.selectedSizeIndex = gv.selectedSizeIndex;
                    }
                    fullscreenDetected = true;
                }
                else if (!fullscreenDetected)
                {
                    EditorFullscreenController.isFullscreenOnPlay = false;
                }

                if (playModeView.enterPlayModeBehavior == PlayModeView.EnterPlayModeBehavior.PlayMaximized)
                {
                    if (playModeView.m_Parent is DockArea dockArea)
                    {
                        m_MaximizePending = WindowLayout.MaximizePrepare(dockArea.actualView);
                        var gv = dockArea.actualView as GameView;
                        if (gv != null)
                        {
                            playModeView.m_Parent.EnableVSync(gv.vSyncEnabled);
                        }
                    }
                }

                EditorFullscreenController.OnEnterPlaymode();

                if (!EditorFullscreenController.isFullscreenOnPlay)
                {
                    playModeView.m_Parent.SetAsStartView();
                    playModeView.m_Parent.SetAsLastPlayModeView();

                    if (playModeView.maximized)
                    {
                        playModeView.m_Parent.Focus();
                    }

                    if (playModeView is IGameViewOnPlayMenuUser)
                    {
                        if (((IGameViewOnPlayMenuUser)playModeView).playFocused)
                        {
                            playModeView.m_Parent.Focus();
                        }
                    }
                }
                Toolbar.RepaintToolbar();
            }
        }