Fix so it reacts to PathVersion with Scheduler

This commit is contained in:
OliBomby 2024-01-13 12:50:39 +01:00
parent e1186080b8
commit fca9b1f536
2 changed files with 10 additions and 2 deletions

View File

@ -244,7 +244,13 @@ protected override void Update()
else if (slidingSample.IsPlaying)
slidingSample.Stop();
}
}
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();
// It's important that this is done in UpdateAfterChildren so that the SliderBody has a chance to update its Size and PathOffset on Update.
double completionProgress = Math.Clamp((Time.Current - HitObject.StartTime) / HitObject.Duration, 0, 1);
Ball.UpdateProgress(completionProgress);

View File

@ -18,6 +18,8 @@ public abstract partial class PlaySliderBody : SnakingSliderBody
protected IBindable<Color4> AccentColourBindable { get; private set; } = null!;
private IBindable<int> pathVersion = null!;
[Resolved(CanBeNull = true)]
private OsuRulesetConfigManager? config { get; set; }
@ -31,8 +33,8 @@ private void load(ISkinSource skin, DrawableHitObject drawableObject)
ScaleBindable = drawableSlider.ScaleBindable.GetBoundCopy();
ScaleBindable.BindValueChanged(scale => PathRadius = OsuHitObject.OBJECT_RADIUS * scale.NewValue, true);
drawableObject.DefaultsApplied += _ => Refresh();
drawableObject.HitObjectApplied += _ => Refresh();
pathVersion = drawableSlider.PathVersion.GetBoundCopy();
pathVersion.BindValueChanged(_ => Scheduler.AddOnce(Refresh));
AccentColourBindable = drawableObject.AccentColour.GetBoundCopy();
AccentColourBindable.BindValueChanged(accent => AccentColour = GetBodyAccentColour(skin, accent.NewValue), true);