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])); }
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(); } }
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); }
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); } } } }
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); }
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); }
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); }
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); }