UnityEditor.ProfilerWindow.DrawAudioPane C# (CSharp) Method

DrawAudioPane() private method

private DrawAudioPane ( ) : void
return void
        private void DrawAudioPane()
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            ProfilerAudioView showDetailedAudioPane = this.m_ShowDetailedAudioPane;
            if (GUILayout.Toggle(showDetailedAudioPane == ProfilerAudioView.Stats, "Stats", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                showDetailedAudioPane = ProfilerAudioView.Stats;
            }
            if (GUILayout.Toggle(showDetailedAudioPane == ProfilerAudioView.Channels, "Channels", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                showDetailedAudioPane = ProfilerAudioView.Channels;
            }
            if (GUILayout.Toggle(showDetailedAudioPane == ProfilerAudioView.Groups, "Groups", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                showDetailedAudioPane = ProfilerAudioView.Groups;
            }
            if (GUILayout.Toggle(showDetailedAudioPane == ProfilerAudioView.ChannelsAndGroups, "Channels and groups", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                showDetailedAudioPane = ProfilerAudioView.ChannelsAndGroups;
            }
            if (Unsupported.IsDeveloperBuild() && GUILayout.Toggle(showDetailedAudioPane == ProfilerAudioView.DSPGraph, "DSP Graph", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                showDetailedAudioPane = ProfilerAudioView.DSPGraph;
            }
            if (Unsupported.IsDeveloperBuild() && GUILayout.Toggle(showDetailedAudioPane == ProfilerAudioView.Clips, "Clips", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                showDetailedAudioPane = ProfilerAudioView.Clips;
            }
            if (showDetailedAudioPane != this.m_ShowDetailedAudioPane)
            {
                this.m_ShowDetailedAudioPane = showDetailedAudioPane;
                this.m_LastAudioProfilerFrame = -1;
            }
            if (this.m_ShowDetailedAudioPane == ProfilerAudioView.Stats)
            {
                GUILayout.Space(5f);
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                this.DrawOverviewText(this.m_CurrentArea);
            }
            else if (this.m_ShowDetailedAudioPane == ProfilerAudioView.DSPGraph)
            {
                GUILayout.Space(5f);
                this.AudioProfilerToggle(ProfilerCaptureFlags.DSPNodes);
                GUILayout.Space(5f);
                this.m_ShowInactiveDSPChains = GUILayout.Toggle(this.m_ShowInactiveDSPChains, "Show inactive", EditorStyles.toolbarButton, new GUILayoutOption[0]);
                if (this.m_ShowInactiveDSPChains)
                {
                    this.m_HighlightAudibleDSPChains = GUILayout.Toggle(this.m_HighlightAudibleDSPChains, "Highlight audible", EditorStyles.toolbarButton, new GUILayoutOption[0]);
                }
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                Rect position = GUILayoutUtility.GetRect(20f, 10000f, (float) 10f, (float) 20000f);
                this.m_PaneScroll_AudioDSP = GUI.BeginScrollView(position, this.m_PaneScroll_AudioDSP, new Rect(0f, 0f, 10000f, 20000f));
                Rect clippingRect = new Rect(this.m_PaneScroll_AudioDSP.x, this.m_PaneScroll_AudioDSP.y, position.width, position.height);
                if (this.m_AudioProfilerDSPView == null)
                {
                    this.m_AudioProfilerDSPView = new AudioProfilerDSPView();
                }
                ProfilerProperty property = this.CreateProperty(false);
                if (CheckFrameData(property))
                {
                    this.m_AudioProfilerDSPView.OnGUI(clippingRect, property, this.m_ShowInactiveDSPChains, this.m_HighlightAudibleDSPChains, ref this.m_DSPGraphZoomFactor, ref this.m_PaneScroll_AudioDSP);
                }
                property.Cleanup();
                GUI.EndScrollView();
                base.Repaint();
            }
            else if (this.m_ShowDetailedAudioPane == ProfilerAudioView.Clips)
            {
                GUILayout.Space(5f);
                this.AudioProfilerToggle(ProfilerCaptureFlags.Clips);
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                Rect rect3 = GUILayoutUtility.GetRect(20f, 20000f, (float) 10f, (float) 10000f);
                Rect rect4 = new Rect(rect3.x, rect3.y, 230f, rect3.height);
                Rect rect = new Rect(rect4.xMax, rect3.y, rect3.width - rect4.width, rect3.height);
                string overviewText = ProfilerDriver.GetOverviewText(this.m_CurrentArea, this.GetActiveVisibleFrameIndex());
                Vector2 vector = EditorStyles.wordWrappedLabel.CalcSize(GUIContent.Temp(overviewText));
                this.m_PaneScroll_AudioClips = GUI.BeginScrollView(rect4, this.m_PaneScroll_AudioClips, new Rect(0f, 0f, vector.x, vector.y));
                GUI.Label(new Rect(3f, 3f, vector.x, vector.y), overviewText, EditorStyles.wordWrappedLabel);
                GUI.EndScrollView();
                EditorGUI.DrawRect(new Rect(rect4.xMax - 1f, rect4.y, 1f, rect4.height), Color.black);
                if (this.m_AudioProfilerClipTreeViewState == null)
                {
                    this.m_AudioProfilerClipTreeViewState = new AudioProfilerClipTreeViewState();
                }
                if (this.m_AudioProfilerClipViewBackend == null)
                {
                    this.m_AudioProfilerClipViewBackend = new AudioProfilerClipViewBackend(this.m_AudioProfilerClipTreeViewState);
                }
                ProfilerProperty property2 = this.CreateProperty(false);
                if (CheckFrameData(property2))
                {
                    if ((this.m_CurrentFrame == -1) || (this.m_LastAudioProfilerFrame != this.m_CurrentFrame))
                    {
                        this.m_LastAudioProfilerFrame = this.m_CurrentFrame;
                        AudioProfilerClipInfo[] audioProfilerClipInfo = property2.GetAudioProfilerClipInfo();
                        if ((audioProfilerClipInfo != null) && (audioProfilerClipInfo.Length > 0))
                        {
                            List<AudioProfilerClipInfoWrapper> data = new List<AudioProfilerClipInfoWrapper>();
                            foreach (AudioProfilerClipInfo info in audioProfilerClipInfo)
                            {
                                data.Add(new AudioProfilerClipInfoWrapper(info, property2.GetAudioProfilerNameByOffset(info.assetNameOffset)));
                            }
                            this.m_AudioProfilerClipViewBackend.SetData(data);
                            if (this.m_AudioProfilerClipView == null)
                            {
                                this.m_AudioProfilerClipView = new AudioProfilerClipView(this, this.m_AudioProfilerClipTreeViewState);
                                this.m_AudioProfilerClipView.Init(rect, this.m_AudioProfilerClipViewBackend);
                            }
                        }
                    }
                    if (this.m_AudioProfilerClipView != null)
                    {
                        this.m_AudioProfilerClipView.OnGUI(rect);
                    }
                }
                property2.Cleanup();
            }
            else
            {
                GUILayout.Space(5f);
                this.AudioProfilerToggle(ProfilerCaptureFlags.Channels);
                GUILayout.Space(5f);
                bool flag = GUILayout.Toggle(AudioUtil.resetAllAudioClipPlayCountsOnPlay, "Reset play count on play", EditorStyles.toolbarButton, new GUILayoutOption[0]);
                if (flag != AudioUtil.resetAllAudioClipPlayCountsOnPlay)
                {
                    AudioUtil.resetAllAudioClipPlayCountsOnPlay = flag;
                }
                if (Unsupported.IsDeveloperBuild())
                {
                    GUILayout.Space(5f);
                    bool @bool = EditorPrefs.GetBool("AudioProfilerShowAllGroups");
                    bool flag3 = GUILayout.Toggle(@bool, "Show all groups (dev-builds only)", EditorStyles.toolbarButton, new GUILayoutOption[0]);
                    if (@bool != flag3)
                    {
                        EditorPrefs.SetBool("AudioProfilerShowAllGroups", flag3);
                    }
                }
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                Rect rect6 = GUILayoutUtility.GetRect(20f, 20000f, (float) 10f, (float) 10000f);
                Rect rect7 = new Rect(rect6.x, rect6.y, 230f, rect6.height);
                Rect rect8 = new Rect(rect7.xMax, rect6.y, rect6.width - rect7.width, rect6.height);
                string t = ProfilerDriver.GetOverviewText(this.m_CurrentArea, this.GetActiveVisibleFrameIndex());
                Vector2 vector2 = EditorStyles.wordWrappedLabel.CalcSize(GUIContent.Temp(t));
                this.m_PaneScroll_AudioChannels = GUI.BeginScrollView(rect7, this.m_PaneScroll_AudioChannels, new Rect(0f, 0f, vector2.x, vector2.y));
                GUI.Label(new Rect(3f, 3f, vector2.x, vector2.y), t, EditorStyles.wordWrappedLabel);
                GUI.EndScrollView();
                EditorGUI.DrawRect(new Rect(rect7.xMax - 1f, rect7.y, 1f, rect7.height), Color.black);
                if (this.m_AudioProfilerGroupTreeViewState == null)
                {
                    this.m_AudioProfilerGroupTreeViewState = new AudioProfilerGroupTreeViewState();
                }
                if (this.m_AudioProfilerGroupViewBackend == null)
                {
                    this.m_AudioProfilerGroupViewBackend = new AudioProfilerGroupViewBackend(this.m_AudioProfilerGroupTreeViewState);
                }
                ProfilerProperty property3 = this.CreateProperty(false);
                if (CheckFrameData(property3))
                {
                    if ((this.m_CurrentFrame == -1) || (this.m_LastAudioProfilerFrame != this.m_CurrentFrame))
                    {
                        this.m_LastAudioProfilerFrame = this.m_CurrentFrame;
                        AudioProfilerGroupInfo[] audioProfilerGroupInfo = property3.GetAudioProfilerGroupInfo();
                        if ((audioProfilerGroupInfo != null) && (audioProfilerGroupInfo.Length > 0))
                        {
                            List<AudioProfilerGroupInfoWrapper> list2 = new List<AudioProfilerGroupInfoWrapper>();
                            foreach (AudioProfilerGroupInfo info2 in audioProfilerGroupInfo)
                            {
                                bool flag4 = (info2.flags & 0x40) != 0;
                                if (((this.m_ShowDetailedAudioPane != ProfilerAudioView.Channels) || !flag4) && ((this.m_ShowDetailedAudioPane != ProfilerAudioView.Groups) || flag4))
                                {
                                    list2.Add(new AudioProfilerGroupInfoWrapper(info2, property3.GetAudioProfilerNameByOffset(info2.assetNameOffset), property3.GetAudioProfilerNameByOffset(info2.objectNameOffset), this.m_ShowDetailedAudioPane == ProfilerAudioView.Channels));
                                }
                            }
                            this.m_AudioProfilerGroupViewBackend.SetData(list2);
                            if (this.m_AudioProfilerGroupView == null)
                            {
                                this.m_AudioProfilerGroupView = new AudioProfilerGroupView(this, this.m_AudioProfilerGroupTreeViewState);
                                this.m_AudioProfilerGroupView.Init(rect8, this.m_AudioProfilerGroupViewBackend);
                            }
                        }
                    }
                    if (this.m_AudioProfilerGroupView != null)
                    {
                        this.m_AudioProfilerGroupView.OnGUI(rect8, this.m_ShowDetailedAudioPane == ProfilerAudioView.Channels);
                    }
                }
                property3.Cleanup();
            }
        }