Пример #1
0
        protected virtual void OnEnable()
        {
            if (CurrentOpenWindow)
            {
                CurrentOpenWindow.Repaint();
            }

            FullscreenPreferences.ToolbarVisible.OnValueSaved += SetToolbarStatus;
        }
Пример #2
0
    /// <summary>
    /// Show the window in fullscreen
    /// </summary>
    /// <param name="reference">The window that will be cloned, must be the inherited from the type passed in the constructor</param>
    public void Open(Object reference)
    {
        if (IsOpen)
        {
            return;
        }

        CloseAll();

        if (Type == containerWindowType || Type == gameViewType)
        {
            SaveLayout();
        }

        if (reference)
        {
            if (reference.GetType() == Type || reference.GetType().IsSubclassOf(Type))
            {
                CurrentOpenObject = Object.Instantiate(reference);
            }
            else
            {
                Debug.LogWarning("Reference window is not inherited from " + Type + ", it will be ignored");
            }
        }

        if (!CurrentOpenObject)
        {
            CurrentOpenObject = ScriptableObject.CreateInstance(Type);
        }

        CurrentOpenObject.name = Name;
        Type.GetMethod(SHOW_METHOD, FULL_BINDING).Invoke(CurrentOpenObject, null);

        var rect = GetFullscreenRect();

        if (!ShowToolbar && (CurrentOpenObject is SceneView || CurrentOpenObject.GetType() == gameViewType))
        {
            //Move the top border of the window 17 pixels up, so the toolbar will be hidden (you can still click on it if you move your mouse too fast).
            rect.yMin -= 17f;
            CurrentOpenWindow.maximized = true;
            //Set minimum and maximum size to the same, so the user can't resize the window dragging the borders.
            CurrentOpenWindow.maxSize = rect.size;
            CurrentOpenWindow.minSize = rect.size;
        }

        Rect = rect;

        if (CurrentOpenWindow)
        {
            CurrentOpenWindow.Focus();
        }

        InternalEditorUtility.RepaintAllViews(); //Prevents the editor from being completely black when switching fullscreen mode of main window.
        InternalEditorUtility.RepaintAllViews(); //But it won't work every time, so we call it again and hope it works.
    }
Пример #3
0
        /// <summary>
        /// Focus the window associated with this fullscreen view if there is any.
        /// </summary>
        public virtual void Focus()
        {
            if (!CurrentOpenWindow)
            {
                return;
            }

            CurrentOpenWindow.Focus();
            FullscreenUtility.WaitFrames(2, CurrentOpenWindow.Focus);
        }