Esempio n. 1
0
        public int DoGUI(Chart.ChartType type, int selectedFrame, ChartData cdata, ProfilerArea area, bool active, GUIContent icon, out Chart.ChartAction action)
        {
            action = Chart.ChartAction.None;
            int result;

            if (cdata == null)
            {
                result = selectedFrame;
            }
            else
            {
                int numberOfFrames = cdata.NumberOfFrames;
                if (Chart.ms_Styles == null)
                {
                    Chart.ms_Styles = new Chart.Styles();
                }
                this.m_chartControlID = GUIUtility.GetControlID(Chart.s_ChartHash, FocusType.Keyboard);
                Rect rect = GUILayoutUtility.GetRect(GUIContent.none, Chart.ms_Styles.background, new GUILayoutOption[]
                {
                    GUILayout.MinHeight(120f)
                });
                Rect rect2 = rect;
                rect2.x     += 170f;
                rect2.width -= 170f;
                Event current = Event.current;
                if (current.GetTypeForControl(this.m_chartControlID) == EventType.MouseDown && rect.Contains(current.mousePosition))
                {
                    action = Chart.ChartAction.Activated;
                }
                if (this.m_DragItemIndex == -1)
                {
                    selectedFrame = this.HandleFrameSelectionEvents(selectedFrame, this.m_chartControlID, rect2, cdata, numberOfFrames);
                }
                Rect rect3 = rect2;
                rect3.x    -= 170f;
                rect3.width = 170f;
                GUI.Label(new Rect(rect3.x, rect3.y, rect3.width, 20f), GUIContent.Temp("", icon.tooltip));
                if (current.type == EventType.Repaint)
                {
                    Chart.ms_Styles.rightPane.Draw(rect2, false, false, active, false);
                    Chart.ms_Styles.leftPane.Draw(rect3, EditorGUIUtility.TempContent(icon.text), false, false, active, false);
                    if (this.m_NotSupportedWarning == null)
                    {
                        rect2.height -= 1f;
                        if (type == Chart.ChartType.StackedFill)
                        {
                            this.DrawChartStacked(selectedFrame, cdata, rect2);
                        }
                        else
                        {
                            this.DrawChartLine(selectedFrame, cdata, rect2);
                        }
                    }
                    else
                    {
                        Rect position = rect2;
                        position.x += 56.1000023f;
                        position.y += 43f;
                        GUI.Label(position, this.m_NotSupportedWarning, EditorStyles.boldLabel);
                    }
                    rect3.x += 10f;
                    rect3.y += 10f;
                    GUIStyle.none.Draw(rect3, EditorGUIUtility.TempContent(icon.image), false, false, false, false);
                    rect3.x += 40f;
                    this.DrawLabelDragger(type, rect3, cdata);
                }
                else
                {
                    rect3.y += 10f;
                    this.LabelDraggerDrag(this.m_chartControlID, type, cdata, rect3, active);
                }
                if (area == ProfilerArea.GPU)
                {
                    GUI.Label(new Rect(rect.x + 170f - (float)Chart.ms_Styles.performanceWarning.image.width, rect.yMax - (float)Chart.ms_Styles.performanceWarning.image.height - 2f, (float)Chart.ms_Styles.performanceWarning.image.width, (float)Chart.ms_Styles.performanceWarning.image.height), Chart.ms_Styles.performanceWarning);
                }
                if (GUI.Button(new Rect(rect.x + 170f - 13f - 2f, rect.y + 2f, 13f, 13f), GUIContent.none, Chart.ms_Styles.closeButton))
                {
                    action = Chart.ChartAction.Closed;
                }
                result = selectedFrame;
            }
            return(result);
        }
Esempio n. 2
0
		public int DoGUI(Chart.ChartType type, int selectedFrame, ChartData cdata, ProfilerArea area, bool active, GUIContent icon, out Chart.ChartAction action)
		{
			action = Chart.ChartAction.None;
			if (cdata == null)
			{
				return selectedFrame;
			}
			int numberOfFrames = cdata.NumberOfFrames;
			if (Chart.ms_Styles == null)
			{
				Chart.ms_Styles = new Chart.Styles();
			}
			int controlID = GUIUtility.GetControlID(Chart.s_ChartHash, FocusType.Keyboard);
			Rect rect = GUILayoutUtility.GetRect(GUIContent.none, Chart.ms_Styles.background, new GUILayoutOption[]
			{
				GUILayout.MinHeight(120f)
			});
			Rect rect2 = rect;
			rect2.x += 170f;
			rect2.width -= 170f;
			Event current = Event.current;
			if (current.GetTypeForControl(controlID) == EventType.MouseDown && rect.Contains(current.mousePosition))
			{
				action = Chart.ChartAction.Activated;
			}
			if (this.m_DragItemIndex == -1)
			{
				selectedFrame = this.HandleFrameSelectionEvents(selectedFrame, controlID, rect2, cdata, numberOfFrames);
			}
			Rect rect3 = rect2;
			rect3.x -= 170f;
			rect3.width = 170f;
			GUI.Label(new Rect(rect3.x, rect3.y, rect3.width, 20f), GUIContent.Temp(string.Empty, icon.tooltip));
			if (current.type == EventType.Repaint)
			{
				Chart.ms_Styles.rightPane.Draw(rect2, false, false, active, false);
				Chart.ms_Styles.leftPane.Draw(rect3, EditorGUIUtility.TempContent(icon.text), false, false, active, false);
				if (this.m_NotSupportedWarning == null)
				{
					rect2.height -= 1f;
					if (type == Chart.ChartType.StackedFill)
					{
						this.DrawChartStacked(selectedFrame, cdata, rect2);
					}
					else
					{
						this.DrawChartLine(selectedFrame, cdata, rect2);
					}
				}
				else
				{
					Rect position = rect2;
					position.x += 56.1000023f;
					position.y += 43f;
					GUI.Label(position, this.m_NotSupportedWarning, EditorStyles.boldLabel);
				}
				rect3.x += 10f;
				rect3.y += 10f;
				GUIStyle.none.Draw(rect3, EditorGUIUtility.TempContent(icon.image), false, false, false, false);
				rect3.x += 40f;
				this.DrawLabelDragger(type, rect3, cdata);
			}
			else
			{
				rect3.y += 10f;
				this.LabelDraggerDrag(controlID, type, cdata, rect3, active);
			}
			if (area == ProfilerArea.GPU)
			{
				GUI.Label(new Rect(rect.x + 170f - (float)Chart.ms_Styles.performanceWarning.image.width, rect.yMax - (float)Chart.ms_Styles.performanceWarning.image.height - 2f, (float)Chart.ms_Styles.performanceWarning.image.width, (float)Chart.ms_Styles.performanceWarning.image.height), Chart.ms_Styles.performanceWarning);
			}
			if (GUI.Button(new Rect(rect.x + 170f - 13f - 2f, rect.y + 2f, 13f, 13f), GUIContent.none, Chart.ms_Styles.closeButton))
			{
				action = Chart.ChartAction.Closed;
			}
			return selectedFrame;
		}