SetAllowCursorHide() private method

private SetAllowCursorHide ( bool allow ) : void
allow bool
return void
示例#1
0
 private void OnLostFocus()
 {
     if (!EditorApplicationLayout.IsInitializingPlaymodeLayout())
     {
         Unsupported.SetAllowCursorLock(false);
         Unsupported.SetAllowCursorHide(false);
     }
     InternalEditorUtility.OnGameViewFocus(false);
 }
示例#2
0
 protected void AllowCursorLockAndHide(bool enable)
 {
     Unsupported.SetAllowCursorLock(enable, Unsupported.DisallowCursorLockReasons.Other);
     Unsupported.SetAllowCursorHide(enable);
 }
示例#3
0
 private void AllowCursorLockAndHide(bool enable)
 {
     Unsupported.SetAllowCursorLock(enable);
     Unsupported.SetAllowCursorHide(enable);
 }
示例#4
0
        private void OnGUI()
        {
            if (GameView.s_GizmoButtonStyle == null)
            {
                GameView.s_GizmoButtonStyle                 = "GV Gizmo DropDown";
                GameView.s_ResolutionWarningStyle           = new GUIStyle("PreOverlayLabel");
                GameView.s_ResolutionWarningStyle.alignment = TextAnchor.UpperLeft;
                GameView.s_ResolutionWarningStyle.padding   = new RectOffset(6, 6, 1, 1);
            }
            this.DoToolbarGUI();
            Rect gameViewRenderRect = this.gameViewRenderRect;
            bool fitsInsideRect;
            Rect constrainedGameViewRenderRect = GameView.GetConstrainedGameViewRenderRect(gameViewRenderRect, this.selectedSizeIndex, out fitsInsideRect);
            Rect rect = GUIClip.Unclip(constrainedGameViewRenderRect);

            base.SetInternalGameViewRect(rect);
            EditorGUIUtility.AddCursorRect(constrainedGameViewRenderRect, MouseCursor.CustomCursor);
            EventType type = Event.current.type;

            if (type == EventType.MouseDown && gameViewRenderRect.Contains(Event.current.mousePosition))
            {
                Unsupported.SetAllowCursorLock(true);
                Unsupported.SetAllowCursorHide(true);
            }
            else
            {
                if (type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape)
                {
                    Unsupported.SetAllowCursorLock(false);
                }
            }
            if (type == EventType.Repaint)
            {
                if (!this.currentGameViewSize.isFreeAspectRatio || !InternalEditorUtility.HasFullscreenCamera())
                {
                    GUI.Box(gameViewRenderRect, GUIContent.none, "GameViewBackground");
                }
                Vector2 s_EditorScreenPointOffset = GUIUtility.s_EditorScreenPointOffset;
                GUIUtility.s_EditorScreenPointOffset = Vector2.zero;
                SavedGUIState savedGUIState = SavedGUIState.Create();
                if (Display.MultiDisplayLicense())
                {
                    EditorGUIUtility.RenderGameViewCameras(rect, this.m_TargetDisplay, this.m_Gizmos, true);
                }
                else
                {
                    EditorGUIUtility.RenderGameViewCameras(rect, 0, this.m_Gizmos, true);
                }
                savedGUIState.ApplyAndForget();
                GUIUtility.s_EditorScreenPointOffset = s_EditorScreenPointOffset;
            }
            else
            {
                if (type != EventType.Layout && type != EventType.Used)
                {
                    if (WindowLayout.s_MaximizeKey.activated && (!EditorApplication.isPlaying || EditorApplication.isPaused))
                    {
                        return;
                    }
                    bool flag = constrainedGameViewRenderRect.Contains(Event.current.mousePosition);
                    if (Event.current.rawType == EventType.MouseDown && !flag)
                    {
                        return;
                    }
                    Event.current.mousePosition = new Vector2(Event.current.mousePosition.x - constrainedGameViewRenderRect.x, Event.current.mousePosition.y - constrainedGameViewRenderRect.y);
                    EditorGUIUtility.QueueGameViewInputEvent(Event.current);
                    bool flag2 = true;
                    if (Event.current.rawType == EventType.MouseUp && !flag)
                    {
                        flag2 = false;
                    }
                    if (type == EventType.ExecuteCommand || type == EventType.ValidateCommand)
                    {
                        flag2 = false;
                    }
                    if (flag2)
                    {
                        Event.current.Use();
                    }
                    else
                    {
                        Event.current.mousePosition = new Vector2(Event.current.mousePosition.x + constrainedGameViewRenderRect.x, Event.current.mousePosition.y + constrainedGameViewRenderRect.y);
                    }
                }
            }
            this.ShowResolutionWarning(new Rect(gameViewRenderRect.x, gameViewRenderRect.y, 200f, 20f), fitsInsideRect, constrainedGameViewRenderRect.size);
            if (this.m_Stats)
            {
                GameViewGUI.GameViewStatsGUI();
            }
        }