コード例 #1
0
            public void Draw(ProfilerHierarchyGUI gui, int controlID)
            {
                int num;
                int num2;

                this.HandleCommandEvents(gui);
                Event  current = Event.current;
                string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;

                GetFirstAndLastRowVisible(this.m_NumResultsUsed, 16f, gui.m_TextScroll.y, (float)gui.m_ScrollViewHeight, out num, out num2);
                for (int i = num; i <= num2; i++)
                {
                    bool     on                 = selectedPropertyPath == this.m_SearchResults[i].propertyPath;
                    Rect     rowRect            = gui.GetRowRect(i);
                    GUIStyle rowBackgroundStyle = gui.GetRowBackgroundStyle(i);
                    if ((current.type == EventType.MouseDown) && rowRect.Contains(current.mousePosition))
                    {
                        this.m_SelectedSearchIndex = i;
                        gui.RowMouseDown(this.m_SearchResults[i].propertyPath);
                        GUIUtility.keyboardControl = controlID;
                        current.Use();
                    }
                    if (current.type == EventType.Repaint)
                    {
                        rowBackgroundStyle.Draw(rowRect, GUIContent.none, false, false, on, GUIUtility.keyboardControl == controlID);
                        if (rowRect.Contains(current.mousePosition))
                        {
                            string tooltip = this.m_SearchResults[i].propertyPath.Replace("/", "/\n");
                            if (this.m_SelectedSearchIndex >= 0)
                            {
                                tooltip = tooltip + "\n\n(Press 'F' to frame selection)";
                            }
                            GUI.Label(rowRect, GUIContent.Temp(string.Empty, tooltip));
                        }
                        gui.DrawTextColumn(ref rowRect, this.m_SearchResults[i].columnValues[0], 0, 4f, on);
                        ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
                        int index = 1;
                        for (int j = 1; j < gui.m_VisibleColumns.Length; j++)
                        {
                            if (gui.ColIsVisible(j))
                            {
                                rowRect.x    += gui.m_Splitter.realSizes[index - 1];
                                rowRect.width = gui.m_Splitter.realSizes[index] - 4f;
                                index++;
                                ProfilerHierarchyGUI.styles.numberLabel.Draw(rowRect, this.m_SearchResults[i].columnValues[j], false, false, false, on);
                            }
                        }
                        ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
                    }
                }
                if (!this.m_FoundAllResults && (current.type == EventType.Repaint))
                {
                    int      numResultsUsed = this.m_NumResultsUsed;
                    Rect     position       = new Rect(1f, 16f * numResultsUsed, GUIClip.visibleRect.width, 16f);
                    GUIStyle style2         = ((numResultsUsed % 2) != 0) ? ProfilerHierarchyGUI.styles.entryOdd : ProfilerHierarchyGUI.styles.entryEven;
                    GUI.Label(position, GUIContent.Temp(string.Empty, ProfilerHierarchyGUI.styles.notShowingAllResults.tooltip), GUIStyle.none);
                    style2.Draw(position, GUIContent.none, false, false, false, false);
                    gui.DrawTextColumn(ref position, ProfilerHierarchyGUI.styles.notShowingAllResults.text, 0, 4f, false);
                }
            }
コード例 #2
0
 public ProfilerHierarchyGUI(IProfilerWindowController window, ProfilerHierarchyGUI detailedObjectsView, string columnSettingsName, ProfilerColumn[] columnsToShow, string[] columnNames, bool detailPane, ProfilerColumn sort)
 {
     this.m_Window             = window;
     this.m_ColumnNames        = columnNames;
     this.m_ColumnSettingsName = columnSettingsName;
     this.m_ColumnsToShow      = columnsToShow;
     this.m_DetailPane         = detailPane;
     this.m_SortType           = sort;
     this.m_HeaderContent      = new GUIContent[columnNames.Length];
     this.m_Splitter           = null;
     for (int i = 0; i < this.m_HeaderContent.Length; i++)
     {
         this.m_HeaderContent[i] = ((!this.m_ColumnNames[i].StartsWith("|")) ? new GUIContent(this.m_ColumnNames[i]) : EditorGUIUtility.IconContent("ProfilerColumn." + columnsToShow[i].ToString(), this.m_ColumnNames[i]));
     }
     if (columnsToShow.Length != columnNames.Length)
     {
         throw new ArgumentException("Number of columns to show does not match number of column names.");
     }
     this.m_SearchHeader   = new GUIContent("Search");
     this.m_VisibleColumns = new bool[columnNames.Length];
     for (int j = 0; j < this.m_VisibleColumns.Length; j++)
     {
         this.m_VisibleColumns[j] = true;
     }
     this.m_SearchResults = new ProfilerHierarchyGUI.SearchResults();
     this.m_SearchResults.Init(100);
     this.m_DetailedObjectsView = new ProfilerDetailedObjectsView(detailedObjectsView, this);
     this.m_Window.Repaint();
 }
コード例 #3
0
 private static string DetailViewSelectedPropertyPath(ProfilerProperty property)
 {
     if (property == null || property.instanceIDs == null || property.instanceIDs.Length == 0 || property.instanceIDs[0] == 0)
     {
         return(string.Empty);
     }
     return(ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property, property.instanceIDs[0]));
 }
コード例 #4
0
 private void MoveSelection(int steps)
 {
     if (this.IsSearchActive())
     {
         this.m_SearchResults.MoveSelection(steps, this);
     }
     else
     {
         int num1 = this.m_SelectedIndex + steps;
         if (num1 < 0)
         {
             num1 = 0;
         }
         ProfilerProperty property = this.m_Window.CreateProperty(this.m_DetailPane);
         if (this.m_DetailPane)
         {
             ProfilerProperty detailedProperty = this.GetDetailedProperty(property);
             property.Cleanup();
             property = detailedProperty;
         }
         if (property == null)
         {
             return;
         }
         bool enterChildren = true;
         int  num2          = 0;
         int  instanceId    = -1;
         while (property.Next(enterChildren))
         {
             if (this.m_DetailPane && property.instanceIDs != null && (property.instanceIDs.Length > 0 && property.instanceIDs[0] != 0))
             {
                 instanceId = property.instanceIDs[0];
             }
             if (num2 != num1)
             {
                 if (property.HasChildren)
                 {
                     enterChildren = !this.m_DetailPane && this.IsExpanded(property.propertyPath);
                 }
                 ++num2;
             }
             else
             {
                 break;
             }
         }
         if (this.m_DetailPane)
         {
             this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property, instanceId);
         }
         else
         {
             this.m_Window.SetSelectedPropertyPath(property.propertyPath);
         }
         property.Cleanup();
     }
 }
コード例 #5
0
            public void MoveSelection(int steps, ProfilerHierarchyGUI gui)
            {
                int num = Mathf.Clamp(this.m_SelectedSearchIndex + steps, 0, this.m_NumResultsUsed - 1);

                if (num != this.m_SelectedSearchIndex)
                {
                    this.m_SelectedSearchIndex = num;
                    gui.m_Window.SetSelectedPropertyPath(this.m_SearchResults[num].propertyPath);
                }
            }
コード例 #6
0
            public void MoveSelection(int steps, ProfilerHierarchyGUI gui)
            {
                int index = Mathf.Clamp(this.m_SelectedSearchIndex + steps, 0, this.m_NumResultsUsed - 1);

                if (index == this.m_SelectedSearchIndex)
                {
                    return;
                }
                this.m_SelectedSearchIndex = index;
                gui.m_Window.SetSelectedPropertyPath(this.m_SearchResults[index].propertyPath);
            }
コード例 #7
0
        private static string DetailViewSelectedPropertyPath(ProfilerProperty property)
        {
            string result;

            if (property == null || property.instanceIDs == null || property.instanceIDs.Length == 0 || property.instanceIDs[0] == 0)
            {
                result = string.Empty;
            }
            else
            {
                result = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property, property.instanceIDs[0]);
            }
            return(result);
        }
コード例 #8
0
 private void MoveSelection(int steps)
 {
     if (this.IsSearchActive())
     {
         this.m_SearchResults.MoveSelection(steps, this);
     }
     else
     {
         int num = this.m_SelectedIndex + steps;
         if (num < 0)
         {
             num = 0;
         }
         ProfilerProperty profilerProperty = (!this.m_DetailPane) ? this.m_Window.GetRootProfilerProperty(this.m_SortType) : this.GetDetailedProperty();
         if (profilerProperty != null)
         {
             bool enterChildren = true;
             int  num2          = 0;
             int  instanceId    = -1;
             while (profilerProperty.Next(enterChildren))
             {
                 if (this.m_DetailPane && profilerProperty.instanceIDs != null && profilerProperty.instanceIDs.Length > 0 && profilerProperty.instanceIDs[0] != 0)
                 {
                     instanceId = profilerProperty.instanceIDs[0];
                 }
                 if (num2 == num)
                 {
                     break;
                 }
                 if (profilerProperty.HasChildren)
                 {
                     enterChildren = (!this.m_DetailPane && this.IsExpanded(profilerProperty.propertyPath));
                 }
                 num2++;
             }
             if (this.m_DetailPane)
             {
                 this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(profilerProperty, instanceId);
             }
             else
             {
                 this.m_Window.SetSelectedPropertyPath(profilerProperty.propertyPath);
             }
         }
     }
 }
コード例 #9
0
 private void BuildColumns()
 {
   ProfilerColumn[] profilerColumnArray1 = new ProfilerColumn[8]{ ProfilerColumn.FunctionName, ProfilerColumn.TotalPercent, ProfilerColumn.SelfPercent, ProfilerColumn.Calls, ProfilerColumn.GCMemory, ProfilerColumn.TotalTime, ProfilerColumn.SelfTime, ProfilerColumn.WarningCount };
   ProfilerColumn[] profilerColumnArray2 = new ProfilerColumn[7]{ ProfilerColumn.ObjectName, ProfilerColumn.TotalPercent, ProfilerColumn.SelfPercent, ProfilerColumn.Calls, ProfilerColumn.GCMemory, ProfilerColumn.TotalTime, ProfilerColumn.SelfTime };
   this.m_CPUHierarchyGUI = new ProfilerHierarchyGUI((IProfilerWindowController) this, "VisibleProfilerColumnsV2", profilerColumnArray1, ProfilerWindow.ProfilerColumnNames(profilerColumnArray1), false, ProfilerColumn.TotalTime);
   this.m_CPUTimelineGUI = new ProfilerTimelineGUI((IProfilerWindowController) this);
   string text = EditorGUIUtility.TextContent("Object").text;
   string[] columnNames1 = ProfilerWindow.ProfilerColumnNames(profilerColumnArray2);
   columnNames1[0] = text;
   this.m_CPUDetailHierarchyGUI = new ProfilerHierarchyGUI((IProfilerWindowController) this, "VisibleProfilerDetailColumns", profilerColumnArray2, columnNames1, true, ProfilerColumn.TotalTime);
   ProfilerColumn[] profilerColumnArray3 = new ProfilerColumn[4]{ ProfilerColumn.FunctionName, ProfilerColumn.TotalGPUPercent, ProfilerColumn.DrawCalls, ProfilerColumn.TotalGPUTime };
   ProfilerColumn[] profilerColumnArray4 = new ProfilerColumn[4]{ ProfilerColumn.ObjectName, ProfilerColumn.TotalGPUPercent, ProfilerColumn.DrawCalls, ProfilerColumn.TotalGPUTime };
   this.m_GPUHierarchyGUI = new ProfilerHierarchyGUI((IProfilerWindowController) this, "VisibleProfilerGPUColumns", profilerColumnArray3, ProfilerWindow.ProfilerColumnNames(profilerColumnArray3), false, ProfilerColumn.TotalGPUTime);
   string[] columnNames2 = ProfilerWindow.ProfilerColumnNames(profilerColumnArray4);
   columnNames2[0] = text;
   this.m_GPUDetailHierarchyGUI = new ProfilerHierarchyGUI((IProfilerWindowController) this, "VisibleProfilerGPUDetailColumns", profilerColumnArray4, columnNames2, true, ProfilerColumn.TotalGPUTime);
 }
コード例 #10
0
            private void HandleCommandEvents(ProfilerHierarchyGUI gui)
            {
                Event     current = Event.current;
                EventType type    = current.type;

                if (type == EventType.ExecuteCommand || type == EventType.ValidateCommand)
                {
                    bool flag = type == EventType.ExecuteCommand;
                    if (Event.current.commandName == "FrameSelected")
                    {
                        if (flag)
                        {
                            gui.FrameSelection();
                        }
                        current.Use();
                    }
                }
            }
コード例 #11
0
            private void HandleCommandEvents(ProfilerHierarchyGUI gui)
            {
                Event     current = Event.current;
                EventType type    = current.type;

                switch (type)
                {
                case EventType.ExecuteCommand:
                case EventType.ValidateCommand:
                    bool flag = type == EventType.ExecuteCommand;
                    if (!(Event.current.commandName == "FrameSelected"))
                    {
                        break;
                    }
                    if (flag)
                    {
                        gui.FrameSelection();
                    }
                    current.Use();
                    break;
                }
            }
コード例 #12
0
        private int DrawTreeView(ProfilerProperty property, int id)
        {
            this.m_SelectedIndex = -1;
            bool   enterChildren        = true;
            int    rowCount             = 0;
            string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;

            while (property.Next(enterChildren))
            {
                string propertyPath = property.propertyPath;
                bool   selected     = !this.m_DetailPane ? propertyPath == selectedPropertyPath : this.m_DetailViewSelectedProperty != string.Empty && this.m_DetailViewSelectedProperty == ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                if (selected)
                {
                    this.m_SelectedIndex = rowCount;
                }
                enterChildren = ((Event.current.type != EventType.Layout ? 1 : 0) & (this.m_ScrollViewHeight == 0 ? 1 : ((double)rowCount * 16.0 > (double)this.m_ScrollViewHeight + (double)this.m_TextScroll.y ? 0 : ((double)(rowCount + 1) * 16.0 > (double)this.m_TextScroll.y ? 1 : 0)))) == 0 ? property.HasChildren && this.IsExpanded(propertyPath) : this.DrawProfileDataItem(property, rowCount, selected, id);
                ++rowCount;
            }
            return(rowCount);
        }
コード例 #13
0
 private void HandleCommandEvents(ProfilerHierarchyGUI gui)
 {
   Event current = Event.current;
   EventType type = current.type;
   switch (type)
   {
     case EventType.ExecuteCommand:
     case EventType.ValidateCommand:
       bool flag = type == EventType.ExecuteCommand;
       if (!(Event.current.commandName == "FrameSelected"))
         break;
       if (flag)
         gui.FrameSelection();
       current.Use();
       break;
   }
 }
コード例 #14
0
ファイル: ProfilerWindow.cs プロジェクト: randomize/VimConfig
 private void DrawCPUOrRenderingPane(ProfilerHierarchyGUI mainPane, ProfilerHierarchyGUI detailPane, ProfilerTimelineGUI timelinePane)
 {
     ProfilerProperty property = this.CreateProperty(false);
     this.DrawCPUOrRenderingToolbar(property);
     if (!CheckFrameData(property))
     {
         property.Cleanup();
     }
     else if ((timelinePane != null) && (this.m_ViewType == ProfilerViewType.Timeline))
     {
         float height = this.m_VertSplit.realSizes[1];
         height -= EditorStyles.toolbar.CalcHeight(GUIContent.none, 10f) + 2f;
         timelinePane.DoGUI(this.GetActiveVisibleFrameIndex(), base.position.width, base.position.height - height, height);
         property.Cleanup();
     }
     else
     {
         SplitterGUILayout.BeginHorizontalSplit(this.m_ViewSplit, new GUILayoutOption[0]);
         GUILayout.BeginVertical(new GUILayoutOption[0]);
         bool expandAll = false;
         mainPane.DoGUI(property, this.m_SearchString, expandAll);
         property.Cleanup();
         GUILayout.EndVertical();
         GUILayout.BeginVertical(new GUILayoutOption[0]);
         ProfilerProperty property2 = this.CreateProperty(true);
         ProfilerProperty detailedProperty = mainPane.GetDetailedProperty(property2);
         property2.Cleanup();
         if (detailedProperty != null)
         {
             detailPane.DoGUI(detailedProperty, string.Empty, expandAll);
             detailedProperty.Cleanup();
         }
         else
         {
             DrawEmptyCPUOrRenderingDetailPane();
         }
         GUILayout.EndVertical();
         SplitterGUILayout.EndHorizontalSplit();
     }
 }
コード例 #15
0
ファイル: ProfilerWindow.cs プロジェクト: randomize/VimConfig
 private void BuildColumns()
 {
     ProfilerColumn[] columnArray1 = new ProfilerColumn[8];
     columnArray1[1] = ProfilerColumn.TotalPercent;
     columnArray1[2] = ProfilerColumn.SelfPercent;
     columnArray1[3] = ProfilerColumn.Calls;
     columnArray1[4] = ProfilerColumn.GCMemory;
     columnArray1[5] = ProfilerColumn.TotalTime;
     columnArray1[6] = ProfilerColumn.SelfTime;
     columnArray1[7] = ProfilerColumn.WarningCount;
     ProfilerColumn[] columnsToShow = columnArray1;
     ProfilerColumn[] columns = new ProfilerColumn[] { ProfilerColumn.ObjectName, ProfilerColumn.TotalPercent, ProfilerColumn.SelfPercent, ProfilerColumn.Calls, ProfilerColumn.GCMemory, ProfilerColumn.TotalTime, ProfilerColumn.SelfTime };
     this.m_CPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerColumnsV2", columnsToShow, ProfilerColumnNames(columnsToShow), false, ProfilerColumn.TotalTime);
     this.m_CPUTimelineGUI = new ProfilerTimelineGUI(this);
     string text = EditorGUIUtility.TextContent("Object").text;
     string[] columnNames = ProfilerColumnNames(columns);
     columnNames[0] = text;
     this.m_CPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerDetailColumns", columns, columnNames, true, ProfilerColumn.TotalTime);
     ProfilerColumn[] columnArray6 = new ProfilerColumn[4];
     columnArray6[1] = ProfilerColumn.TotalGPUPercent;
     columnArray6[2] = ProfilerColumn.DrawCalls;
     columnArray6[3] = ProfilerColumn.TotalGPUTime;
     ProfilerColumn[] columnArray3 = columnArray6;
     ProfilerColumn[] columnArray4 = new ProfilerColumn[] { ProfilerColumn.ObjectName, ProfilerColumn.TotalGPUPercent, ProfilerColumn.DrawCalls, ProfilerColumn.TotalGPUTime };
     this.m_GPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUColumns", columnArray3, ProfilerColumnNames(columnArray3), false, ProfilerColumn.TotalGPUTime);
     columnNames = ProfilerColumnNames(columnArray4);
     columnNames[0] = text;
     this.m_GPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUDetailColumns", columnArray4, columnNames, true, ProfilerColumn.TotalGPUTime);
 }
コード例 #16
0
 public ProfilerDetailedObjectsView(ProfilerHierarchyGUI profilerHierarchyGUI, ProfilerHierarchyGUI mainProfilerHierarchyGUI)
 {
     this.m_ProfilerHierarchyGUI     = profilerHierarchyGUI;
     this.m_MainProfilerHierarchyGUI = mainProfilerHierarchyGUI;
 }
コード例 #17
0
			private void HandleCommandEvents(ProfilerHierarchyGUI gui)
			{
				Event current = Event.current;
				EventType type = current.type;
				if (type == EventType.ExecuteCommand || type == EventType.ValidateCommand)
				{
					bool flag = type == EventType.ExecuteCommand;
					if (Event.current.commandName == "FrameSelected")
					{
						if (flag)
						{
							gui.FrameSelection();
						}
						current.Use();
					}
				}
			}
コード例 #18
0
			public void MoveSelection(int steps, ProfilerHierarchyGUI gui)
			{
				int num = Mathf.Clamp(this.m_SelectedSearchIndex + steps, 0, this.m_NumResultsUsed - 1);
				if (num != this.m_SelectedSearchIndex)
				{
					this.m_SelectedSearchIndex = num;
					gui.m_Window.SetSelectedPropertyPath(this.m_SearchResults[num].propertyPath);
				}
			}
コード例 #19
0
			public void Draw(ProfilerHierarchyGUI gui, int controlID)
			{
				this.HandleCommandEvents(gui);
				Event current = Event.current;
				string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
				int num;
				int num2;
				ProfilerHierarchyGUI.SearchResults.GetFirstAndLastRowVisible(this.m_NumResultsUsed, 16f, gui.m_TextScroll.y, (float)gui.m_ScrollViewHeight, out num, out num2);
				for (int i = num; i <= num2; i++)
				{
					bool flag = selectedPropertyPath == this.m_SearchResults[i].propertyPath;
					Rect rowRect = gui.GetRowRect(i);
					GUIStyle rowBackgroundStyle = gui.GetRowBackgroundStyle(i);
					if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
					{
						this.m_SelectedSearchIndex = i;
						gui.RowMouseDown(this.m_SearchResults[i].propertyPath);
						GUIUtility.keyboardControl = controlID;
						current.Use();
					}
					if (current.type == EventType.Repaint)
					{
						rowBackgroundStyle.Draw(rowRect, GUIContent.none, false, false, flag, GUIUtility.keyboardControl == controlID);
						if (rowRect.Contains(current.mousePosition))
						{
							string text = this.m_SearchResults[i].propertyPath.Replace("/", "/\n");
							if (this.m_SelectedSearchIndex >= 0)
							{
								text += "\n\n(Press 'F' to frame selection)";
							}
							GUI.Label(rowRect, GUIContent.Temp(string.Empty, text));
						}
						gui.DrawTextColumn(ref rowRect, this.m_SearchResults[i].columnValues[0], 0, 4f, flag);
						ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
						int num3 = 1;
						for (int j = 1; j < gui.m_VisibleColumns.Length; j++)
						{
							if (gui.ColIsVisible(j))
							{
								rowRect.x += (float)gui.m_Splitter.realSizes[num3 - 1];
								rowRect.width = (float)gui.m_Splitter.realSizes[num3] - 4f;
								num3++;
								ProfilerHierarchyGUI.styles.numberLabel.Draw(rowRect, this.m_SearchResults[i].columnValues[j], false, false, false, flag);
							}
						}
						ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
					}
				}
				if (!this.m_FoundAllResults && current.type == EventType.Repaint)
				{
					int numResultsUsed = this.m_NumResultsUsed;
					Rect position = new Rect(1f, 16f * (float)numResultsUsed, GUIClip.visibleRect.width, 16f);
					GUIStyle gUIStyle = (numResultsUsed % 2 != 0) ? ProfilerHierarchyGUI.styles.entryOdd : ProfilerHierarchyGUI.styles.entryEven;
					GUI.Label(position, GUIContent.Temp(string.Empty, ProfilerHierarchyGUI.styles.notShowingAllResults.tooltip), GUIStyle.none);
					gUIStyle.Draw(position, GUIContent.none, false, false, false, false);
					gui.DrawTextColumn(ref position, ProfilerHierarchyGUI.styles.notShowingAllResults.text, 0, 4f, false);
				}
			}
コード例 #20
0
 protected ProfilerDetailedView(ProfilerHierarchyGUI mainProfilerHierarchyGUI)
 {
     this.m_MainProfilerHierarchyGUI = mainProfilerHierarchyGUI;
 }
コード例 #21
0
 private void BuildColumns()
 {
     ProfilerColumn[] columnsToShow = new ProfilerColumn[] { ProfilerColumn.FunctionName };
     ProfilerColumn[] columns = new ProfilerColumn[] { ProfilerColumn.ObjectName };
     this.m_CPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerColumnsV2", columnsToShow, ProfilerColumnNames(columnsToShow), false, ProfilerColumn.TotalTime);
     this.m_CPUTimelineGUI = new ProfilerTimelineGUI(this);
     string text = EditorGUIUtility.TextContent("Object").text;
     string[] columnNames = ProfilerColumnNames(columns);
     columnNames[0] = text;
     this.m_CPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerDetailColumns", columns, columnNames, true, ProfilerColumn.TotalTime);
     ProfilerColumn[] columnArray3 = new ProfilerColumn[] { ProfilerColumn.FunctionName };
     ProfilerColumn[] columnArray4 = new ProfilerColumn[] { ProfilerColumn.ObjectName };
     this.m_GPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUColumns", columnArray3, ProfilerColumnNames(columnArray3), false, ProfilerColumn.TotalGPUTime);
     columnNames = ProfilerColumnNames(columnArray4);
     columnNames[0] = text;
     this.m_GPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUDetailColumns", columnArray4, columnNames, true, ProfilerColumn.TotalGPUTime);
 }
コード例 #22
0
 public void MoveSelection(int steps, ProfilerHierarchyGUI gui)
 {
   int index = Mathf.Clamp(this.m_SelectedSearchIndex + steps, 0, this.m_NumResultsUsed - 1);
   if (index == this.m_SelectedSearchIndex)
     return;
   this.m_SelectedSearchIndex = index;
   gui.m_Window.SetSelectedPropertyPath(this.m_SearchResults[index].propertyPath);
 }
コード例 #23
0
        private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
        {
            bool     flag               = false;
            Event    current            = Event.current;
            Rect     rowRect            = this.GetRowRect(rowCount);
            Rect     position           = rowRect;
            GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);

            if (current.type == EventType.Repaint)
            {
                rowBackgroundStyle.Draw(position, GUIContent.none, false, false, selected, false);
            }
            float num = (float)property.depth * 16f + 4f;

            if (property.HasChildren)
            {
                flag        = this.IsExpanded(property.propertyPath);
                GUI.changed = false;
                num        -= 14f;
                Rect position2 = new Rect(num, position.y, 14f, 16f);
                flag = GUI.Toggle(position2, flag, GUIContent.none, ProfilerHierarchyGUI.styles.foldout);
                if (GUI.changed)
                {
                    this.SetExpanded(property, flag);
                }
                num += 16f;
            }
            if (current.type == EventType.Repaint)
            {
                this.DrawTextColumn(ref position, property.GetColumn(this.m_ColumnsToShow[0]), 0, (this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName) ? 4f : num, selected);
                ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
                int num2 = 1;
                for (int i = 1; i < this.m_VisibleColumns.Length; i++)
                {
                    if (this.ColIsVisible(i))
                    {
                        position.x    += (float)this.m_Splitter.realSizes[num2 - 1];
                        position.width = (float)this.m_Splitter.realSizes[num2] - 4f;
                        num2++;
                        ProfilerHierarchyGUI.styles.numberLabel.Draw(position, property.GetColumn(this.m_ColumnsToShow[i]), false, false, false, selected);
                    }
                }
                ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
            }
            if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
            {
                GUIUtility.hotControl = 0;
                if (!EditorGUI.actionKey)
                {
                    if (this.m_DetailPane)
                    {
                        if (current.clickCount == 1 && property.instanceIDs.Length > 0)
                        {
                            string text = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                            if (this.m_DetailViewSelectedProperty != text)
                            {
                                this.m_DetailViewSelectedProperty = text;
                                UnityEngine.Object @object = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
                                if (@object is Component)
                                {
                                    @object = ((Component)@object).gameObject;
                                }
                                if (@object != null)
                                {
                                    EditorGUIUtility.PingObject(@object.GetInstanceID());
                                }
                            }
                            else
                            {
                                this.m_DetailViewSelectedProperty = string.Empty;
                            }
                        }
                        else
                        {
                            if (current.clickCount == 2)
                            {
                                ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
                                this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                            }
                        }
                    }
                    else
                    {
                        this.RowMouseDown(property.propertyPath);
                    }
                    this.DoScroll();
                }
                else
                {
                    if (!this.m_DetailPane)
                    {
                        this.m_Window.ClearSelectedPropertyPath();
                    }
                    else
                    {
                        this.m_DetailViewSelectedProperty = string.Empty;
                    }
                }
                GUIUtility.keyboardControl = id;
                current.Use();
            }
            if (selected && GUIUtility.keyboardControl == id && current.type == EventType.KeyDown && (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter))
            {
                ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
            }
            return(flag);
        }
コード例 #24
0
        private int DrawTreeView(ProfilerProperty property, int id)
        {
            this.m_SelectedIndex = -1;
            bool   enterChildren        = true;
            int    num                  = 0;
            string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;

            while (property.Next(enterChildren))
            {
                string propertyPath = property.propertyPath;
                bool   flag         = (!this.m_DetailPane) ? (propertyPath == selectedPropertyPath) : (this.m_DetailViewSelectedProperty != string.Empty && this.m_DetailViewSelectedProperty == ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property));
                if (flag)
                {
                    this.m_SelectedIndex = num;
                }
                bool flag2 = Event.current.type != EventType.Layout;
                flag2 &= (this.m_ScrollViewHeight == 0 || ((float)num * 16f <= (float)this.m_ScrollViewHeight + this.m_TextScroll.y && (float)(num + 1) * 16f > this.m_TextScroll.y));
                if (flag2)
                {
                    enterChildren = this.DrawProfileDataItem(property, num, flag, id);
                }
                else
                {
                    enterChildren = (property.HasChildren && this.IsExpanded(propertyPath));
                }
                num++;
            }
            return(num);
        }
コード例 #25
0
		private void BuildColumns()
		{
			ProfilerColumn[] array = new ProfilerColumn[]
			{
				ProfilerColumn.FunctionName,
				ProfilerColumn.TotalPercent,
				ProfilerColumn.SelfPercent,
				ProfilerColumn.Calls,
				ProfilerColumn.GCMemory,
				ProfilerColumn.TotalTime,
				ProfilerColumn.SelfTime,
				ProfilerColumn.WarningCount
			};
			ProfilerColumn[] array2 = new ProfilerColumn[]
			{
				ProfilerColumn.ObjectName,
				ProfilerColumn.TotalPercent,
				ProfilerColumn.SelfPercent,
				ProfilerColumn.Calls,
				ProfilerColumn.GCMemory,
				ProfilerColumn.TotalTime,
				ProfilerColumn.SelfTime
			};
			this.m_CPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerColumnsV2", array, ProfilerWindow.ProfilerColumnNames(array), false, ProfilerColumn.TotalTime);
			this.m_CPUTimelineGUI = new ProfilerTimelineGUI(this);
			string text = EditorGUIUtility.TextContent("ProfilerColumn.DetailViewObject").text;
			string[] array3 = ProfilerWindow.ProfilerColumnNames(array2);
			array3[0] = text;
			this.m_CPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerDetailColumns", array2, array3, true, ProfilerColumn.TotalTime);
			ProfilerColumn[] array4 = new ProfilerColumn[]
			{
				ProfilerColumn.FunctionName,
				ProfilerColumn.TotalGPUPercent,
				ProfilerColumn.DrawCalls,
				ProfilerColumn.TotalGPUTime
			};
			ProfilerColumn[] array5 = new ProfilerColumn[]
			{
				ProfilerColumn.ObjectName,
				ProfilerColumn.TotalGPUPercent,
				ProfilerColumn.DrawCalls,
				ProfilerColumn.TotalGPUTime
			};
			this.m_GPUHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUColumns", array4, ProfilerWindow.ProfilerColumnNames(array4), false, ProfilerColumn.TotalGPUTime);
			array3 = ProfilerWindow.ProfilerColumnNames(array5);
			array3[0] = text;
			this.m_GPUDetailHierarchyGUI = new ProfilerHierarchyGUI(this, "VisibleProfilerGPUDetailColumns", array5, array3, true, ProfilerColumn.TotalGPUTime);
		}
コード例 #26
0
        private bool DrawProfileDataItem(ProfilerProperty property, int rowCount, bool selected, int id)
        {
            bool     expanded           = false;
            Event    current            = Event.current;
            Rect     rowRect            = this.GetRowRect(rowCount);
            Rect     currentRect        = rowRect;
            GUIStyle rowBackgroundStyle = this.GetRowBackgroundStyle(rowCount);

            if (current.type == EventType.Repaint)
            {
                rowBackgroundStyle.Draw(currentRect, GUIContent.none, false, false, selected, false);
            }
            float num = (float)((double)property.depth * 16.0 + 4.0);

            if (property.HasChildren)
            {
                bool flag = this.IsExpanded(property.propertyPath);
                GUI.changed = false;
                float x = num - 14f;
                expanded = GUI.Toggle(new Rect(x, currentRect.y, 14f, 16f), flag, GUIContent.none, ProfilerHierarchyGUI.styles.foldout);
                if (GUI.changed)
                {
                    this.SetExpanded(property, expanded);
                }
                num = x + 16f;
            }
            string column = property.GetColumn(this.m_ColumnsToShow[0]);

            if (current.type == EventType.Repaint)
            {
                this.DrawTextColumn(ref currentRect, column, 0, this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName ? 4f : num, selected);
            }
            if (ProfilerInstrumentationPopup.InstrumentationEnabled && ProfilerInstrumentationPopup.FunctionHasInstrumentationPopup(column))
            {
                Rect rect = new Rect(Mathf.Clamp((float)((double)currentRect.x + (double)num + 5.0) + ProfilerHierarchyGUI.styles.numberLabel.CalcSize(new GUIContent(column)).x, 0.0f, (float)((double)this.m_Splitter.realSizes[0] - 30.0 + 2.0)), currentRect.y, 30f, 16f);
                if (GUI.Button(rect, ProfilerHierarchyGUI.styles.instrumentationIcon, ProfilerHierarchyGUI.styles.miniPullDown))
                {
                    ProfilerInstrumentationPopup.Show(rect, column);
                }
            }
            if (current.type == EventType.Repaint)
            {
                ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
                int index1 = 1;
                for (int index2 = 1; index2 < this.m_VisibleColumns.Length; ++index2)
                {
                    if (this.ColIsVisible(index2))
                    {
                        currentRect.x    += (float)this.m_Splitter.realSizes[index1 - 1];
                        currentRect.width = (float)this.m_Splitter.realSizes[index1] - 4f;
                        ++index1;
                        ProfilerHierarchyGUI.styles.numberLabel.Draw(currentRect, property.GetColumn(this.m_ColumnsToShow[index2]), false, false, false, selected);
                    }
                }
                ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
            }
            if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
            {
                GUIUtility.hotControl = 0;
                if (!EditorGUI.actionKey)
                {
                    if (this.m_DetailPane)
                    {
                        if (current.clickCount == 1 && property.instanceIDs.Length > 0)
                        {
                            string str = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                            if (this.m_DetailViewSelectedProperty != str)
                            {
                                this.m_DetailViewSelectedProperty = str;
                                UnityEngine.Object gameObject = EditorUtility.InstanceIDToObject(property.instanceIDs[0]);
                                if (gameObject is Component)
                                {
                                    gameObject = (UnityEngine.Object)((Component)gameObject).gameObject;
                                }
                                if (gameObject != (UnityEngine.Object)null)
                                {
                                    EditorGUIUtility.PingObject(gameObject.GetInstanceID());
                                }
                            }
                            else
                            {
                                this.m_DetailViewSelectedProperty = string.Empty;
                            }
                        }
                        else if (current.clickCount == 2)
                        {
                            ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
                            this.m_DetailViewSelectedProperty = ProfilerHierarchyGUI.DetailViewSelectedPropertyPath(property);
                        }
                    }
                    else
                    {
                        this.RowMouseDown(property.propertyPath);
                    }
                    this.DoScroll();
                }
                else if (!this.m_DetailPane)
                {
                    this.m_Window.ClearSelectedPropertyPath();
                }
                else
                {
                    this.m_DetailViewSelectedProperty = string.Empty;
                }
                GUIUtility.keyboardControl = id;
                current.Use();
            }
            if (selected && GUIUtility.keyboardControl == id && current.type == EventType.KeyDown && (current.keyCode == KeyCode.Return || current.keyCode == KeyCode.KeypadEnter))
            {
                ProfilerHierarchyGUI.SelectObjectsInHierarchyView(property);
            }
            return(expanded);
        }
コード例 #27
0
            public void Draw(ProfilerHierarchyGUI gui, int controlID)
            {
                this.HandleCommandEvents(gui);
                Event  current = Event.current;
                string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
                int    firstRowVisible;
                int    lastRowVisible;

                ProfilerHierarchyGUI.SearchResults.GetFirstAndLastRowVisible(this.m_NumResultsUsed, 16f, gui.m_TextScroll.y, (float)gui.m_ScrollViewHeight, out firstRowVisible, out lastRowVisible);
                for (int rowIndex = firstRowVisible; rowIndex <= lastRowVisible; ++rowIndex)
                {
                    bool     flag               = selectedPropertyPath == this.m_SearchResults[rowIndex].propertyPath;
                    Rect     rowRect            = gui.GetRowRect(rowIndex);
                    GUIStyle rowBackgroundStyle = gui.GetRowBackgroundStyle(rowIndex);
                    if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
                    {
                        this.m_SelectedSearchIndex = rowIndex;
                        gui.RowMouseDown(this.m_SearchResults[rowIndex].propertyPath);
                        GUIUtility.keyboardControl = controlID;
                        current.Use();
                    }
                    if (current.type == EventType.Repaint)
                    {
                        rowBackgroundStyle.Draw(rowRect, GUIContent.none, false, false, flag, GUIUtility.keyboardControl == controlID);
                        if (rowRect.Contains(current.mousePosition))
                        {
                            string tooltip = this.m_SearchResults[rowIndex].propertyPath.Replace("/", "/\n");
                            if (this.m_SelectedSearchIndex >= 0)
                            {
                                tooltip += "\n\n(Press 'F' to frame selection)";
                            }
                            GUI.Label(rowRect, GUIContent.Temp(string.Empty, tooltip));
                        }
                        gui.DrawTextColumn(ref rowRect, this.m_SearchResults[rowIndex].columnValues[0], 0, 4f, flag);
                        ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
                        int index1 = 1;
                        for (int index2 = 1; index2 < gui.m_VisibleColumns.Length; ++index2)
                        {
                            if (gui.ColIsVisible(index2))
                            {
                                rowRect.x    += (float)gui.m_Splitter.realSizes[index1 - 1];
                                rowRect.width = (float)gui.m_Splitter.realSizes[index1] - 4f;
                                ++index1;
                                ProfilerHierarchyGUI.styles.numberLabel.Draw(rowRect, this.m_SearchResults[rowIndex].columnValues[index2], false, false, false, flag);
                            }
                        }
                        ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
                    }
                }
                if (this.m_FoundAllResults || current.type != EventType.Repaint)
                {
                    return;
                }
                int      numResultsUsed = this.m_NumResultsUsed;
                Rect     currentRect    = new Rect(1f, 16f * (float)numResultsUsed, GUIClip.visibleRect.width, 16f);
                GUIStyle guiStyle       = numResultsUsed % 2 != 0 ? ProfilerHierarchyGUI.styles.entryOdd : ProfilerHierarchyGUI.styles.entryEven;

                GUI.Label(currentRect, GUIContent.Temp(string.Empty, ProfilerHierarchyGUI.styles.notShowingAllResults.tooltip), GUIStyle.none);
                guiStyle.Draw(currentRect, GUIContent.none, false, false, false, false);
                gui.DrawTextColumn(ref currentRect, ProfilerHierarchyGUI.styles.notShowingAllResults.text, 0, 4f, false);
            }
コード例 #28
0
 public ProfilerDetailedCallsView(ProfilerHierarchyGUI mainProfilerHierarchyGUI) : base(mainProfilerHierarchyGUI)
 {
 }
コード例 #29
0
 public void Draw(ProfilerHierarchyGUI gui, int controlID)
 {
   this.HandleCommandEvents(gui);
   Event current = Event.current;
   string selectedPropertyPath = ProfilerDriver.selectedPropertyPath;
   int firstRowVisible;
   int lastRowVisible;
   ProfilerHierarchyGUI.SearchResults.GetFirstAndLastRowVisible(this.m_NumResultsUsed, 16f, gui.m_TextScroll.y, (float) gui.m_ScrollViewHeight, out firstRowVisible, out lastRowVisible);
   for (int rowIndex = firstRowVisible; rowIndex <= lastRowVisible; ++rowIndex)
   {
     bool flag = selectedPropertyPath == this.m_SearchResults[rowIndex].propertyPath;
     Rect rowRect = gui.GetRowRect(rowIndex);
     GUIStyle rowBackgroundStyle = gui.GetRowBackgroundStyle(rowIndex);
     if (current.type == EventType.MouseDown && rowRect.Contains(current.mousePosition))
     {
       this.m_SelectedSearchIndex = rowIndex;
       gui.RowMouseDown(this.m_SearchResults[rowIndex].propertyPath);
       GUIUtility.keyboardControl = controlID;
       current.Use();
     }
     if (current.type == EventType.Repaint)
     {
       rowBackgroundStyle.Draw(rowRect, GUIContent.none, false, false, flag, GUIUtility.keyboardControl == controlID);
       if (rowRect.Contains(current.mousePosition))
       {
         string tooltip = this.m_SearchResults[rowIndex].propertyPath.Replace("/", "/\n");
         if (this.m_SelectedSearchIndex >= 0)
           tooltip += "\n\n(Press 'F' to frame selection)";
         GUI.Label(rowRect, GUIContent.Temp(string.Empty, tooltip));
       }
       gui.DrawTextColumn(ref rowRect, this.m_SearchResults[rowIndex].columnValues[0], 0, 4f, flag);
       ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleRight;
       int index1 = 1;
       for (int index2 = 1; index2 < gui.m_VisibleColumns.Length; ++index2)
       {
         if (gui.ColIsVisible(index2))
         {
           rowRect.x += (float) gui.m_Splitter.realSizes[index1 - 1];
           rowRect.width = (float) gui.m_Splitter.realSizes[index1] - 4f;
           ++index1;
           ProfilerHierarchyGUI.styles.numberLabel.Draw(rowRect, this.m_SearchResults[rowIndex].columnValues[index2], false, false, false, flag);
         }
       }
       ProfilerHierarchyGUI.styles.numberLabel.alignment = TextAnchor.MiddleLeft;
     }
   }
   if (this.m_FoundAllResults || current.type != EventType.Repaint)
     return;
   int numResultsUsed = this.m_NumResultsUsed;
   Rect currentRect = new Rect(1f, 16f * (float) numResultsUsed, GUIClip.visibleRect.width, 16f);
   GUIStyle guiStyle = numResultsUsed % 2 != 0 ? ProfilerHierarchyGUI.styles.entryOdd : ProfilerHierarchyGUI.styles.entryEven;
   GUI.Label(currentRect, GUIContent.Temp(string.Empty, ProfilerHierarchyGUI.styles.notShowingAllResults.tooltip), GUIStyle.none);
   guiStyle.Draw(currentRect, GUIContent.none, false, false, false, false);
   gui.DrawTextColumn(ref currentRect, ProfilerHierarchyGUI.styles.notShowingAllResults.text, 0, 4f, false);
 }