예제 #1
0
        public bool PerformDrop(EditorWindow dropWindow, DropInfo dropInfo, Vector2 screenPos)
        {
            SplitView.ExtraDropInfo extraDropInfo = dropInfo.userData as SplitView.ExtraDropInfo;
            bool rootWindow = extraDropInfo.rootWindow;

            SplitView.ViewEdge edge = extraDropInfo.edge;
            int       num           = extraDropInfo.index;
            Rect      rect          = dropInfo.rect;
            bool      flag          = (edge & SplitView.ViewEdge.TopLeft) != SplitView.ViewEdge.None;
            bool      flag2         = (edge & SplitView.ViewEdge.FitsVertical) != SplitView.ViewEdge.None;
            SplitView splitView;

            if (this.vertical == flag2 || base.children.Length < 2)
            {
                if (!flag)
                {
                    if (rootWindow)
                    {
                        num = base.children.Length;
                    }
                    else
                    {
                        num++;
                    }
                }
                splitView = this;
            }
            else if (rootWindow)
            {
                SplitView splitView2 = ScriptableObject.CreateInstance <SplitView>();
                splitView2.position = base.position;
                if (base.window.rootView == this)
                {
                    base.window.rootView = splitView2;
                }
                else
                {
                    base.parent.AddChild(splitView2, base.parent.IndexOfChild(this));
                }
                splitView2.AddChild(this);
                base.position = new Rect(Vector2.zero, base.position.size);
                num           = ((!flag) ? 1 : 0);
                splitView     = splitView2;
            }
            else
            {
                SplitView splitView3 = ScriptableObject.CreateInstance <SplitView>();
                splitView3.AddChild(base.children[num]);
                this.AddChild(splitView3, num);
                splitView3.position             = splitView3.children[0].position;
                splitView3.children[0].position = new Rect(Vector2.zero, splitView3.position.size);
                num       = ((!flag) ? 1 : 0);
                splitView = splitView3;
            }
            rect.position -= base.screenPosition.position;
            DockArea dockArea = ScriptableObject.CreateInstance <DockArea>();

            splitView.vertical = flag2;
            splitView.MakeRoomForRect(rect);
            splitView.AddChild(dockArea, num);
            dockArea.position = rect;
            DockArea.s_OriginalDragSource.RemoveTab(dropWindow);
            dropWindow.m_Parent = dockArea;
            dockArea.AddTab(dropWindow);
            this.Reflow();
            SplitView.RecalcMinMaxAndReflowAll(this);
            dockArea.MakeVistaDWMHappyDance();
            return(true);
        }