Esempio n. 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);
        }
 static internal EditorWindow GetMaximizedWindow()
 {
     UnityObject[] maximized = Resources.FindObjectsOfTypeAll(typeof(MaximizedHostView));
     if (maximized.Length != 0)
     {
         MaximizedHostView maximizedView = maximized[0] as MaximizedHostView;
         if (maximizedView.actualView)
         {
             return(maximizedView.actualView);
         }
     }
     return(null);
 }
Esempio n. 3
0
 internal static EditorWindow GetMaximizedWindow()
 {
     UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll(typeof(MaximizedHostView));
     if (array.Length != 0)
     {
         MaximizedHostView maximizedHostView = array[0] as MaximizedHostView;
         if (maximizedHostView.actualView)
         {
             return(maximizedHostView.actualView);
         }
     }
     return(null);
 }
Esempio n. 4
0
 internal static EditorWindow GetMaximizedWindow()
 {
     UnityEngine.Object[] objArray = UnityEngine.Resources.FindObjectsOfTypeAll(typeof(MaximizedHostView));
     if (objArray.Length != 0)
     {
         MaximizedHostView view = objArray[0] as MaximizedHostView;
         if (view.actualView != null)
         {
             return view.actualView;
         }
     }
     return null;
 }
Esempio n. 5
0
 internal static EditorWindow GetMaximizedWindow()
 {
     UnityEngine.Object[] objectsOfTypeAll = Resources.FindObjectsOfTypeAll(typeof(MaximizedHostView));
     if (objectsOfTypeAll.Length != 0)
     {
         MaximizedHostView maximizedHostView = objectsOfTypeAll[0] as MaximizedHostView;
         if ((bool)((UnityEngine.Object)maximizedHostView.actualView))
         {
             return(maximizedHostView.actualView);
         }
     }
     return((EditorWindow)null);
 }
Esempio n. 6
0
 public static bool MaximizePrepare(EditorWindow win)
 {
     View parent = win.m_Parent.parent;
     View splitview = parent;
     while ((parent != null) && (parent is SplitView))
     {
         splitview = parent;
         parent = parent.parent;
     }
     DockArea area = win.m_Parent as DockArea;
     if (area == null)
     {
         return false;
     }
     if (parent == null)
     {
         return false;
     }
     MainView view3 = splitview.parent as MainView;
     if (view3 == null)
     {
         return false;
     }
     if (win.m_Parent.window == null)
     {
         return false;
     }
     int index = area.m_Panes.IndexOf(win);
     if (index == -1)
     {
         return false;
     }
     area.selected = index;
     SaveSplitViewAndChildren(splitview, win, Path.Combine(layoutsProjectPath, "CurrentMaximizeLayout.dwlt"));
     area.actualView = null;
     area.m_Panes[index] = null;
     MaximizedHostView child = ScriptableObject.CreateInstance<MaximizedHostView>();
     int idx = parent.IndexOfChild(splitview);
     Rect position = splitview.position;
     parent.RemoveChild(splitview);
     parent.AddChild(child, idx);
     child.actualView = win;
     child.position = position;
     UnityEngine.Object.DestroyImmediate(splitview, true);
     return true;
 }
Esempio n. 7
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);
        }
Esempio n. 8
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);
        }
        public static bool MaximizePrepare(EditorWindow win)
        {
            // Find Root SplitView
            View itor      = win.m_Parent.parent;
            View rootSplit = itor;

            while (itor != null && itor is SplitView)
            {
                rootSplit = itor;
                itor      = itor.parent;
            }

            // Make sure it has a dockarea
            DockArea dockArea = win.m_Parent as DockArea;

            if (dockArea == null)
            {
                return(false);
            }

            if (itor == null)
            {
                return(false);
            }

            var mainView = rootSplit.parent as MainView;

            if (mainView == null)
            {
                return(false);
            }

            ContainerWindow parentWindow = win.m_Parent.window;

            if (parentWindow == null)
            {
                return(false);
            }

            int oldDockIndex = dockArea.m_Panes.IndexOf(win);

            if (oldDockIndex == -1)
            {
                return(false);
            }

            dockArea.selected = oldDockIndex;

            // Save current state to disk
            SaveSplitViewAndChildren(rootSplit, win, Path.Combine(layoutsProjectPath, kMaximizeRestoreFile));

            // Remove the window from the HostView now in order to invoke OnBecameInvisible before OnBecameVisible
            dockArea.actualView = null;

            dockArea.m_Panes[oldDockIndex] = null;

            MaximizedHostView maximizedHostView = ScriptableObject.CreateInstance <MaximizedHostView>();

            int  i = itor.IndexOfChild(rootSplit);
            Rect p = rootSplit.position;

            itor.RemoveChild(rootSplit);
            itor.AddChild(maximizedHostView, i);

            maximizedHostView.actualView = win;
            maximizedHostView.position   = p; // Must be set after actualView so that value is propagated

            UnityObject.DestroyImmediate(rootSplit, true);

            return(true);
        }