public override void FetchData() { AudioProfilerClipView.AudioProfilerClipTreeViewItem audioProfilerClipTreeViewItem = new AudioProfilerClipView.AudioProfilerClipTreeViewItem(1, 0, null, "ROOT", new AudioProfilerClipInfoWrapper(default(AudioProfilerClipInfo), "ROOT")); this.FillTreeItems(audioProfilerClipTreeViewItem, 1, 0, this.m_Backend.items); this.m_RootItem = audioProfilerClipTreeViewItem; this.SetExpandedWithChildren(this.m_RootItem, true); this.m_NeedRefreshRows = true; }
private void FillTreeItems(AudioProfilerClipView.AudioProfilerClipTreeViewItem parentNode, int depth, int parentId, List <AudioProfilerClipInfoWrapper> items) { parentNode.children = new List <TreeViewItem>(items.Count); int num = 1; foreach (AudioProfilerClipInfoWrapper current in items) { AudioProfilerClipView.AudioProfilerClipTreeViewItem item = new AudioProfilerClipView.AudioProfilerClipTreeViewItem(++num, 1, parentNode, current.assetName, current); parentNode.children.Add(item); } }
public void OnTreeSelectionChanged(int[] selection) { if (selection.Length == 1) { TreeViewItem treeViewItem = this.m_TreeView.FindItem(selection[0]); AudioProfilerClipView.AudioProfilerClipTreeViewItem audioProfilerClipTreeViewItem = treeViewItem as AudioProfilerClipView.AudioProfilerClipTreeViewItem; if (audioProfilerClipTreeViewItem != null) { EditorGUIUtility.PingObject(audioProfilerClipTreeViewItem.info.info.assetInstanceId); } } }
protected override void OnContentGUI(Rect rect, int row, TreeViewItem item, string label, bool selected, bool focused, bool useBoldFont, bool isPinging) { if (Event.current.type == EventType.Repaint) { GUIStyle gUIStyle = (!useBoldFont) ? TreeViewGUI.Styles.lineStyle : TreeViewGUI.Styles.lineBoldStyle; gUIStyle.alignment = TextAnchor.MiddleLeft; gUIStyle.padding.left = 0; int num = 2; base.OnContentGUI(new Rect(rect.x, rect.y, this.columnWidths[0] - (float)num, rect.height), row, item, label, selected, focused, useBoldFont, isPinging); rect.x += this.columnWidths[0] + (float)num; AudioProfilerClipView.AudioProfilerClipTreeViewItem audioProfilerClipTreeViewItem = item as AudioProfilerClipView.AudioProfilerClipTreeViewItem; for (int i = 1; i < this.columnWidths.Length; i++) { rect.width = this.columnWidths[i] - (float)(2 * num); gUIStyle.alignment = TextAnchor.MiddleRight; gUIStyle.Draw(rect, AudioProfilerClipInfoHelper.GetColumnString(audioProfilerClipTreeViewItem.info, (AudioProfilerClipInfoHelper.ColumnIndices)i), false, false, selected, focused); Handles.color = Color.black; Handles.DrawLine(new Vector3(rect.x - (float)num + 1f, rect.y, 0f), new Vector3(rect.x - (float)num + 1f, rect.y + rect.height, 0f)); rect.x += this.columnWidths[i]; } gUIStyle.alignment = TextAnchor.MiddleLeft; } }