Пример #1
0
        private void AddAllChildren(ProfilerFrameDataTreeView.FrameDataTreeViewItem parent, IList <TreeViewItem> newRows, List <int> newExpandedIds)
        {
            LinkedList <ProfilerFrameDataTreeView.FrameDataTreeViewItem> linkedList = new LinkedList <ProfilerFrameDataTreeView.FrameDataTreeViewItem>();

            linkedList.AddFirst(parent);
            while (linkedList.First != null)
            {
                ProfilerFrameDataTreeView.FrameDataTreeViewItem value = linkedList.First.Value;
                linkedList.RemoveFirst();
                if (value.depth != -1)
                {
                    newRows.Add(value);
                }
                if (this.m_FrameDataView.HasItemChildren(value.id))
                {
                    if (value.depth != -1)
                    {
                        if (!this.IsMigratedExpanded(value.id))
                        {
                            if (value.children == null)
                            {
                                value.children = TreeView.CreateChildListForCollapsedParent();
                            }
                            continue;
                        }
                        if (newExpandedIds != null)
                        {
                            newExpandedIds.Add(value.id);
                        }
                    }
                    int[] itemChildren = this.m_FrameDataView.GetItemChildren(value.id);
                    if (value.children != null)
                    {
                        value.children.Clear();
                        value.children.Capacity = itemChildren.Length;
                    }
                    else
                    {
                        value.children = new List <TreeViewItem>(itemChildren.Length);
                    }
                    int[] array = itemChildren;
                    for (int i = 0; i < array.Length; i++)
                    {
                        int id = array[i];
                        ProfilerFrameDataTreeView.FrameDataTreeViewItem item = new ProfilerFrameDataTreeView.FrameDataTreeViewItem(this.m_FrameDataView, id, value.depth + 1, value);
                        value.children.Add(item);
                    }
                    LinkedListNode <ProfilerFrameDataTreeView.FrameDataTreeViewItem> linkedListNode = null;
                    foreach (TreeViewItem current in value.children)
                    {
                        linkedListNode = ((linkedListNode != null) ? linkedList.AddAfter(linkedListNode, (ProfilerFrameDataTreeView.FrameDataTreeViewItem)current) : linkedList.AddFirst((ProfilerFrameDataTreeView.FrameDataTreeViewItem)current));
                    }
                }
            }
            if (newExpandedIds != null)
            {
                newExpandedIds.Sort();
            }
        }
Пример #2
0
        private void CellGUI(Rect cellRect, ProfilerFrameDataTreeView.FrameDataTreeViewItem item, bool needsIndent, int column, ref TreeView.RowGUIArgs args)
        {
            if (needsIndent)
            {
                float num = base.GetContentIndent(item) + base.extraSpaceBeforeIconAndLabel;
                cellRect.xMin += num;
            }
            base.CenterRectUsingSingleLineHeight(ref cellRect);
            GUIContent content = GUIContent.Temp(item.columnStrings[column], string.Empty);

            TreeView.DefaultStyles.label.Draw(cellRect, content, false, false, args.selected, args.focused);
        }
Пример #3
0
        private void Search(TreeViewItem searchFromThis, string search, List <TreeViewItem> result)
        {
            if (searchFromThis == null)
            {
                throw new ArgumentException("Invalid searchFromThis: cannot be null", "searchFromThis");
            }
            if (string.IsNullOrEmpty(search))
            {
                throw new ArgumentException("Invalid search: cannot be null or empty", "search");
            }
            Stack <int> stack = new Stack <int>();

            if (this.m_FrameDataView.HasItemChildren(searchFromThis.id))
            {
                int[] itemChildren = this.m_FrameDataView.GetItemChildren(searchFromThis.id);
                int[] array        = itemChildren;
                for (int i = 0; i < array.Length; i++)
                {
                    int item = array[i];
                    stack.Push(item);
                }
            }
            while (stack.Count > 0)
            {
                int    id = stack.Pop();
                string itemFunctionName = this.m_FrameDataView.GetItemFunctionName(id);
                if (itemFunctionName.IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    ProfilerFrameDataTreeView.FrameDataTreeViewItem frameDataTreeViewItem = new ProfilerFrameDataTreeView.FrameDataTreeViewItem(this.m_FrameDataView, id, 0, searchFromThis);
                    searchFromThis.AddChild(frameDataTreeViewItem);
                    result.Add(frameDataTreeViewItem);
                }
                if (this.m_FrameDataView.HasItemChildren(id))
                {
                    int[] itemChildren2 = this.m_FrameDataView.GetItemChildren(id);
                    int[] array2        = itemChildren2;
                    for (int j = 0; j < array2.Length; j++)
                    {
                        int item2 = array2[j];
                        stack.Push(item2);
                    }
                }
            }
        }
Пример #4
0
 protected override void RowGUI(TreeView.RowGUIArgs args)
 {
     if (Event.current.rawType == EventType.Repaint)
     {
         ProfilerFrameDataTreeView.FrameDataTreeViewItem frameDataTreeViewItem = (ProfilerFrameDataTreeView.FrameDataTreeViewItem)args.item;
         frameDataTreeViewItem.Init(this.m_MultiColumnHeader.columns);
         for (int i = 0; i < args.GetNumVisibleColumns(); i++)
         {
             Rect cellRect = args.GetCellRect(i);
             this.CellGUI(cellRect, frameDataTreeViewItem, i == 0, args.GetColumn(i), ref args);
         }
         if (args.selected)
         {
             if (args.rowRect.Contains(Event.current.mousePosition))
             {
                 if (base.hasSearch)
                 {
                     GUIStyle.SetMouseTooltip(ProfilerFrameDataTreeView.kFrameTooltip.tooltip, args.rowRect);
                 }
             }
         }
     }
 }