1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

lazy load slider tail position

This commit is contained in:
OliBomby 2024-01-13 01:32:37 +01:00
parent 02975b9498
commit 882f490390
3 changed files with 14 additions and 10 deletions

View File

@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Osu.Objects
set set
{ {
repeatCount = value; repeatCount = value;
updateNestedPositions(); endPositionCache.Invalidate();
} }
} }
@ -165,7 +165,7 @@ namespace osu.Game.Rulesets.Osu.Objects
public Slider() public Slider()
{ {
SamplesBindable.CollectionChanged += (_, _) => UpdateNestedSamples(); SamplesBindable.CollectionChanged += (_, _) => UpdateNestedSamples();
Path.Version.ValueChanged += _ => updateNestedPositions(); Path.Version.ValueChanged += _ => endPositionCache.Invalidate();
} }
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty) protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
@ -218,7 +218,6 @@ namespace osu.Game.Rulesets.Osu.Objects
{ {
RepeatIndex = e.SpanIndex, RepeatIndex = e.SpanIndex,
StartTime = e.Time, StartTime = e.Time,
Position = EndPosition,
StackHeight = StackHeight, StackHeight = StackHeight,
ClassicSliderBehaviour = ClassicSliderBehaviour, ClassicSliderBehaviour = ClassicSliderBehaviour,
}); });
@ -245,9 +244,6 @@ namespace osu.Game.Rulesets.Osu.Objects
if (HeadCircle != null) if (HeadCircle != null)
HeadCircle.Position = Position; HeadCircle.Position = Position;
if (TailCircle != null)
TailCircle.Position = EndPosition;
} }
protected void UpdateNestedSamples() protected void UpdateNestedSamples()

View File

@ -14,16 +14,16 @@ namespace osu.Game.Rulesets.Osu.Objects
/// </summary> /// </summary>
public abstract class SliderEndCircle : HitCircle public abstract class SliderEndCircle : HitCircle
{ {
private readonly Slider slider; protected readonly Slider Slider;
protected SliderEndCircle(Slider slider) protected SliderEndCircle(Slider slider)
{ {
this.slider = slider; Slider = slider;
} }
public int RepeatIndex { get; set; } public int RepeatIndex { get; set; }
public double SpanDuration => slider.SpanDuration; public double SpanDuration => Slider.SpanDuration;
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty) protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
{ {
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects
else else
{ {
// The first end circle should fade in with the slider. // The first end circle should fade in with the slider.
TimePreempt += StartTime - slider.StartTime; TimePreempt += StartTime - Slider.StartTime;
} }
} }

View File

@ -1,9 +1,11 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osuTK;
namespace osu.Game.Rulesets.Osu.Objects namespace osu.Game.Rulesets.Osu.Objects
{ {
@ -15,6 +17,12 @@ namespace osu.Game.Rulesets.Osu.Objects
/// </summary> /// </summary>
public bool ClassicSliderBehaviour; public bool ClassicSliderBehaviour;
public override Vector2 Position
{
get => Slider.EndPosition;
set => throw new NotImplementedException();
}
public SliderTailCircle(Slider slider) public SliderTailCircle(Slider slider)
: base(slider) : base(slider)
{ {