CreateProperty() public method

public CreateProperty ( bool details ) : ProfilerProperty
details bool
return UnityEditorInternal.ProfilerProperty
Ejemplo n.º 1
0
        internal void DrawUIPane(ProfilerWindow win, ProfilerArea profilerArea, UISystemProfilerChart detailsChart)
        {
            this.InitIfNeeded(win);
            EditorGUILayout.BeginVertical(new GUILayoutOption[0]);
            if (this.m_DetachedPreview != null && !this.m_DetachedPreview)
            {
                this.m_DetachedPreview = null;
            }
            bool flag = this.m_DetachedPreview;

            if (!flag)
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                SplitterGUILayout.BeginHorizontalSplit(this.m_TreePreviewHorizontalSplitState, new GUILayoutOption[0]);
            }
            Rect controlRect = EditorGUILayout.GetControlRect(new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true),
                GUILayout.ExpandHeight(true)
            });

            controlRect.yMin -= EditorGUIUtility.standardVerticalSpacing;
            this.m_TreeViewControl.property = win.CreateProperty();
            if (!this.m_TreeViewControl.property.frameDataReady)
            {
                this.m_TreeViewControl.property.Cleanup();
                this.m_TreeViewControl.property = null;
                GUI.Label(controlRect, UISystemProfiler.Styles.noData);
            }
            else
            {
                int activeVisibleFrameIndex = win.GetActiveVisibleFrameIndex();
                if (this.m_UGUIProfilerTreeViewState != null && this.m_UGUIProfilerTreeViewState.lastFrame != activeVisibleFrameIndex)
                {
                    this.currentFrame = ProfilerDriver.lastFrameIndex - activeVisibleFrameIndex;
                    this.m_TreeViewControl.Reload();
                }
                this.m_TreeViewControl.OnGUI(controlRect);
                this.m_TreeViewControl.property.Cleanup();
            }
            if (!flag)
            {
                using (new EditorGUILayout.VerticalScope(new GUILayoutOption[0]))
                {
                    using (new EditorGUILayout.HorizontalScope(EditorStyles.toolbar, new GUILayoutOption[]
                    {
                        GUILayout.ExpandWidth(true)
                    }))
                    {
                        flag = GUILayout.Button(UISystemProfiler.Styles.contentDetachRender, EditorStyles.toolbarButton, new GUILayoutOption[]
                        {
                            GUILayout.Width(75f)
                        });
                        if (flag)
                        {
                            this.m_DetachedPreview          = EditorWindow.GetWindow <UISystemPreviewWindow>();
                            this.m_DetachedPreview.profiler = this;
                            this.m_DetachedPreview.Show();
                        }
                        UISystemProfiler.DrawPreviewToolbarButtons();
                    }
                    this.DrawRenderUI();
                }
                GUILayout.EndHorizontal();
                SplitterGUILayout.EndHorizontalSplit();
                EditorGUI.DrawRect(new Rect((float)this.m_TreePreviewHorizontalSplitState.realSizes[0] + controlRect.xMin, controlRect.y, 1f, controlRect.height), UISystemProfiler.Styles.separatorColor);
            }
            EditorGUILayout.EndVertical();
            if (this.m_DetachedPreview)
            {
                this.m_DetachedPreview.Repaint();
            }
        }
        internal void DrawUIPane(ProfilerWindow win, ProfilerArea profilerArea, UISystemProfilerChart detailsChart)
        {
            InitIfNeeded(win);

            EditorGUILayout.BeginVertical();

            if (m_DetachedPreview != null && !m_DetachedPreview)
            {
                m_DetachedPreview = null;
            }
            bool detachPreview = m_DetachedPreview;

            if (!detachPreview)
            {
                GUILayout.BeginHorizontal(); // Horizontal render
                SplitterGUILayout.BeginHorizontalSplit(m_TreePreviewHorizontalSplitState);
            }

            var treeRect = EditorGUILayout.GetControlRect(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            treeRect.yMin -= EditorGUIUtility.standardVerticalSpacing;
            m_TreeViewControl.property = win.CreateProperty();

            if (!m_TreeViewControl.property.frameDataReady)
            {
                m_TreeViewControl.property.Cleanup();
                m_TreeViewControl.property = null;
                GUI.Label(treeRect, Styles.noData);
            }
            else
            {
                var newVisibleFrame = win.GetActiveVisibleFrameIndex();
                if (m_UGUIProfilerTreeViewState != null && m_UGUIProfilerTreeViewState.lastFrame != newVisibleFrame)
                {
                    currentFrame = ProfilerDriver.lastFrameIndex - newVisibleFrame;

                    m_TreeViewControl.Reload();
                }
                m_TreeViewControl.OnGUI(treeRect);
                m_TreeViewControl.property.Cleanup();
            }

            if (!detachPreview)
            {
                using (new EditorGUILayout.VerticalScope())
                {
                    using (new EditorGUILayout.HorizontalScope(EditorStyles.toolbar, GUILayout.ExpandWidth(true)))
                    {
                        detachPreview = GUILayout.Button(Styles.contentDetachRender, EditorStyles.toolbarButton, GUILayout.Width(75));
                        if (detachPreview)
                        {
                            m_DetachedPreview          = EditorWindow.GetWindow <UISystemPreviewWindow>();
                            m_DetachedPreview.profiler = this;
                            m_DetachedPreview.Show();
                        }
                        DrawPreviewToolbarButtons();
                    }
                    DrawRenderUI();
                }

                GUILayout.EndHorizontal();              // Horizontal render
                SplitterGUILayout.EndHorizontalSplit(); // m_TreePreviewHorizontalSplitState

                // Draw separator
                EditorGUI.DrawRect(
                    new Rect(m_TreePreviewHorizontalSplitState.realSizes[0] + treeRect.xMin, treeRect.y, 1, treeRect.height),
                    Styles.separatorColor);
            }

            EditorGUILayout.EndVertical();

            if (m_DetachedPreview)
            {
                m_DetachedPreview.Repaint();
            }
        }