예제 #1
0
        protected override void DoubleClickedItem(int id)
        {
            IList <TreeViewItem> rowsFromIDs = this.GetRowsFromIDs(new List <int>
            {
                id
            });

            UISystemProfilerTreeView.HighlightRowsMatchingObjects(rowsFromIDs);
        }
예제 #2
0
 private void InitIfNeeded(ProfilerWindow win)
 {
     if (this.m_ZoomablePreview == null)
     {
         this.m_ZoomablePreview = new ZoomableArea(true, false)
         {
             hRangeMin = 0f,
             vRangeMin = 0f,
             hRangeMax = 1f,
             vRangeMax = 1f
         };
         this.m_ZoomablePreview.SetShownHRange(0f, 1f);
         this.m_ZoomablePreview.SetShownVRange(0f, 1f);
         this.m_ZoomablePreview.uniformScale    = true;
         this.m_ZoomablePreview.scaleWithWindow = true;
         int num  = 100;
         int num2 = 200;
         this.m_MulticolumnHeaderState = new MultiColumnHeaderState(new MultiColumnHeaderState.Column[]
         {
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Object", null, null),
                 width         = 220f,
                 maxWidth      = 400f,
                 canSort       = true
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Self Batch Count", null, null),
                 width         = (float)num,
                 maxWidth      = (float)num2
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Cumulative Batch Count", null, null),
                 width         = (float)num,
                 maxWidth      = (float)num2
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Self Vertex Count", null, null),
                 width         = (float)num,
                 maxWidth      = (float)num2
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Cumulative Vertex Count", null, null),
                 width         = (float)num,
                 maxWidth      = (float)num2
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("Batch Breaking Reason", null, null),
                 width         = 220f,
                 maxWidth      = 400f,
                 canSort       = false
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("GameObject Count", null, null),
                 width         = (float)num,
                 maxWidth      = 400f
             },
             new MultiColumnHeaderState.Column
             {
                 headerContent = EditorGUIUtility.TrTextContent("GameObjects", null, null),
                 width         = 150f,
                 maxWidth      = 400f,
                 canSort       = false
             }
         });
         MultiColumnHeaderState.Column[] columns = this.m_MulticolumnHeaderState.columns;
         for (int i = 0; i < columns.Length; i++)
         {
             MultiColumnHeaderState.Column column = columns[i];
             column.sortingArrowAlignment = TextAlignment.Right;
         }
         this.m_UGUIProfilerTreeViewState = new UISystemProfilerTreeView.State
         {
             profilerWindow = win
         };
         UISystemProfiler.Headers headers = new UISystemProfiler.Headers(this.m_MulticolumnHeaderState)
         {
             canSort = true,
             height  = 21f
         };
         headers.sortingChanged += delegate(MultiColumnHeader header)
         {
             this.m_TreeViewControl.Reload();
         };
         this.m_TreeViewControl = new UISystemProfilerTreeView(this.m_UGUIProfilerTreeViewState, headers);
         this.m_TreeViewControl.Reload();
     }
 }
        private void InitIfNeeded(ProfilerWindow win)
        {
            if (m_ZoomablePreview != null)
            {
                return;
            }

            m_ZoomablePreview = new ZoomableArea(true, false)
            {
                hRangeMin = 0.0f,
                vRangeMin = 0.0f,
                hRangeMax = 1.0f,
                vRangeMax = 1.0f
            };

            m_ZoomablePreview.SetShownHRange(0, 1);
            m_ZoomablePreview.SetShownVRange(0, 1);

            m_ZoomablePreview.uniformScale    = true;
            m_ZoomablePreview.scaleWithWindow = true;

            var initwidth = 100;
            var maxWidth  = 200;

            m_MulticolumnHeaderState = new MultiColumnHeaderState(new[]
            {
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("Object"), width = 220, maxWidth = 400, canSort = true
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("Self Batch Count"), width = initwidth, maxWidth = maxWidth
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("Cumulative Batch Count"), width = initwidth, maxWidth = maxWidth
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("Self Vertex Count"), width = initwidth, maxWidth = maxWidth
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("Cumulative Vertex Count"), width = initwidth, maxWidth = maxWidth
                },
                new MultiColumnHeaderState.Column
                {
                    headerContent = EditorGUIUtility.TrTextContent("Batch Breaking Reason"),
                    width         = 220,
                    maxWidth      = 400,
                    canSort       = false
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("GameObject Count"), width = initwidth, maxWidth = 400
                },
                new MultiColumnHeaderState.Column {
                    headerContent = EditorGUIUtility.TrTextContent("GameObjects"), width = 150, maxWidth = 400, canSort = false
                },
            });
            foreach (var column in m_MulticolumnHeaderState.columns)
            {
                column.sortingArrowAlignment = TextAlignment.Right;
            }

            m_UGUIProfilerTreeViewState = new UISystemProfilerTreeView.State {
                profilerWindow = win
            };
            var multiColumnHeader = new Headers(m_MulticolumnHeaderState)
            {
                canSort = true, height = 21
            };

            multiColumnHeader.sortingChanged += header => { m_TreeViewControl.Reload(); };
            m_TreeViewControl = new UISystemProfilerTreeView(m_UGUIProfilerTreeViewState, multiColumnHeader);
            m_TreeViewControl.Reload();
        }
예제 #4
0
        private string GetItemcontent(TreeView.RowGUIArgs args, int column)
        {
            string result;

            if (this.m_AllCanvasesItem != null && args.item.id == this.m_AllCanvasesItem.id)
            {
                switch (column)
                {
                case 2:
                    result = this.m_AllCanvasesItem.totalBatchCount.ToString();
                    return(result);

                case 4:
                    result = this.m_AllCanvasesItem.totalVertexCount.ToString();
                    return(result);

                case 6:
                    result = this.m_AllCanvasesItem.gameObjectCount.ToString();
                    return(result);
                }
                result = null;
            }
            else
            {
                UISystemProfilerTreeView.BatchTreeViewItem batchTreeViewItem = args.item as UISystemProfilerTreeView.BatchTreeViewItem;
                if (batchTreeViewItem != null)
                {
                    UISystemProfilerInfo info = batchTreeViewItem.info;
                    switch (column)
                    {
                    case 0:
                    case 1:
                    case 2:
                        break;

                    case 3:
                        result = info.vertexCount.ToString();
                        return(result);

                    case 4:
                        result = info.totalVertexCount.ToString();
                        return(result);

                    case 5:
                        if (info.batchBreakingReason != BatchBreakingReason.NoBreaking)
                        {
                            result = UISystemProfilerTreeView.FormatBatchBreakingReason(info);
                            return(result);
                        }
                        break;

                    case 6:
                        result = info.instanceIDsCount.ToString();
                        return(result);

                    case 7:
                        if (batchTreeViewItem.instanceIDs.Length <= 5)
                        {
                            StringBuilder stringBuilder = new StringBuilder();
                            for (int i = 0; i < batchTreeViewItem.instanceIDs.Length; i++)
                            {
                                if (i != 0)
                                {
                                    stringBuilder.Append(", ");
                                }
                                int num = batchTreeViewItem.instanceIDs[i];
                                UnityEngine.Object @object = EditorUtility.InstanceIDToObject(num);
                                if (@object == null)
                                {
                                    stringBuilder.Append(num);
                                }
                                else
                                {
                                    stringBuilder.Append(@object.name);
                                }
                            }
                            result = stringBuilder.ToString();
                            return(result);
                        }
                        result = string.Format("{0} objects", batchTreeViewItem.instanceIDs.Length);
                        return(result);

                    case 8:
                        result = info.renderDataIndex.ToString();
                        return(result);

                    default:
                        result = "Missing";
                        return(result);
                    }
                    result = null;
                }
                else
                {
                    UISystemProfilerTreeView.CanvasTreeViewItem canvasTreeViewItem = args.item as UISystemProfilerTreeView.CanvasTreeViewItem;
                    if (canvasTreeViewItem != null)
                    {
                        UISystemProfilerInfo info2 = canvasTreeViewItem.info;
                        switch (column)
                        {
                        case 0:
                        case 3:
                        case 5:
                        case 7:
                            result = null;
                            break;

                        case 1:
                            result = info2.batchCount.ToString();
                            break;

                        case 2:
                            result = info2.totalBatchCount.ToString();
                            break;

                        case 4:
                            result = info2.totalVertexCount.ToString();
                            break;

                        case 6:
                            result = info2.instanceIDsCount.ToString();
                            break;

                        case 8:
                            result = info2.renderDataIndex + " : " + info2.renderDataCount;
                            break;

                        default:
                            result = "Missing";
                            break;
                        }
                    }
                    else
                    {
                        result = null;
                    }
                }
            }
            return(result);
        }