public void DoTimeRulerGUI(Rect rect, float frameTime) { if (this.m_TimeArea != null && Event.current.type == EventType.Repaint) { GUI.BeginClip(rect); float num = 0f; rect.y = num; rect.x = num; GUI.Box(rect, GUIContent.none, EditorStyles.toolbarButton); Color textColor = ProfilerTimelineGUI.styles.timelineTick.normal.textColor; textColor.a *= 0.75f; this.PrepareTicks(); if (Event.current.type == EventType.Repaint) { HandleUtility.ApplyWireMaterial(); if (Application.platform == RuntimePlatform.WindowsEditor) { GL.Begin(7); } else { GL.Begin(1); } for (int i = 0; i < this.m_HTicks.tickLevels; i++) { float num2 = this.m_HTicks.GetStrengthOfLevel(i) * 0.8f; float[] ticksAtLevel = this.m_HTicks.GetTicksAtLevel(i, true); for (int j = 0; j < ticksAtLevel.Length; j++) { float time = ticksAtLevel[j]; float x = this.m_TimeArea.TimeToPixel(time, rect); float num3 = rect.height * Mathf.Min(1f, num2) * 0.7f; Color color = new Color(1f, 1f, 1f, num2 / 0.5f) * textColor; TimeArea.DrawVerticalLineFast(x, rect.height - num3 + 0.5f, rect.height - 0.5f, color); } } GL.End(); } int num4 = 60; int levelWithMinSeparation = this.m_HTicks.GetLevelWithMinSeparation((float)num4); float[] ticksAtLevel2 = this.m_HTicks.GetTicksAtLevel(levelWithMinSeparation, false); for (int k = 0; k < ticksAtLevel2.Length; k++) { float time2 = ticksAtLevel2[k]; float num5 = Mathf.Floor(this.m_TimeArea.TimeToPixel(time2, rect)); string text = this.FormatTickLabel(time2, levelWithMinSeparation); GUI.Label(new Rect(num5 + 3f, -3f, (float)num4, 20f), text, ProfilerTimelineGUI.styles.timelineTick); } this.DrawOutOfRangeOverlay(rect, frameTime); this.DrawRangeSelectionOverlay(rect); GUI.EndClip(); } }
void DrawGrid(Rect rect, float frameTime) { if (m_TimeArea == null || Event.current.type != EventType.Repaint) { return; } GUI.BeginClip(rect); rect.x = rect.y = 0; Color tickColor = styles.timelineTick.normal.textColor; tickColor.a = 0.1f; HandleUtility.ApplyWireMaterial(); if (Application.platform == RuntimePlatform.WindowsEditor) { GL.Begin(GL.QUADS); } else { GL.Begin(GL.LINES); } PrepareTicks(); // Draw tick markers of various sizes for (int l = 0; l < m_HTicks.tickLevels; l++) { var strength = m_HTicks.GetStrengthOfLevel(l) * .9f; if (strength > TimeArea.kTickRulerFatThreshold) { var ticks = m_HTicks.GetTicksAtLevel(l, true); for (int i = 0; i < ticks.Length; i++) { // Draw line var time = ticks[i]; var x = m_TimeArea.TimeToPixel(time, rect); TimeArea.DrawVerticalLineFast(x, 0, rect.height, tickColor); } } } GL.End(); GUI.EndClip(); }
private void DrawGrid(Rect rect, float frameTime) { if (this.m_TimeArea != null && Event.current.type == EventType.Repaint) { GUI.BeginClip(rect); float num = 0f; rect.y = num; rect.x = num; Color textColor = ProfilerTimelineGUI.styles.timelineTick.normal.textColor; textColor.a = 0.1f; HandleUtility.ApplyWireMaterial(); if (Application.platform == RuntimePlatform.WindowsEditor) { GL.Begin(7); } else { GL.Begin(1); } this.PrepareTicks(); for (int i = 0; i < this.m_HTicks.tickLevels; i++) { float num2 = this.m_HTicks.GetStrengthOfLevel(i) * 0.9f; if (num2 > 0.5f) { float[] ticksAtLevel = this.m_HTicks.GetTicksAtLevel(i, true); for (int j = 0; j < ticksAtLevel.Length; j++) { float time = ticksAtLevel[j]; float x = this.m_TimeArea.TimeToPixel(time, rect); TimeArea.DrawVerticalLineFast(x, 0f, rect.height, textColor); } } } GL.End(); GUI.EndClip(); } }
public void DoTimeRulerGUI(Rect rect, float frameTime) { if (m_TimeArea == null || Event.current.type != EventType.Repaint) { return; } GUI.BeginClip(rect); rect.x = rect.y = 0; GUI.Box(rect, GUIContent.none, EditorStyles.toolbarButton); var baseColor = styles.timelineTick.normal.textColor; baseColor.a *= 0.75f; PrepareTicks(); // Tick lines if (Event.current.type == EventType.Repaint) { HandleUtility.ApplyWireMaterial(); if (Application.platform == RuntimePlatform.WindowsEditor) { GL.Begin(GL.QUADS); } else { GL.Begin(GL.LINES); } for (int l = 0; l < m_HTicks.tickLevels; l++) { var strength = m_HTicks.GetStrengthOfLevel(l) * .8f; var ticks = m_HTicks.GetTicksAtLevel(l, true); for (int i = 0; i < ticks.Length; i++) { // Draw line var time = ticks[i]; var x = m_TimeArea.TimeToPixel(time, rect); var height = rect.height * Mathf.Min(1, strength) * TimeArea.kTickRulerHeightMax; var color = new Color(1, 1, 1, strength / TimeArea.kTickRulerFatThreshold) * baseColor; TimeArea.DrawVerticalLineFast(x, rect.height - height + 0.5f, rect.height - 0.5f, color); } } GL.End(); } // Tick labels var labelWidth = k_TickLabelSeparation; int labelLevel = m_HTicks.GetLevelWithMinSeparation(labelWidth); float[] labelTicks = m_HTicks.GetTicksAtLevel(labelLevel, false); for (int i = 0; i < labelTicks.Length; i++) { var time = labelTicks[i]; float labelpos = Mathf.Floor(m_TimeArea.TimeToPixel(time, rect)); string label = FormatTickLabel(time, labelLevel); GUI.Label(new Rect(labelpos + 3, -3, labelWidth, 20), label, styles.timelineTick); } // Outside current frame coloring DrawOutOfRangeOverlay(rect, frameTime); // Range selection coloring DrawRangeSelectionOverlay(rect); GUI.EndClip(); }