Ensure `Slider.updateNestedPositions()` actually updates the position of all nesteds

This commit is contained in:
Bartłomiej Dach 2024-09-27 10:27:54 +02:00
parent 766d2d2ad2
commit 1c23fd31d7
No known key found for this signature in database
3 changed files with 24 additions and 6 deletions

View File

@ -204,6 +204,7 @@ protected override void CreateNestedHitObjects(CancellationToken cancellationTok
SpanStartTime = e.SpanStartTime,
StartTime = e.Time,
Position = Position + Path.PositionAt(e.PathProgress),
PathProgress = e.PathProgress,
StackHeight = StackHeight,
});
break;
@ -236,6 +237,7 @@ protected override void CreateNestedHitObjects(CancellationToken cancellationTok
StartTime = StartTime + (e.SpanIndex + 1) * SpanDuration,
Position = Position + Path.PositionAt(e.PathProgress),
StackHeight = StackHeight,
PathProgress = e.PathProgress,
});
break;
}
@ -248,14 +250,27 @@ private void updateNestedPositions()
{
endPositionCache.Invalidate();
if (HeadCircle != null)
HeadCircle.Position = Position;
foreach (var nested in NestedHitObjects)
{
switch (nested)
{
case SliderHeadCircle headCircle:
headCircle.Position = Position;
break;
if (TailCircle != null)
TailCircle.Position = EndPosition;
case SliderTailCircle tailCircle:
tailCircle.Position = EndPosition;
break;
if (LastRepeat != null)
LastRepeat.Position = RepeatCount % 2 == 0 ? Position : Position + Path.PositionAt(1);
case SliderRepeat repeat:
repeat.Position = Position + Path.PositionAt(repeat.PathProgress);
break;
case SliderTick tick:
tick.Position = Position + Path.PositionAt(tick.PathProgress);
break;
}
}
}
protected void UpdateNestedSamples()

View File

@ -5,6 +5,8 @@ namespace osu.Game.Rulesets.Osu.Objects
{
public class SliderRepeat : SliderEndCircle
{
public double PathProgress { get; set; }
public SliderRepeat(Slider slider)
: base(slider)
{

View File

@ -13,6 +13,7 @@ public class SliderTick : OsuHitObject
{
public int SpanIndex { get; set; }
public double SpanStartTime { get; set; }
public double PathProgress { get; set; }
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
{