1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-07 22:22:59 +08:00

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 @@ namespace osu.Game.Rulesets.Osu.Objects
SpanStartTime = e.SpanStartTime, SpanStartTime = e.SpanStartTime,
StartTime = e.Time, StartTime = e.Time,
Position = Position + Path.PositionAt(e.PathProgress), Position = Position + Path.PositionAt(e.PathProgress),
PathProgress = e.PathProgress,
StackHeight = StackHeight, StackHeight = StackHeight,
}); });
break; break;
@ -236,6 +237,7 @@ namespace osu.Game.Rulesets.Osu.Objects
StartTime = StartTime + (e.SpanIndex + 1) * SpanDuration, StartTime = StartTime + (e.SpanIndex + 1) * SpanDuration,
Position = Position + Path.PositionAt(e.PathProgress), Position = Position + Path.PositionAt(e.PathProgress),
StackHeight = StackHeight, StackHeight = StackHeight,
PathProgress = e.PathProgress,
}); });
break; break;
} }
@ -248,14 +250,27 @@ namespace osu.Game.Rulesets.Osu.Objects
{ {
endPositionCache.Invalidate(); endPositionCache.Invalidate();
if (HeadCircle != null) foreach (var nested in NestedHitObjects)
HeadCircle.Position = Position; {
switch (nested)
{
case SliderHeadCircle headCircle:
headCircle.Position = Position;
break;
if (TailCircle != null) case SliderTailCircle tailCircle:
TailCircle.Position = EndPosition; tailCircle.Position = EndPosition;
break;
if (LastRepeat != null) case SliderRepeat repeat:
LastRepeat.Position = RepeatCount % 2 == 0 ? Position : Position + Path.PositionAt(1); repeat.Position = Position + Path.PositionAt(repeat.PathProgress);
break;
case SliderTick tick:
tick.Position = Position + Path.PositionAt(tick.PathProgress);
break;
}
}
} }
protected void UpdateNestedSamples() protected void UpdateNestedSamples()

View File

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

View File

@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Osu.Objects
{ {
public int SpanIndex { get; set; } public int SpanIndex { get; set; }
public double SpanStartTime { get; set; } public double SpanStartTime { get; set; }
public double PathProgress { get; set; }
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty) protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
{ {