Collapse() public method

public Collapse ( ) : void
return void
示例#1
0
        private void DoHeapshotObjects(List <HeapshotWindow.HeapshotUIObject> objects, SplitterState splitter, int indent, HeapshotWindow.OnSelect onSelect)
        {
            if (objects == null)
            {
                return;
            }
            Event current1 = Event.current;

            using (List <HeapshotWindow.HeapshotUIObject> .Enumerator enumerator = objects.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    HeapshotWindow.HeapshotUIObject current2 = enumerator.Current;
                    Rect   position  = new Rect(14f * (float)indent, this.guiRect.y, 14f, this.guiRect.height);
                    Rect[] rectArray = new Rect[this.titleNames.Length];
                    float  x         = 14f * (float)(indent + 1);
                    for (int index = 0; index < rectArray.Length; ++index)
                    {
                        float width = index != 0 ? (float)splitter.realSizes[index] : (float)splitter.realSizes[index] - x;
                        rectArray[index] = new Rect(x, this.guiRect.y, width, this.guiRect.height);
                        x += width;
                    }
                    if (current1.type == EventType.Repaint)
                    {
                        ((this.itemIndex & 1) != 0 ? HeapshotWindow.Styles.entryOdd : HeapshotWindow.Styles.entryEven).Draw(new Rect(0.0f, 16f * (float)this.itemIndex, this.position.width, 16f), GUIContent.none, false, false, this.itemIndex == this.selectedItem, false);
                    }
                    if (current2.HasChildren)
                    {
                        GUI.changed = false;
                        bool flag = GUI.Toggle(position, current2.IsExpanded, GUIContent.none, HeapshotWindow.Styles.foldout);
                        if (GUI.changed)
                        {
                            if (flag)
                            {
                                current2.Expand();
                            }
                            else
                            {
                                current2.Collapse();
                            }
                        }
                    }
                    GUI.changed = false;
                    bool flag1 = GUI.Toggle(rectArray[0], this.itemIndex == this.selectedItem, current2.Name, HeapshotWindow.Styles.numberLabel);
                    if (!current2.IsDummyObject)
                    {
                        GUI.Toggle(rectArray[1], this.itemIndex == this.selectedItem, current2.TypeName, HeapshotWindow.Styles.numberLabel);
                        GUI.Toggle(rectArray[2], this.itemIndex == this.selectedItem, "0x" + current2.Code.ToString("X"), HeapshotWindow.Styles.numberLabel);
                        GUI.Toggle(rectArray[3], this.itemIndex == this.selectedItem, current2.Size.ToString(), HeapshotWindow.Styles.numberLabel);
                        GUI.Toggle(rectArray[4], this.itemIndex == this.selectedItem, string.Format("{0} / {1}", (object)current2.ReferenceCount, (object)current2.InverseReferenceCount), HeapshotWindow.Styles.numberLabel);
                        if (GUI.changed && flag1 && onSelect != null)
                        {
                            this.selectedItem = this.itemIndex;
                            onSelect(current2);
                        }
                    }
                    ++this.itemIndex;
                    this.guiRect.y += 16f;
                    this.DoHeapshotObjects(current2.Children, splitter, indent + 1, onSelect);
                }
            }
        }