Ejemplo n.º 1
0
        protected override IList <TreeViewItem> BuildRows(TreeViewItem root)
        {
            this.profilerState.lastFrame = this.profilerState.profilerWindow.GetActiveVisibleFrameIndex();
            List <TreeViewItem>  list = new List <TreeViewItem>();
            IList <TreeViewItem> result;

            if (this.property == null || !this.property.frameDataReady)
            {
                result = list;
            }
            else
            {
                this.m_AllCanvasesItem = new UISystemProfilerTreeView.RootTreeViewItem();
                base.SetExpanded(this.m_AllCanvasesItem.id, true);
                root.AddChild(this.m_AllCanvasesItem);
                UISystemProfilerInfo[] uISystemProfilerInfo = this.property.GetUISystemProfilerInfo();
                int[] uISystemBatchInstanceIDs = this.property.GetUISystemBatchInstanceIDs();
                if (uISystemProfilerInfo != null)
                {
                    Dictionary <int, TreeViewItem> dictionary = new Dictionary <int, TreeViewItem>();
                    int num = 0;
                    UISystemProfilerInfo[] array = uISystemProfilerInfo;
                    for (int i = 0; i < array.Length; i++)
                    {
                        UISystemProfilerInfo info = array[i];
                        TreeViewItem         allCanvasesItem;
                        if (!dictionary.TryGetValue(info.parentId, out allCanvasesItem))
                        {
                            allCanvasesItem = this.m_AllCanvasesItem;
                            this.m_AllCanvasesItem.totalBatchCount  += info.totalBatchCount;
                            this.m_AllCanvasesItem.totalVertexCount += info.totalVertexCount;
                            this.m_AllCanvasesItem.gameObjectCount  += info.instanceIDsCount;
                        }
                        UISystemProfilerTreeView.BaseTreeViewItem baseTreeViewItem;
                        if (info.isBatch)
                        {
                            string displayName = "Batch " + num++;
                            baseTreeViewItem = new UISystemProfilerTreeView.BatchTreeViewItem(info, allCanvasesItem.depth + 1, displayName, uISystemBatchInstanceIDs);
                        }
                        else
                        {
                            string displayName = this.property.GetUISystemProfilerNameByOffset(info.objectNameOffset);
                            baseTreeViewItem = new UISystemProfilerTreeView.CanvasTreeViewItem(info, allCanvasesItem.depth + 1, displayName);
                            num = 0;
                            dictionary[info.objectInstanceId] = baseTreeViewItem;
                        }
                        if (!base.IsExpanded(allCanvasesItem.id))
                        {
                            if (!allCanvasesItem.hasChildren)
                            {
                                allCanvasesItem.children = TreeView.CreateChildListForCollapsedParent();
                            }
                        }
                        else
                        {
                            allCanvasesItem.AddChild(baseTreeViewItem);
                        }
                    }
                    this.m_Comparer.Col = UISystemProfilerTreeView.Column.Element;
                    if (base.multiColumnHeader.sortedColumnIndex != -1)
                    {
                        this.m_Comparer.Col = (UISystemProfilerTreeView.Column)base.multiColumnHeader.sortedColumnIndex;
                    }
                    this.m_Comparer.isAscending = base.multiColumnHeader.GetColumn((int)this.m_Comparer.Col).sortedAscending;
                    this.SetupRows(this.m_AllCanvasesItem, list);
                }
                result = list;
            }
            return(result);
        }