Ejemplo n.º 1
0
        public void DoGUI(GUIStyle headerStyle, FrameDataView frameDataView, IList <int> selection)
        {
            if (frameDataView == null || !frameDataView.IsValid() || selection.Count == 0)
            {
                DrawEmptyPane(headerStyle);
                return;
            }

            InitIfNeeded();
            UpdateIfNeeded(frameDataView, selection[0]);

            string callstack        = null;
            var    selectedSampleId = m_TreeView.GetSelectedFrameDataViewId();

            if (selectedSampleId != -1)
            {
                callstack = frameDataView.ResolveItemCallstack(selectedSampleId, m_TreeView.state.selectedIDs[0]);
            }

            var showCallstack = !string.IsNullOrEmpty(callstack);

            if (showCallstack)
            {
                SplitterGUILayout.BeginVerticalSplit(m_VertSplit, Styles.expandedArea);
            }

            // Detailed list
            var rect = EditorGUILayout.BeginVertical(Styles.expandedArea);

            m_TreeView.OnGUI(rect);

            EditorGUILayout.EndVertical();

            if (showCallstack)
            {
                // Callstack area
                EditorGUILayout.BeginVertical(Styles.expandedArea);
                m_CallstackScrollViewPos = EditorGUILayout.BeginScrollView(m_CallstackScrollViewPos, Styles.callstackScroll);

                var text = kCallstackText + '\n' + callstack;
                EditorGUILayout.TextArea(text, Styles.callstackTextArea);

                EditorGUILayout.EndScrollView();
                EditorGUILayout.EndVertical();

                SplitterGUILayout.EndVerticalSplit();
            }
        }
 public void DoGUI(GUIStyle headerStyle, FrameDataView frameDataView, IList <int> selection)
 {
     if (frameDataView == null || !frameDataView.IsValid() || selection.Count == 0)
     {
         base.DrawEmptyPane(headerStyle);
     }
     else
     {
         this.InitIfNeeded();
         this.UpdateIfNeeded(frameDataView, selection[0]);
         string text = null;
         int    selectedFrameDataViewId = this.m_TreeView.GetSelectedFrameDataViewId();
         if (selectedFrameDataViewId != -1)
         {
             text = frameDataView.ResolveItemCallstack(selectedFrameDataViewId, this.m_TreeView.state.selectedIDs[0]);
         }
         bool flag = !string.IsNullOrEmpty(text);
         if (flag)
         {
             SplitterGUILayout.BeginVerticalSplit(this.m_VertSplit, ProfilerDetailedView.Styles.expandedArea, new GUILayoutOption[0]);
         }
         Rect rect = EditorGUILayout.BeginVertical(ProfilerDetailedView.Styles.expandedArea, new GUILayoutOption[0]);
         this.m_TreeView.OnGUI(rect);
         EditorGUILayout.EndVertical();
         if (flag)
         {
             EditorGUILayout.BeginVertical(ProfilerDetailedView.Styles.expandedArea, new GUILayoutOption[0]);
             this.m_CallstackScrollViewPos = EditorGUILayout.BeginScrollView(this.m_CallstackScrollViewPos, ProfilerDetailedView.Styles.callstackScroll, new GUILayoutOption[0]);
             string text2 = ProfilerDetailedObjectsView.kCallstackText + '\n' + text;
             EditorGUILayout.TextArea(text2, ProfilerDetailedView.Styles.callstackTextArea, new GUILayoutOption[0]);
             EditorGUILayout.EndScrollView();
             EditorGUILayout.EndVertical();
             SplitterGUILayout.EndVerticalSplit();
         }
     }
 }