public void Init(Rect rect, AudioProfilerBackend backend) { this.m_HeaderStyle = "PR Label"; if (this.m_TreeView != null) { return; } this.m_Backend = backend; if (this.m_TreeViewState.columnWidths == null) { int num = AudioProfilerInfoHelper.GetLastColumnIndex() + 1; this.m_TreeViewState.columnWidths = new float[num]; for (int i = 0; i < num; i++) { this.m_TreeViewState.columnWidths[i] = (float)((i < 18) ? 55 : 80); } this.m_TreeViewState.columnWidths[0] = 200f; this.m_TreeViewState.columnWidths[1] = 200f; this.m_TreeViewState.columnWidths[2] = 80f; this.m_TreeViewState.columnWidths[3] = 80f; } this.m_TreeView = new TreeView(this.m_EditorWindow, this.m_TreeViewState); ITreeViewGUI gui = new AudioProfilerView.AudioProfilerViewGUI(this.m_TreeView); ITreeViewDataSource data = new AudioProfilerView.AudioProfilerDataSource(this.m_TreeView, this.m_Backend); this.m_TreeView.Init(rect, data, gui, null); this.m_ColumnHeader = new AudioProfilerView.AudioProfilerViewColumnHeader(this.m_TreeViewState, this.m_Backend); this.m_ColumnHeader.columnWidths = this.m_TreeViewState.columnWidths; this.m_ColumnHeader.minColumnWidth = 30f; TreeView expr_14C = this.m_TreeView; expr_14C.selectionChangedCallback = (Action <int[]>)Delegate.Combine(expr_14C.selectionChangedCallback, new Action <int[]>(this.OnTreeSelectionChanged)); }
public void Init(Rect rect, AudioProfilerBackend backend) { if (this.m_HeaderStyle == null) { this.m_HeaderStyle = new GUIStyle("OL title"); } this.m_HeaderStyle.alignment = TextAnchor.MiddleLeft; if (this.m_TreeView != null) { return; } this.m_Backend = backend; if (this.m_TreeViewState.columnWidths == null) { int num = AudioProfilerInfoHelper.GetLastColumnIndex() + 1; this.m_TreeViewState.columnWidths = new float[num]; for (int i = 2; i < num; i++) { this.m_TreeViewState.columnWidths[i] = (float)((i != 2 && i != 3 && (i < 11 || i > 16)) ? 60 : 75); } this.m_TreeViewState.columnWidths[0] = 140f; this.m_TreeViewState.columnWidths[1] = 140f; } this.m_TreeView = new TreeView(this.m_EditorWindow, this.m_TreeViewState); ITreeViewGUI gui = new AudioProfilerView.AudioProfilerViewGUI(this.m_TreeView); ITreeViewDataSource data = new AudioProfilerView.AudioProfilerDataSource(this.m_TreeView, this.m_Backend); this.m_TreeView.Init(rect, data, gui, null); this.m_ColumnHeader = new AudioProfilerView.AudioProfilerViewColumnHeader(this.m_TreeViewState, this.m_Backend); this.m_ColumnHeader.columnWidths = this.m_TreeViewState.columnWidths; this.m_ColumnHeader.minColumnWidth = 30f; TreeView expr_15A = this.m_TreeView; expr_15A.selectionChangedCallback = (Action <int[]>)Delegate.Combine(expr_15A.selectionChangedCallback, new Action <int[]>(this.OnTreeSelectionChanged)); }
public void Init(Rect rect, AudioProfilerBackend backend) { if (this.m_HeaderStyle == null) { this.m_HeaderStyle = new GUIStyle((GUIStyle)"OL title"); } this.m_HeaderStyle.alignment = TextAnchor.MiddleLeft; if (this.m_TreeView != null) { return; } this.m_Backend = backend; if (this.m_TreeViewState.columnWidths == null) { int length = AudioProfilerInfoHelper.GetLastColumnIndex() + 1; this.m_TreeViewState.columnWidths = new float[length]; for (int index = 2; index < length; ++index) { this.m_TreeViewState.columnWidths[index] = index == 2 || index == 3 || index >= 11 && index <= 16 ? 75f : 60f; } this.m_TreeViewState.columnWidths[0] = 140f; this.m_TreeViewState.columnWidths[1] = 140f; } this.m_TreeView = new TreeView(this.m_EditorWindow, (TreeViewState)this.m_TreeViewState); ITreeViewGUI gui = (ITreeViewGUI) new AudioProfilerView.AudioProfilerViewGUI(this.m_TreeView); ITreeViewDataSource data = (ITreeViewDataSource) new AudioProfilerView.AudioProfilerDataSource(this.m_TreeView, this.m_Backend); this.m_TreeView.Init(rect, data, gui, (ITreeViewDragging)null); this.m_ColumnHeader = new AudioProfilerView.AudioProfilerViewColumnHeader(this.m_TreeViewState, this.m_Backend); this.m_ColumnHeader.columnWidths = this.m_TreeViewState.columnWidths; this.m_ColumnHeader.minColumnWidth = 30f; this.m_TreeView.selectionChangedCallback += new System.Action <int[]>(this.OnTreeSelectionChanged); }
protected override void DrawIconAndLabel(Rect rect, TreeViewItem item, string label, bool selected, bool focused, bool useBoldFont, bool isPinging) { GUIStyle gUIStyle = (!useBoldFont) ? TreeViewGUI.s_Styles.lineStyle : TreeViewGUI.s_Styles.lineBoldStyle; gUIStyle.alignment = TextAnchor.MiddleLeft; gUIStyle.padding.left = 0; base.DrawIconAndLabel(new Rect(rect.x, rect.y, this.columnWidths[0], rect.height), item, label, selected, focused, useBoldFont, isPinging); gUIStyle.alignment = TextAnchor.MiddleRight; rect.x += this.columnWidths[0]; AudioProfilerView.AudioProfilerTreeViewItem audioProfilerTreeViewItem = item as AudioProfilerView.AudioProfilerTreeViewItem; for (int i = 1; i < this.columnWidths.Length; i++) { rect.width = this.columnWidths[i] - 3f; gUIStyle.Draw(rect, AudioProfilerInfoHelper.GetColumnString(audioProfilerTreeViewItem.info, (AudioProfilerInfoHelper.ColumnIndices)i), false, false, selected, focused); rect.x += this.columnWidths[i]; } gUIStyle.alignment = TextAnchor.MiddleLeft; }
public void OnGUI(Rect rect, bool allowSorting) { float x = rect.x; int lastColumnIndex = AudioProfilerInfoHelper.GetLastColumnIndex(); for (int i = 0; i <= lastColumnIndex; i++) { Rect position = new Rect(x, rect.y, this.columnWidths[i], rect.height); x += this.columnWidths[i]; Rect rect3 = new Rect(x - (this.dragWidth / 2f), rect.y, 3f, rect.height); float num5 = EditorGUI.MouseDeltaReader(rect3, true).x; if (num5 != 0f) { this.columnWidths[i] += num5; this.columnWidths[i] = Mathf.Max(this.columnWidths[i], this.minColumnWidth); } if (this.m_HeaderStyle == null) { this.m_HeaderStyle = new GUIStyle("PR Label"); this.m_HeaderStyle.padding.left = 4; } this.m_HeaderStyle.alignment = (i != 0) ? TextAnchor.MiddleRight : TextAnchor.MiddleLeft; string[] strArray = new string[] { "Object", "Asset", "Volume", "Audibility", "Plays", "3D", "Paused", "Muted", "Virtual", "OneShot", "Looped", "Distance", "MinDist", "MaxDist", "Time", "Duration", "Frequency", "Stream", "Compressed", "NonBlocking", "User", "Memory", "MemoryPoint" }; string text = strArray[i]; if (allowSorting && (i == this.m_TreeViewState.selectedColumn)) { text = text + (!this.m_TreeViewState.sortByDescendingOrder ? " ▲" : " ▼"); } GUI.Label(position, text, this.m_HeaderStyle); if ((allowSorting && (Event.current.type == EventType.MouseDown)) && position.Contains(Event.current.mousePosition)) { this.m_TreeViewState.SetSelectedColumn(i); this.m_Backend.UpdateSorting(); } if (Event.current.type == EventType.Repaint) { EditorGUIUtility.AddCursorRect(rect3, MouseCursor.SplitResizeLeftRight); } } }
protected override void DrawIconAndLabel(Rect rect, TreeViewItem item, string label, bool selected, bool focused, bool useBoldFont, bool isPinging) { GUIStyle guiStyle = !useBoldFont ? TreeViewGUI.s_Styles.lineStyle : TreeViewGUI.s_Styles.lineBoldStyle; guiStyle.alignment = TextAnchor.MiddleLeft; guiStyle.padding.left = 0; int num = 2; base.DrawIconAndLabel(new Rect(rect.x, rect.y, this.columnWidths[0] - (float)num, rect.height), item, label, selected, focused, useBoldFont, isPinging); rect.x += this.columnWidths[0] + (float)num; AudioProfilerView.AudioProfilerTreeViewItem profilerTreeViewItem = item as AudioProfilerView.AudioProfilerTreeViewItem; for (int index = 1; index < this.columnWidths.Length; ++index) { rect.width = this.columnWidths[index] - (float)(2 * num); guiStyle.Draw(rect, AudioProfilerInfoHelper.GetColumnString(profilerTreeViewItem.info, (AudioProfilerInfoHelper.ColumnIndices)index), false, false, selected, focused); Handles.color = Color.black; Handles.DrawLine(new Vector3((float)((double)rect.x - (double)num + 1.0), rect.y, 0.0f), new Vector3((float)((double)rect.x - (double)num + 1.0), rect.y + rect.height, 0.0f)); rect.x += this.columnWidths[index]; guiStyle.alignment = TextAnchor.MiddleRight; } guiStyle.alignment = TextAnchor.MiddleLeft; }
public void OnGUI(Rect rect, bool allowSorting, GUIStyle headerStyle) { GUIClip.Push(rect, Vector2.zero, Vector2.zero, false); float x1 = -this.m_TreeViewState.scrollPos.x; int lastColumnIndex = AudioProfilerInfoHelper.GetLastColumnIndex(); for (int index = 0; index <= lastColumnIndex; ++index) { Rect position1 = new Rect(x1, 0.0f, this.columnWidths[index], rect.height - 1f); x1 += this.columnWidths[index]; Rect position2 = new Rect(x1 - this.dragWidth / 2f, 0.0f, 3f, rect.height); float x2 = EditorGUI.MouseDeltaReader(position2, true).x; if ((double)x2 != 0.0) { this.columnWidths[index] += x2; this.columnWidths[index] = Mathf.Max(this.columnWidths[index], this.minColumnWidth); } string text = new string[23] { "Object", "Asset", "Volume", "Audibility", "Plays", "3D", "Paused", "Muted", "Virtual", "OneShot", "Looped", "Distance", "MinDist", "MaxDist", "Time", "Duration", "Frequency", "Stream", "Compressed", "NonBlocking", "User", "Memory", "MemoryPoint" }[index]; if (allowSorting && index == this.m_TreeViewState.selectedColumn) { text += !this.m_TreeViewState.sortByDescendingOrder ? " ▲" : " ▼"; } GUI.Box(position1, text, headerStyle); if (allowSorting && Event.current.type == EventType.MouseDown && position1.Contains(Event.current.mousePosition)) { this.m_TreeViewState.SetSelectedColumn(index); this.m_Backend.UpdateSorting(); } if (Event.current.type == EventType.Repaint) { EditorGUIUtility.AddCursorRect(position2, MouseCursor.SplitResizeLeftRight); } } GUIClip.Pop(); }
public static string GetColumnString(AudioProfilerInfoWrapper info, AudioProfilerInfoHelper.ColumnIndices index) { bool flag = (info.info.flags & 1) != 0; bool flag2 = (info.info.flags & 64) != 0; switch (index) { case AudioProfilerInfoHelper.ColumnIndices.ObjectName: return(info.objectName); case AudioProfilerInfoHelper.ColumnIndices.AssetName: return(info.assetName); case AudioProfilerInfoHelper.ColumnIndices.Volume: return(AudioProfilerInfoHelper.FormatDb(info.info.volume)); case AudioProfilerInfoHelper.ColumnIndices.Audibility: return((!flag2) ? AudioProfilerInfoHelper.FormatDb(info.info.audibility) : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.PlayCount: return((!flag2) ? info.info.playCount.ToString() : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.Is3D: return((!flag2) ? ((!flag) ? "NO" : (((info.info.flags & 2) == 0) ? "YES" : "Spatial")) : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.IsPaused: return((!flag2) ? (((info.info.flags & 4) == 0) ? "NO" : "YES") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.IsMuted: return((!flag2) ? (((info.info.flags & 8) == 0) ? "NO" : "YES") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.IsVirtual: return((!flag2) ? (((info.info.flags & 16) == 0) ? "NO" : "YES") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.IsOneShot: return((!flag2) ? (((info.info.flags & 32) == 0) ? "NO" : "YES") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.IsLooped: return((!flag2) ? (((info.info.flags & 512) == 0) ? "NO" : "YES") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.DistanceToListener: return((!flag2) ? (flag ? ((info.info.distanceToListener < 1000f) ? string.Format("{0:0.00} m", info.info.distanceToListener) : string.Format("{0:0.00} km", info.info.distanceToListener * 0.001f)) : "N/A") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.MinDist: return((!flag2) ? (flag ? ((info.info.minDist < 1000f) ? string.Format("{0:0.00} m", info.info.minDist) : string.Format("{0:0.00} km", info.info.minDist * 0.001f)) : "N/A") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.MaxDist: return((!flag2) ? (flag ? ((info.info.maxDist < 1000f) ? string.Format("{0:0.00} m", info.info.maxDist) : string.Format("{0:0.00} km", info.info.maxDist * 0.001f)) : "N/A") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.Time: return((!flag2) ? string.Format("{0:0.00} s", info.info.time) : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.Duration: return((!flag2) ? string.Format("{0:0.00} s", info.info.duration) : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.Frequency: return((!flag2) ? ((info.info.frequency < 1000f) ? string.Format("{0:0.00} Hz", info.info.frequency) : string.Format("{0:0.00} kHz", info.info.frequency * 0.001f)) : string.Format("{0:0.00} x", info.info.frequency)); case AudioProfilerInfoHelper.ColumnIndices.IsStream: return((!flag2) ? (((info.info.flags & 128) == 0) ? "NO" : "YES") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.IsCompressed: return((!flag2) ? (((info.info.flags & 256) == 0) ? "NO" : "YES") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.IsNonBlocking: return((!flag2) ? (((info.info.flags & 8192) == 0) ? "NO" : "YES") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.IsOpenUser: return((!flag2) ? (((info.info.flags & 4096) == 0) ? "NO" : "YES") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.IsOpenMemory: return((!flag2) ? (((info.info.flags & 1024) == 0) ? "NO" : "YES") : string.Empty); case AudioProfilerInfoHelper.ColumnIndices.IsOpenMemoryPoint: return((!flag2) ? (((info.info.flags & 2048) == 0) ? "NO" : "YES") : string.Empty); default: return("Unknown"); } }
public static string GetColumnString(AudioProfilerInfoWrapper info, AudioProfilerInfoHelper.ColumnIndices index) { bool flag1 = (info.info.flags & 1) != 0; bool flag2 = (info.info.flags & 64) != 0; switch (index) { case AudioProfilerInfoHelper.ColumnIndices.ObjectName: return(info.objectName); case AudioProfilerInfoHelper.ColumnIndices.AssetName: return(info.assetName); case AudioProfilerInfoHelper.ColumnIndices.Volume: return(AudioProfilerInfoHelper.FormatDb(info.info.volume)); case AudioProfilerInfoHelper.ColumnIndices.Audibility: if (flag2) { return(string.Empty); } return(AudioProfilerInfoHelper.FormatDb(info.info.audibility)); case AudioProfilerInfoHelper.ColumnIndices.PlayCount: if (flag2) { return(string.Empty); } return(info.info.playCount.ToString()); case AudioProfilerInfoHelper.ColumnIndices.Is3D: if (flag2) { return(string.Empty); } if (!flag1) { return("NO"); } return((info.info.flags & 2) != 0 ? "Spatial" : "YES"); case AudioProfilerInfoHelper.ColumnIndices.IsPaused: if (flag2) { return(string.Empty); } return((info.info.flags & 4) != 0 ? "YES" : "NO"); case AudioProfilerInfoHelper.ColumnIndices.IsMuted: if (flag2) { return(string.Empty); } return((info.info.flags & 8) != 0 ? "YES" : "NO"); case AudioProfilerInfoHelper.ColumnIndices.IsVirtual: if (flag2) { return(string.Empty); } return((info.info.flags & 16) != 0 ? "YES" : "NO"); case AudioProfilerInfoHelper.ColumnIndices.IsOneShot: if (flag2) { return(string.Empty); } return((info.info.flags & 32) != 0 ? "YES" : "NO"); case AudioProfilerInfoHelper.ColumnIndices.IsLooped: if (flag2) { return(string.Empty); } return((info.info.flags & 512) != 0 ? "YES" : "NO"); case AudioProfilerInfoHelper.ColumnIndices.DistanceToListener: if (flag2) { return(string.Empty); } if (!flag1) { return("N/A"); } if ((double)info.info.distanceToListener >= 1000.0) { return(string.Format("{0:0.00} km", (object)(float)((double)info.info.distanceToListener * (1.0 / 1000.0)))); } return(string.Format("{0:0.00} m", (object)info.info.distanceToListener)); case AudioProfilerInfoHelper.ColumnIndices.MinDist: if (flag2) { return(string.Empty); } if (!flag1) { return("N/A"); } if ((double)info.info.minDist >= 1000.0) { return(string.Format("{0:0.00} km", (object)(float)((double)info.info.minDist * (1.0 / 1000.0)))); } return(string.Format("{0:0.00} m", (object)info.info.minDist)); case AudioProfilerInfoHelper.ColumnIndices.MaxDist: if (flag2) { return(string.Empty); } if (!flag1) { return("N/A"); } if ((double)info.info.maxDist >= 1000.0) { return(string.Format("{0:0.00} km", (object)(float)((double)info.info.maxDist * (1.0 / 1000.0)))); } return(string.Format("{0:0.00} m", (object)info.info.maxDist)); case AudioProfilerInfoHelper.ColumnIndices.Time: if (flag2) { return(string.Empty); } return(string.Format("{0:0.00} s", (object)info.info.time)); case AudioProfilerInfoHelper.ColumnIndices.Duration: if (flag2) { return(string.Empty); } return(string.Format("{0:0.00} s", (object)info.info.duration)); case AudioProfilerInfoHelper.ColumnIndices.Frequency: if (flag2) { return(string.Format("{0:0.00} x", (object)info.info.frequency)); } if ((double)info.info.frequency >= 1000.0) { return(string.Format("{0:0.00} kHz", (object)(float)((double)info.info.frequency * (1.0 / 1000.0)))); } return(string.Format("{0:0.00} Hz", (object)info.info.frequency)); case AudioProfilerInfoHelper.ColumnIndices.IsStream: if (flag2) { return(string.Empty); } return((info.info.flags & 128) != 0 ? "YES" : "NO"); case AudioProfilerInfoHelper.ColumnIndices.IsCompressed: if (flag2) { return(string.Empty); } return((info.info.flags & 256) != 0 ? "YES" : "NO"); case AudioProfilerInfoHelper.ColumnIndices.IsNonBlocking: if (flag2) { return(string.Empty); } return((info.info.flags & 8192) != 0 ? "YES" : "NO"); case AudioProfilerInfoHelper.ColumnIndices.IsOpenUser: if (flag2) { return(string.Empty); } return((info.info.flags & 4096) != 0 ? "YES" : "NO"); case AudioProfilerInfoHelper.ColumnIndices.IsOpenMemory: if (flag2) { return(string.Empty); } return((info.info.flags & 1024) != 0 ? "YES" : "NO"); case AudioProfilerInfoHelper.ColumnIndices.IsOpenMemoryPoint: if (flag2) { return(string.Empty); } return((info.info.flags & 2048) != 0 ? "YES" : "NO"); default: return("Unknown"); } }