mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
working jank solution
This commit is contained in:
parent
f5d6d52d4c
commit
b4f9878b46
@ -72,10 +72,27 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
};
|
};
|
||||||
|
|
||||||
hitObjectVersion = hitObject.Path.Version.GetBoundCopy();
|
hitObjectVersion = hitObject.Path.Version.GetBoundCopy();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
inputManager = GetContainingInputManager();
|
||||||
|
|
||||||
|
controlPoints.CollectionChanged += onControlPointsChanged;
|
||||||
|
controlPoints.BindTo(hitObject.Path.ControlPoints);
|
||||||
|
|
||||||
// schedule ensure that updates are only applied after all operations from a single frame are applied.
|
// schedule ensure that updates are only applied after all operations from a single frame are applied.
|
||||||
// this avoids inadvertently changing the hit object path type for batch operations.
|
// this avoids inadvertently changing the hit object path type for batch operations.
|
||||||
hitObjectVersion.BindValueChanged(_ => Scheduler.AddOnce(cachePointsAndEnsureValidPathTypes));
|
hitObject.Path.Validating += cachePointsAndEnsureValidPathTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
hitObject.Path.Validating -= cachePointsAndEnsureValidPathTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -88,7 +105,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
foreach (var controlPoint in controlPoints)
|
foreach (var controlPoint in controlPoints)
|
||||||
{
|
{
|
||||||
if (controlPoint.Type != null)
|
if (controlPoint.Type != null)
|
||||||
|
{
|
||||||
|
pointsInCurrentSegment.Add(controlPoint);
|
||||||
pointsInCurrentSegment = new List<PathControlPoint>();
|
pointsInCurrentSegment = new List<PathControlPoint>();
|
||||||
|
}
|
||||||
|
|
||||||
pointsInCurrentSegment.Add(controlPoint);
|
pointsInCurrentSegment.Add(controlPoint);
|
||||||
|
|
||||||
@ -99,13 +119,13 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
foreach (var piece in Pieces)
|
foreach (var piece in Pieces)
|
||||||
{
|
{
|
||||||
if (piece.ControlPoint.Type != PathType.PERFECT_CURVE)
|
if (piece.ControlPoint.Type != PathType.PERFECT_CURVE)
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
if (piece.PointsInSegment.Count > 3)
|
if (piece.PointsInSegment.Count > 3)
|
||||||
piece.ControlPoint.Type = PathType.BEZIER;
|
piece.ControlPoint.Type = PathType.BEZIER;
|
||||||
|
|
||||||
if (piece.PointsInSegment.Count != 3)
|
if (piece.PointsInSegment.Count != 3)
|
||||||
return;
|
continue;
|
||||||
|
|
||||||
ReadOnlySpan<Vector2> points = piece.PointsInSegment.Select(p => p.Position).ToArray();
|
ReadOnlySpan<Vector2> points = piece.PointsInSegment.Select(p => p.Position).ToArray();
|
||||||
RectangleF boundingBox = PathApproximator.CircularArcBoundingBox(points);
|
RectangleF boundingBox = PathApproximator.CircularArcBoundingBox(points);
|
||||||
@ -114,16 +134,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
inputManager = GetContainingInputManager();
|
|
||||||
|
|
||||||
controlPoints.CollectionChanged += onControlPointsChanged;
|
|
||||||
controlPoints.BindTo(hitObject.Path.ControlPoints);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Selects the <see cref="PathControlPointPiece{T}"/> corresponding to the given <paramref name="pathControlPoint"/>,
|
/// Selects the <see cref="PathControlPointPiece{T}"/> corresponding to the given <paramref name="pathControlPoint"/>,
|
||||||
/// and deselects all other <see cref="PathControlPointPiece{T}"/>s.
|
/// and deselects all other <see cref="PathControlPointPiece{T}"/>s.
|
||||||
|
@ -25,6 +25,8 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
|
|
||||||
private readonly Bindable<int> version = new Bindable<int>();
|
private readonly Bindable<int> version = new Bindable<int>();
|
||||||
|
|
||||||
|
public event Action? Validating;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user-set distance of the path. If non-null, <see cref="Distance"/> will match this value,
|
/// The user-set distance of the path. If non-null, <see cref="Distance"/> will match this value,
|
||||||
/// and the path will be shortened/lengthened to match this length.
|
/// and the path will be shortened/lengthened to match this length.
|
||||||
@ -233,6 +235,8 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
if (pathCache.IsValid)
|
if (pathCache.IsValid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Validating?.Invoke();
|
||||||
|
|
||||||
calculatePath();
|
calculatePath();
|
||||||
calculateLength();
|
calculateLength();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user