public void Draw(double beginTime, double endTime, MagnetEngine magnetEngine) { TimelineWindow.TimelineState state = TimelineWindow.instance.state; Rect timeAreaBounds = TimelineWindow.instance.timeAreaBounds; timeAreaBounds.set_xMin(Mathf.Max(TimelineWindow.instance.timeAreaBounds.get_xMin(), state.TimeToTimeAreaPixel(beginTime))); timeAreaBounds.set_xMax(state.TimeToTimeAreaPixel(endTime)); Rect position = TimelineWindow.instance.get_position(); using (new GUIViewportScope(TimelineWindow.instance.timeAreaBounds)) { Color textColor = DirectorStyles.Instance.selectedStyle.get_focused().get_textColor(); textColor.a = 0.12f; EditorGUI.DrawRect(timeAreaBounds, textColor); this.m_BeginSelectionTooltip.text = state.TimeAsString(beginTime, "F2"); this.m_EndSelectionTooltip.text = state.TimeAsString(endTime, "F2"); Rect bounds = this.m_BeginSelectionTooltip.bounds; bounds.set_xMin(timeAreaBounds.get_xMin() - bounds.get_width() / 2f); bounds.set_y(timeAreaBounds.get_y()); this.m_BeginSelectionTooltip.bounds = bounds; bounds = this.m_EndSelectionTooltip.bounds; bounds.set_xMin(timeAreaBounds.get_xMax() - bounds.get_width() / 2f); bounds.set_y(timeAreaBounds.get_y()); this.m_EndSelectionTooltip.bounds = bounds; if (beginTime >= 0.0) { this.m_BeginSelectionTooltip.Draw(); } this.m_EndSelectionTooltip.Draw(); } if (beginTime >= 0.0) { if (magnetEngine == null || !magnetEngine.IsSnappedAtTime((double)state.PixelToTime(timeAreaBounds.get_xMin()))) { Graphics.DrawDottedLine(new Vector3(timeAreaBounds.get_xMin(), timeAreaBounds.get_yMax(), 0f), new Vector3(timeAreaBounds.get_xMin(), timeAreaBounds.get_yMax() + position.get_height()), 4f, Color.get_black()); } if (magnetEngine == null || !magnetEngine.IsSnappedAtTime((double)state.PixelToTime(timeAreaBounds.get_xMax()))) { Graphics.DrawDottedLine(new Vector3(timeAreaBounds.get_xMax(), timeAreaBounds.get_yMax(), 0f), new Vector3(timeAreaBounds.get_xMax(), timeAreaBounds.get_yMax() + position.get_height()), 4f, Color.get_black()); } } }
public void Draw(Rect clientRect, TimelineWindow.TimelineState state) { Rect rect = clientRect; if (this.direction == TimelineBlendHandle.DragDirection.Left) { rect.set_width(this.m_Styles.handLeft.get_fixedWidth()); rect.set_x(rect.get_x() - this.m_Styles.handLeft.get_fixedWidth()); rect.set_y(rect.get_y() + rect.get_height() - this.m_Styles.handLeft.get_fixedHeight()); rect.set_height(this.m_Styles.handLeft.get_fixedHeight()); } if (this.direction == TimelineBlendHandle.DragDirection.Right) { rect.set_x(state.TimeToTimeAreaPixel((double)this.clip.blendingStopsAt)); rect.set_y(rect.get_y() + 1f); rect.set_width(this.m_Styles.handLeft.get_fixedWidth()); rect.set_height(this.m_Styles.handLeft.get_fixedHeight()); } EditorGUIUtility.AddCursorRect(rect, 19); this.m_Rect = rect; GUI.Box(rect, GUIContent.none, (this.direction != TimelineBlendHandle.DragDirection.Left) ? this.m_Styles.handRight : this.m_Styles.handLeft); }