/// <summary> /// Get the repeat node at a point in time. /// </summary> /// <param name="curve">The slider.</param> /// <param name="timeSinceStart">The time since the start time of the slider.</param> /// <returns>Index of the node. -1 if there isn't a node at the specific time.</returns> private int nodeIndexFromTime(IHasRepeats curve, double timeSinceStart) { double spanDuration = curve.Duration / curve.SpanCount(); double nodeIndex = timeSinceStart / spanDuration; if (almostEquals(nodeIndex, Math.Round(nodeIndex))) { return((int)Math.Round(nodeIndex)); } return(-1); }
private TaikoHitObject convertHitObject(HitObject original) { // Check if this HitObject is already a TaikoHitObject, and return it if so TaikoHitObject originalTaiko = original as TaikoHitObject; if (originalTaiko != null) { return(originalTaiko); } IHasDistance distanceData = original as IHasDistance; IHasRepeats repeatsData = original as IHasRepeats; IHasEndTime endTimeData = original as IHasEndTime; bool accented = ((original.Sample?.Type ?? SampleType.None) & SampleType.Finish) > 0; if (distanceData != null) { return(new DrumRoll { StartTime = original.StartTime, Sample = original.Sample, Accented = accented, Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) }); } if (endTimeData != null) { // We compute the end time manually to add in the Bash convert factor return(new Bash { StartTime = original.StartTime, Sample = original.Sample, Accented = accented, EndTime = original.StartTime + endTimeData.Duration * bash_convert_factor }); } return(new Hit { StartTime = original.StartTime, Sample = original.Sample, Accented = accented }); }
private void updateRepeats(IHasRepeats repeats) { repeatsContainer?.Expire(); mainComponents.Add(repeatsContainer = new Container { RelativeSizeAxes = Axes.Both, }); for (int i = 0; i < repeats.RepeatCount; i++) { repeatsContainer.Add(new Circle { Size = new Vector2(circle_size / 2), Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, RelativePositionAxes = Axes.X, X = (float)(i + 1) / (repeats.RepeatCount + 1), }); } }
/// <summary> /// The amount of times the length of this <see cref="IHasRepeats"/> spans. /// </summary> /// <param name="obj">The object that has repeats.</param> public static int SpanCount(this IHasRepeats obj) => obj.RepeatCount + 1;
private TaikoHitObject convertHitObject(HitObject original) { // Check if this HitObject is already a TaikoHitObject, and return it if so TaikoHitObject originalTaiko = original as TaikoHitObject; if (originalTaiko != null) { return(originalTaiko); } IHasDistance distanceData = original as IHasDistance; IHasRepeats repeatsData = original as IHasRepeats; IHasEndTime endTimeData = original as IHasEndTime; // Old osu! used hit sounding to determine various hit type information SampleType sample = original.Sample?.Type ?? SampleType.None; bool strong = (sample & SampleType.Finish) > 0; if (distanceData != null) { return(new DrumRoll { StartTime = original.StartTime, Sample = original.Sample, IsStrong = strong, Distance = distanceData.Distance * (repeatsData?.RepeatCount ?? 1) * legacy_velocity_scale }); } if (endTimeData != null) { // We compute the end time manually to add in the Bash convert factor return(new Swell { StartTime = original.StartTime, Sample = original.Sample, IsStrong = strong, EndTime = original.StartTime + endTimeData.Duration, HitRatio = bash_convert_factor }); } bool isCentre = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0; if (isCentre) { return(new CentreHit { StartTime = original.StartTime, Sample = original.Sample, IsStrong = strong }); } return(new RimHit { StartTime = original.StartTime, Sample = original.Sample, IsStrong = strong, }); }
/// <summary> /// Returns the total number of passes that can be made on a path. /// </summary> public static int SpanCount(this IHasRepeats context) { return(context.RepeatCount + 1); }