private void FillTreeItems(AudioProfilerGroupView.AudioProfilerGroupTreeViewItem parentNode, int depth, int parentId, List <AudioProfilerGroupInfoWrapper> items) { int capacity = 0; foreach (AudioProfilerGroupInfoWrapper wrapper in items) { if (parentId == (!wrapper.addToRoot ? wrapper.info.parentId : 0)) { capacity++; } } if (capacity > 0) { parentNode.children = new List <TreeViewItem>(capacity); foreach (AudioProfilerGroupInfoWrapper wrapper2 in items) { if (parentId == (!wrapper2.addToRoot ? wrapper2.info.parentId : 0)) { AudioProfilerGroupView.AudioProfilerGroupTreeViewItem item = new AudioProfilerGroupView.AudioProfilerGroupTreeViewItem(wrapper2.info.uniqueId, !wrapper2.addToRoot ? depth : 1, parentNode, wrapper2.objectName, wrapper2); parentNode.children.Add(item); this.FillTreeItems(item, depth + 1, wrapper2.info.uniqueId, items); } } } }
private void FillTreeItems(AudioProfilerGroupView.AudioProfilerGroupTreeViewItem parentNode, int depth, int parentId, List <AudioProfilerGroupInfoWrapper> items) { int num = 0; foreach (AudioProfilerGroupInfoWrapper current in items) { if (parentId == ((!current.addToRoot) ? current.info.parentId : 0)) { num++; } } if (num > 0) { parentNode.children = new List <TreeViewItem>(num); foreach (AudioProfilerGroupInfoWrapper current2 in items) { if (parentId == ((!current2.addToRoot) ? current2.info.parentId : 0)) { AudioProfilerGroupView.AudioProfilerGroupTreeViewItem audioProfilerGroupTreeViewItem = new AudioProfilerGroupView.AudioProfilerGroupTreeViewItem(current2.info.uniqueId, (!current2.addToRoot) ? depth : 1, parentNode, current2.objectName, current2); parentNode.children.Add(audioProfilerGroupTreeViewItem); this.FillTreeItems(audioProfilerGroupTreeViewItem, depth + 1, current2.info.uniqueId, items); } } } }
public override void FetchData() { AudioProfilerGroupView.AudioProfilerGroupTreeViewItem parentNode = new AudioProfilerGroupView.AudioProfilerGroupTreeViewItem(1, 0, null, "ROOT", new AudioProfilerGroupInfoWrapper(new AudioProfilerGroupInfo(), "ROOT", "ROOT", false)); this.FillTreeItems(parentNode, 1, 0, this.m_Backend.items); base.m_RootItem = parentNode; this.SetExpandedWithChildren(base.m_RootItem, true); base.m_NeedRefreshRows = true; }
public override void FetchData() { AudioProfilerGroupView.AudioProfilerGroupTreeViewItem audioProfilerGroupTreeViewItem = new AudioProfilerGroupView.AudioProfilerGroupTreeViewItem(1, 0, null, "ROOT", new AudioProfilerGroupInfoWrapper(default(AudioProfilerGroupInfo), "ROOT", "ROOT", false)); this.FillTreeItems(audioProfilerGroupTreeViewItem, 1, 0, this.m_Backend.items); this.m_RootItem = audioProfilerGroupTreeViewItem; this.SetExpandedWithChildren(this.m_RootItem, true); this.m_NeedRefreshRows = true; }
public void OnTreeSelectionChanged(int[] selection) { if (selection.Length == 1) { TreeViewItem treeViewItem = this.m_TreeView.FindItem(selection[0]); AudioProfilerGroupView.AudioProfilerGroupTreeViewItem audioProfilerGroupTreeViewItem = treeViewItem as AudioProfilerGroupView.AudioProfilerGroupTreeViewItem; if (audioProfilerGroupTreeViewItem != null) { EditorGUIUtility.PingObject(audioProfilerGroupTreeViewItem.info.info.assetInstanceId); this.delayedPingObject = audioProfilerGroupTreeViewItem.info.info.objectInstanceId; EditorApplication.CallDelayed(new EditorApplication.CallbackFunction(this.PingObjectDelayed), 1f); } } }
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.s_Styles.lineStyle : TreeViewGUI.s_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; AudioProfilerGroupView.AudioProfilerGroupTreeViewItem audioProfilerGroupTreeViewItem = item as AudioProfilerGroupView.AudioProfilerGroupTreeViewItem; for (int i = 1; i < this.columnWidths.Length; i++) { rect.width = this.columnWidths[i] - (float)(2 * num); gUIStyle.Draw(rect, AudioProfilerGroupInfoHelper.GetColumnString(audioProfilerGroupTreeViewItem.info, (AudioProfilerGroupInfoHelper.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.MiddleRight; } gUIStyle.alignment = TextAnchor.MiddleLeft; } }