mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:12:56 +08:00
Apply suggested refactorings
This commit is contained in:
parent
2c4c190f15
commit
ab0f2e7c6a
@ -257,14 +257,13 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
{
|
||||
if (type == PathType.PerfectCurve)
|
||||
{
|
||||
if (vertices.Length == 3)
|
||||
if (vertices.Length != 3)
|
||||
type = PathType.Bezier;
|
||||
else if (isLinear(vertices))
|
||||
{
|
||||
// osu-stable special-cased colinear perfect curves to a linear path
|
||||
if (isLinear(vertices))
|
||||
type = PathType.Linear;
|
||||
}
|
||||
else
|
||||
type = PathType.Bezier;
|
||||
}
|
||||
|
||||
var points = new List<PathControlPoint>(vertices.Length)
|
||||
|
@ -30,8 +30,9 @@ namespace osu.Game.Rulesets.Objects
|
||||
/// Creates a new <see cref="PathControlPoint"/>.
|
||||
/// </summary>
|
||||
public PathControlPoint()
|
||||
: this(Vector2.Zero, null)
|
||||
{
|
||||
Position.ValueChanged += _ => Changed?.Invoke();
|
||||
Type.ValueChanged += _ => Changed?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -40,12 +41,10 @@ namespace osu.Game.Rulesets.Objects
|
||||
/// <param name="position">The initial position.</param>
|
||||
/// <param name="type">The initial type.</param>
|
||||
public PathControlPoint(Vector2 position, PathType? type = null)
|
||||
: this()
|
||||
{
|
||||
Position.Value = position;
|
||||
Type.Value = type;
|
||||
|
||||
Position.ValueChanged += _ => Changed?.Invoke();
|
||||
Type.ValueChanged += _ => Changed?.Invoke();
|
||||
}
|
||||
|
||||
public bool Equals(PathControlPoint other) => Position.Value == other?.Position.Value && Type.Value == other.Type.Value;
|
||||
|
Loading…
Reference in New Issue
Block a user