Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
            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);
                    }
                }
            }
Ejemplo n.º 5
0
            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();
            }