コード例 #1
0
        public static View MaximizePrepare(EditorWindow win)
        {
            View parent = win.m_Parent.parent;
            View view   = parent;

            while (parent != null && parent is SplitView)
            {
                view   = parent;
                parent = parent.parent;
            }
            DockArea dockArea = win.m_Parent as DockArea;

            if (dockArea == null)
            {
                return(null);
            }
            if (parent == null)
            {
                return(null);
            }
            MainWindow x = view.parent as MainWindow;

            if (x == null)
            {
                return(null);
            }
            ContainerWindow window = win.m_Parent.window;

            if (window == null)
            {
                return(null);
            }
            int num = dockArea.m_Panes.IndexOf(win);

            if (num == -1)
            {
                return(null);
            }
            dockArea.selected = num;
            WindowLayout.SaveSplitViewAndChildren(view, win, Path.Combine(WindowLayout.layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
            dockArea.actualView   = null;
            dockArea.m_Panes[num] = null;
            MaximizedHostView maximizedHostView = ScriptableObject.CreateInstance <MaximizedHostView>();
            int  idx      = parent.IndexOfChild(view);
            Rect position = view.position;

            parent.RemoveChild(view);
            parent.AddChild(maximizedHostView, idx);
            maximizedHostView.actualView = win;
            maximizedHostView.position   = position;
            return(view);
        }
コード例 #2
0
        public static View MaximizePrepare(EditorWindow win)
        {
            View parent1 = win.m_Parent.parent;
            View view    = parent1;

            for (; (UnityEngine.Object)parent1 != (UnityEngine.Object)null && parent1 is SplitView; parent1 = parent1.parent)
            {
                view = parent1;
            }
            DockArea parent2 = win.m_Parent as DockArea;

            if ((UnityEngine.Object)parent2 == (UnityEngine.Object)null)
            {
                return((View)null);
            }
            if ((UnityEngine.Object)parent1 == (UnityEngine.Object)null)
            {
                return((View)null);
            }
            if ((UnityEngine.Object)(view.parent as MainWindow) == (UnityEngine.Object)null)
            {
                return((View)null);
            }
            if ((UnityEngine.Object)win.m_Parent.window == (UnityEngine.Object)null)
            {
                return((View)null);
            }
            int index = parent2.m_Panes.IndexOf(win);

            if (index == -1)
            {
                return((View)null);
            }
            parent2.selected = index;
            WindowLayout.SaveSplitViewAndChildren(view, win, Path.Combine(WindowLayout.layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
            parent2.m_Panes[index] = (EditorWindow)null;
            MaximizedHostView instance = ScriptableObject.CreateInstance <MaximizedHostView>();
            int  idx      = parent1.IndexOfChild(view);
            Rect position = view.position;

            parent1.RemoveChild(view);
            parent1.AddChild((View)instance, idx);
            instance.position   = position;
            instance.actualView = win;
            return(view);
        }
コード例 #3
0
        public static bool MaximizePrepare(EditorWindow win)
        {
            View parent = win.m_Parent.parent;
            View view   = parent;

            while (parent != null && parent is SplitView)
            {
                view   = parent;
                parent = parent.parent;
            }
            DockArea dockArea = win.m_Parent as DockArea;
            bool     result;

            if (dockArea == null)
            {
                result = false;
            }
            else if (parent == null)
            {
                result = false;
            }
            else
            {
                MainView x = view.parent as MainView;
                if (x == null)
                {
                    result = false;
                }
                else
                {
                    ContainerWindow window = win.m_Parent.window;
                    if (window == null)
                    {
                        result = false;
                    }
                    else
                    {
                        int num = dockArea.m_Panes.IndexOf(win);
                        if (num == -1)
                        {
                            result = false;
                        }
                        else
                        {
                            dockArea.selected = num;
                            WindowLayout.SaveSplitViewAndChildren(view, win, Path.Combine(WindowLayout.layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
                            dockArea.actualView   = null;
                            dockArea.m_Panes[num] = null;
                            MaximizedHostView maximizedHostView = ScriptableObject.CreateInstance <MaximizedHostView>();
                            int  idx      = parent.IndexOfChild(view);
                            Rect position = view.position;
                            parent.RemoveChild(view);
                            parent.AddChild(maximizedHostView, idx);
                            maximizedHostView.actualView = win;
                            maximizedHostView.position   = position;
                            UnityEngine.Object.DestroyImmediate(view, true);
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }