1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:07:44 +08:00

Fix nested hitobjects not updating

This commit is contained in:
smoogipoo 2019-12-06 20:53:40 +09:00
parent 41437242a2
commit b9d12e5fe4
2 changed files with 37 additions and 4 deletions

View File

@ -116,7 +116,23 @@ namespace osu.Game.Rulesets.Catch.Objects
public double Duration => EndTime - StartTime; public double Duration => EndTime - StartTime;
public SliderPath Path { get; set; } private readonly SliderPath path = new SliderPath(new[] { new PathControlPoint { Type = { Value = PathType.Linear } } });
public SliderPath Path
{
get => path;
set
{
path.ControlPoints.Clear();
path.ExpectedDistance.Value = null;
if (value != null)
{
path.ControlPoints.AddRange(value.ControlPoints);
path.ExpectedDistance.Value = value.ExpectedDistance.Value;
}
}
}
public double Distance => Path.Distance; public double Distance => Path.Distance;

View File

@ -28,7 +28,23 @@ namespace osu.Game.Rulesets.Osu.Objects
public Vector2 StackedPositionAt(double t) => StackedPosition + this.CurvePositionAt(t); public Vector2 StackedPositionAt(double t) => StackedPosition + this.CurvePositionAt(t);
public SliderPath Path { get; set; } = new SliderPath(new[] { new PathControlPoint { Type = { Value = PathType.Bezier } } }); private readonly SliderPath path = new SliderPath(new[] { new PathControlPoint { Type = { Value = PathType.Linear } } });
public SliderPath Path
{
get => path;
set
{
path.ControlPoints.Clear();
path.ExpectedDistance.Value = null;
if (value != null)
{
path.ControlPoints.AddRange(value.ControlPoints);
path.ExpectedDistance.Value = value.ExpectedDistance.Value;
}
}
}
public double Distance => Path.Distance; public double Distance => Path.Distance;
@ -38,8 +54,6 @@ namespace osu.Game.Rulesets.Osu.Objects
set set
{ {
base.Position = value; base.Position = value;
endPositionCache.Invalidate();
updateNestedPositions(); updateNestedPositions();
} }
} }
@ -102,6 +116,7 @@ namespace osu.Game.Rulesets.Osu.Objects
SamplesBindable.ItemsRemoved += _ => updateNestedSamples(); SamplesBindable.ItemsRemoved += _ => updateNestedSamples();
Path.OffsetChanged += offset => Position += offset; Path.OffsetChanged += offset => Position += offset;
Path.Version.ValueChanged += _ => updateNestedPositions();
} }
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
@ -179,6 +194,8 @@ namespace osu.Game.Rulesets.Osu.Objects
private void updateNestedPositions() private void updateNestedPositions()
{ {
endPositionCache.Invalidate();
if (HeadCircle != null) if (HeadCircle != null)
HeadCircle.Position = Position; HeadCircle.Position = Position;