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; } string column = property.GetColumn(this.m_ColumnsToShow[0]); if (current.type == EventType.Repaint) { this.DrawTextColumn(ref position, column, 0, (this.m_ColumnsToShow[0] != ProfilerColumn.FunctionName) ? 4f : num, selected); } if (ProfilerInstrumentationPopup.InstrumentationEnabled && ProfilerInstrumentationPopup.FunctionHasInstrumentationPopup(column)) { float num2 = position.x + num + 5f + ProfilerHierarchyGUI.styles.numberLabel.CalcSize(new GUIContent(column)).x; num2 = Mathf.Clamp(num2, 0f, (float)this.m_Splitter.realSizes[0] - 30f + 2f); Rect rect = new Rect(num2, position.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 num3 = 1; for (int i = 1; i < this.m_VisibleColumns.Length; i++) { if (this.ColIsVisible(i)) { position.x += (float)this.m_Splitter.realSizes[num3 - 1]; position.width = (float)this.m_Splitter.realSizes[num3] - 4f; num3++; 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 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); }