CheckFrameData() private static méthode

private static CheckFrameData ( ProfilerProperty property ) : bool
property UnityEditorInternal.ProfilerProperty
Résultat bool
Exemple #1
0
        private void DrawCPUOrRenderingPane(ProfilerHierarchyGUI mainPane, ProfilerHierarchyGUI detailPane, ProfilerTimelineGUI timelinePane)
        {
            ProfilerProperty profilerProperty = this.CreateProperty(false);

            this.DrawCPUOrRenderingToolbar(profilerProperty);
            if (!ProfilerWindow.CheckFrameData(profilerProperty))
            {
                profilerProperty.Cleanup();
                return;
            }
            if (timelinePane != null && this.m_ViewType == ProfilerViewType.Timeline)
            {
                float num = (float)this.m_VertSplit.realSizes[1];
                num -= EditorStyles.toolbar.CalcHeight(GUIContent.none, 10f) + 2f;
                timelinePane.DoGUI(this.GetActiveVisibleFrameIndex(), base.position.width, base.position.height - num, num);
                profilerProperty.Cleanup();
            }
            else
            {
                SplitterGUILayout.BeginHorizontalSplit(this.m_ViewSplit, new GUILayoutOption[0]);
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                bool expandAll = false;
                mainPane.DoGUI(profilerProperty, this.m_SearchString, expandAll);
                profilerProperty.Cleanup();
                GUILayout.EndVertical();
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                ProfilerProperty profilerProperty2 = this.CreateProperty(true);
                ProfilerProperty detailedProperty  = mainPane.GetDetailedProperty(profilerProperty2);
                profilerProperty2.Cleanup();
                if (detailedProperty != null)
                {
                    detailPane.DoGUI(detailedProperty, string.Empty, expandAll);
                    detailedProperty.Cleanup();
                }
                else
                {
                    ProfilerWindow.DrawEmptyCPUOrRenderingDetailPane();
                }
                GUILayout.EndVertical();
                SplitterGUILayout.EndHorizontalSplit();
            }
        }
Exemple #2
0
        private void DrawAudioPane()
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
            ProfilerAudioView profilerAudioView = this.m_ShowDetailedAudioPane;

            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.Stats, "Stats", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.Stats;
            }
            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.Channels, "Channels", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.Channels;
            }
            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.Groups, "Groups", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.Groups;
            }
            if (GUILayout.Toggle(profilerAudioView == ProfilerAudioView.ChannelsAndGroups, "Channels and groups", EditorStyles.toolbarButton, new GUILayoutOption[0]))
            {
                profilerAudioView = ProfilerAudioView.ChannelsAndGroups;
            }
            if (profilerAudioView != this.m_ShowDetailedAudioPane)
            {
                this.m_ShowDetailedAudioPane  = profilerAudioView;
                this.m_LastAudioProfilerFrame = -1;
            }
            if (this.m_ShowDetailedAudioPane == ProfilerAudioView.Stats)
            {
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                this.DrawOverviewText(this.m_CurrentArea);
            }
            else
            {
                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 flag2 = GUILayout.Toggle(@bool, "Show all groups (dev-builds only)", EditorStyles.toolbarButton, new GUILayoutOption[0]);
                    if (@bool != flag2)
                    {
                        EditorPrefs.SetBool("AudioProfilerShowAllGroups", flag2);
                    }
                }
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
                Rect    rect         = GUILayoutUtility.GetRect(20f, 20000f, 10f, 10000f);
                Rect    position     = new Rect(rect.x, rect.y, 230f, rect.height);
                Rect    rect2        = new Rect(position.xMax, rect.y, rect.width - position.width, rect.height);
                string  overviewText = ProfilerDriver.GetOverviewText(this.m_CurrentArea, this.GetActiveVisibleFrameIndex());
                Vector2 vector       = EditorStyles.wordWrappedLabel.CalcSize(GUIContent.Temp(overviewText));
                this.m_PaneScroll[(int)this.m_CurrentArea] = GUI.BeginScrollView(position, this.m_PaneScroll[(int)this.m_CurrentArea], new Rect(0f, 0f, vector.x, vector.y));
                GUI.Box(position, string.Empty, ProfilerWindow.ms_Styles.background);
                GUI.Label(new Rect(3f, 3f, vector.x, vector.y), overviewText, EditorStyles.wordWrappedLabel);
                GUI.EndScrollView();
                EditorGUI.DrawRect(new Rect(position.xMax - 1f, position.y, 1f, position.height), Color.black);
                if (this.m_AudioProfilerTreeViewState == null)
                {
                    this.m_AudioProfilerTreeViewState = new AudioProfilerTreeViewState();
                }
                if (this.m_AudioProfilerBackend == null)
                {
                    this.m_AudioProfilerBackend = new AudioProfilerBackend(this.m_AudioProfilerTreeViewState);
                }
                ProfilerProperty profilerProperty = this.CreateProperty(false);
                if (ProfilerWindow.CheckFrameData(profilerProperty))
                {
                    if (this.m_CurrentFrame == -1 || this.m_LastAudioProfilerFrame != this.m_CurrentFrame)
                    {
                        this.m_LastAudioProfilerFrame = this.m_CurrentFrame;
                        AudioProfilerInfo[] audioProfilerInfo = profilerProperty.GetAudioProfilerInfo();
                        if (audioProfilerInfo != null && audioProfilerInfo.Length > 0)
                        {
                            List <AudioProfilerInfoWrapper> list  = new List <AudioProfilerInfoWrapper>();
                            AudioProfilerInfo[]             array = audioProfilerInfo;
                            for (int i = 0; i < array.Length; i++)
                            {
                                AudioProfilerInfo info = array[i];
                                bool flag3             = (info.flags & 64) != 0;
                                if (this.m_ShowDetailedAudioPane != ProfilerAudioView.Channels || !flag3)
                                {
                                    if (this.m_ShowDetailedAudioPane != ProfilerAudioView.Groups || flag3)
                                    {
                                        list.Add(new AudioProfilerInfoWrapper(info, profilerProperty.GetAudioProfilerNameByOffset(info.assetNameOffset), profilerProperty.GetAudioProfilerNameByOffset(info.objectNameOffset), this.m_ShowDetailedAudioPane == ProfilerAudioView.Channels));
                                    }
                                }
                            }
                            this.m_AudioProfilerBackend.SetData(list);
                            if (this.m_AudioProfilerView == null)
                            {
                                this.m_AudioProfilerView = new AudioProfilerView(this, this.m_AudioProfilerTreeViewState);
                                this.m_AudioProfilerView.Init(rect2, this.m_AudioProfilerBackend);
                            }
                        }
                    }
                    if (this.m_AudioProfilerView != null)
                    {
                        this.m_AudioProfilerView.OnGUI(rect2, this.m_ShowDetailedAudioPane == ProfilerAudioView.Channels);
                    }
                }
                profilerProperty.Cleanup();
            }
        }