UnityEditor.SplitView.Cleanup C# (CSharp) Method

Cleanup() public method

public Cleanup ( ) : void
return void
        public void Cleanup()
        {
            SplitView parent = base.parent as SplitView;
            if ((base.children.Length == 1) && (parent != null))
            {
                View child = base.children[0];
                child.position = base.position;
                if (base.parent != null)
                {
                    base.parent.AddChild(child, base.parent.IndexOfChild(this));
                    base.parent.RemoveChild(this);
                    if (parent != null)
                    {
                        parent.Cleanup();
                    }
                    child.position = base.position;
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        Object.DestroyImmediate(this);
                    }
                    return;
                }
                if (child is SplitView)
                {
                    this.RemoveChild(child);
                    base.window.rootView = child;
                    child.position = new Rect(0f, 0f, child.window.position.width, base.window.position.height);
                    child.Reflow();
                    if (!Unsupported.IsDestroyScriptableObject(this))
                    {
                        Object.DestroyImmediate(this);
                    }
                    return;
                }
            }
            if (parent != null)
            {
                parent.Cleanup();
                parent = base.parent as SplitView;
                if ((parent != null) && (parent.vertical == this.vertical))
                {
                    int index = new List<View>(base.parent.children).IndexOf(this);
                    foreach (View view3 in base.children)
                    {
                        parent.AddChild(view3, index++);
                        view3.position = new Rect(base.position.x + view3.position.x, base.position.y + view3.position.y, view3.position.width, view3.position.height);
                    }
                }
            }
            if (base.children.Length == 0)
            {
                if ((base.parent == null) && (base.window != null))
                {
                    base.window.Close();
                }
                else
                {
                    ICleanuppable cleanuppable = base.parent as ICleanuppable;
                    if (base.parent is SplitView)
                    {
                        ((SplitView) base.parent).RemoveChildNice(this);
                        if (!Unsupported.IsDestroyScriptableObject(this))
                        {
                            Object.DestroyImmediate(this, true);
                        }
                    }
                    cleanuppable.Cleanup();
                }
            }
            else
            {
                this.splitState = null;
                this.Reflow();
            }
        }

Usage Example

示例#1
0
        private void KillIfEmpty()
        {
            // if we're empty, remove ourselves
            if (m_Panes.Count != 0)
            {
                return;
            }

            if (parent == null)
            {
                window.InternalCloseWindow();
                return;
            }

            SplitView sw = (SplitView)parent;

            sw.RemoveChildNice(this);

            if (!m_IsBeingDestroyed)
            {
                DestroyImmediate(this, true);
            }

            sw.Cleanup();
        }
All Usage Examples Of UnityEditor.SplitView::Cleanup