public override float GetNoteX(RuntimeNote note, double now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics) { if (note.IsSlide() && note.HasNextSlide()) { var thisStatus = NoteAnimationHelper.GetOnStageStatusOf(note, now, animationMetrics); if (thisStatus >= OnStageStatus.Passed) { var nextSlide = note.NextSlide; var nextStatus = NoteAnimationHelper.GetOnStageStatusOf(nextSlide, now, animationMetrics); if (nextStatus < OnStageStatus.Passed) { var x1 = GetEndXByNotePosition(note.EndX, animationMetrics); var x2 = GetEndXByNotePosition(nextSlide.EndX, animationMetrics); return((float)((now - note.HitTime) / (nextSlide.HitTime - note.HitTime)) * (x2 - x1) + x1); } } } var transformedTime = GetTransformedTime(note, now, animationMetrics); return(GetNoteXByTransformedTime(note, transformedTime, animationMetrics)); }
public override float GetNoteX(RuntimeNote note, float now, NoteMetrics noteMetrics, NoteAnimationMetrics animationMetrics) { var trackCount = animationMetrics.TrackCount; var endLeftMarginRatio = animationMetrics.NoteEndXRatios[0]; var endRightMarginRatio = animationMetrics.NoteEndXRatios[trackCount - 1]; var endXRatio = endLeftMarginRatio + (endRightMarginRatio - endLeftMarginRatio) * (note.EndX / (trackCount - 1)); var onStage = NoteAnimationHelper.GetOnStageStatusOf(note, now, animationMetrics); float xRatio; switch (onStage) { case OnStageStatus.Incoming: if (note.HasPrevHold()) { xRatio = GetIncomingNoteXRatio(note.PrevHold, note, now, animationMetrics); } else if (note.HasPrevSlide()) { xRatio = GetIncomingNoteXRatio(note.PrevSlide, note, now, animationMetrics); } else { xRatio = endXRatio; } break; case OnStageStatus.Passed: if (note.HasNextSlide()) { var destXRatio = endLeftMarginRatio + (endRightMarginRatio - endLeftMarginRatio) * (note.NextSlide.EndX / (trackCount - 1)); var nextPerc = (now - note.HitTime) / (note.NextSlide.HitTime - note.HitTime); xRatio = MathHelperEx.Lerp(endXRatio, destXRatio, nextPerc); } else { xRatio = endXRatio; } break; default: var startLeftMarginRatio = animationMetrics.NoteStartXRatios[0]; var startRightMarginRatio = animationMetrics.NoteStartXRatios[trackCount - 1]; float whichStartToTake; if (note.IsSlide()) { whichStartToTake = note.EndX; } else { if (note.StartX < 0) { whichStartToTake = note.StartX * 0.5f; } else if (note.StartX > trackCount - 1) { whichStartToTake = (trackCount - 1) + (note.StartX - (trackCount - 1)) * 0.5f; } else { whichStartToTake = note.StartX; } } var startXRatio = startLeftMarginRatio + (startRightMarginRatio - startLeftMarginRatio) * (whichStartToTake / (trackCount - 1)); var timePoints = NoteAnimationHelper.CalculateNoteTimePoints(note, animationMetrics); var perc = (now - timePoints.Enter) / timePoints.Duration; xRatio = MathHelperEx.Lerp(startXRatio, endXRatio, perc); break; } return(animationMetrics.Width * xRatio); }