Clean up off-by-one offsets from repeat-related properties

This commit is contained in:
smoogipoo
2018-01-23 13:37:25 +09:00
parent 4f360eac56
commit d37844c068
15 changed files with 101 additions and 110 deletions

View File

@ -10,6 +10,7 @@ using System.Linq;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Framework.Graphics.Primitives;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
@ -109,7 +110,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
private int currentRepeat;
private int currentSpan;
public bool Tracking;
protected override void Update()
@ -120,17 +121,17 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
double progress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
int repeat = slider.RepeatAt(progress);
int span = slider.SpanAt(progress);
progress = slider.ProgressAt(progress);
if (repeat > currentRepeat)
currentRepeat = repeat;
if (span > currentSpan)
currentSpan = span;
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice.
if (!InitialCircle.Judgements.Any(j => j.IsHit))
InitialCircle.Position = slider.Curve.PositionAt(progress);
foreach (var c in components.OfType<ISliderProgress>()) c.UpdateProgress(progress, repeat);
foreach (var c in components.OfType<ISliderProgress>()) c.UpdateProgress(progress, span);
foreach (var c in components.OfType<ITrackSnaking>()) c.UpdateSnakingPosition(slider.Curve.PositionAt(Body.SnakedStart ?? 0), slider.Curve.PositionAt(Body.SnakedEnd ?? 0));
foreach (var t in ticks.Children) t.Tracking = Ball.Tracking;
}