public static void Attach(EditorWindow moveWindow, EditorWindow attachToWindow)
        {
            if (attachToWindow == null)
            {
                return;
            }
            if (moveWindow == attachToWindow)
            {
                return;
            }

            var attach          = new UnityEditorEditorWindow(attachToWindow);
            var attachContainer = new UnityEditorContainerWindow(attach.dockArea.window);

            if (attachContainer.m_ShowMode != 0 && attachContainer.m_ShowMode != 4)
            {
                return;
            }

            var move          = new UnityEditorEditorWindow(moveWindow);
            var moveContainer = new UnityEditorContainerWindow(move.dockArea.window);

            if (moveContainer.m_ShowMode != 0 && attachContainer.m_ShowMode != 4)
            {
                return;
            }

            move.dockArea.RemoveTab(moveWindow, true, false);

            attach.dockArea.AddTab(moveWindow, false);

            moveWindow.Show();
        }
Exemple #2
0
        public static EditorWindow CreateWindow(Type windowT, string title, params Type[] desiredDockNextTo)
        {
            EditorWindow t    = (EditorWindow)ScriptableObject.CreateInstance(windowT);
            bool         flag = title != null;

            if (flag)
            {
                t.titleContent = new GUIContent(title);
            }
            EditorWindow result;

            for (int i = 0; i < desiredDockNextTo.Length; i++)
            {
                Type desired = desiredDockNextTo[i];

                foreach (var _containerWindow in UnityEditorContainerWindow.windows)
                {
                    var containerWindow = new UnityEditorContainerWindow(_containerWindow);

                    var rootView = new UnityEditorView(containerWindow.rootView);                      //R.Property( "rootView", "UnityEditor.ContainerWindow" ).GetValue( containerWindow );

                    foreach (var view in rootView.allChildren)
                    {
                        if (view == null)
                        {
                            continue;
                        }
                        if (view.GetType() != UnityTypes.UnityEditor_DockArea)
                        {
                            continue;
                        }

                        var dockarea = new UnityEditorDockArea(view);
                        var arg_B9_0 = dockarea.m_Panes;
                        if (arg_B9_0 == null)
                        {
                            continue;
                        }

                        bool flag3 = arg_B9_0.Any(x => x.GetType() == desired);
                        if (flag3)
                        {
                            dockarea.AddTab(t, true);
                            result = t;
                            return(result);
                        }
                        //Debug.Log( arg_B9_0.ToString() );
                    }
                }
            }
            t.Show();
            result = t;
            return(result);
        }