mirror of https://github.com/ppy/osu
Fix code style/quality issues
This commit is contained in:
parent
8ad8764947
commit
fa976a5aa0
|
@ -140,7 +140,7 @@ public void TestUpdateFromHitObject()
|
|||
|
||||
AddStep("update hit object path", () =>
|
||||
{
|
||||
hitObject.Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
||||
hitObject.Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(100, 100),
|
||||
|
@ -190,14 +190,14 @@ public void TestDeleteVertex()
|
|||
[Test]
|
||||
public void TestVertexResampling()
|
||||
{
|
||||
addBlueprintStep(100, 100, new SliderPath(PathType.PERFECTCURVE, new[]
|
||||
addBlueprintStep(100, 100, new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(100, 100),
|
||||
new Vector2(50, 200),
|
||||
}), 0.5);
|
||||
AddAssert("1 vertex per 1 nested HO", () => getVertices().Count == hitObject.NestedHitObjects.Count);
|
||||
AddAssert("slider path not yet changed", () => hitObject.Path.ControlPoints[0].Type == PathType.PERFECTCURVE);
|
||||
AddAssert("slider path not yet changed", () => hitObject.Path.ControlPoints[0].Type == PathType.PERFECT_CURVE);
|
||||
addAddVertexSteps(150, 150);
|
||||
AddAssert("slider path change to linear", () => hitObject.Path.ControlPoints[0].Type == PathType.LINEAR);
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ public void TestRandomConvertFromSliderPath(double velocity)
|
|||
} while (rng.Next(2) != 0);
|
||||
|
||||
int length = sliderPath.ControlPoints.Count - start + 1;
|
||||
sliderPath.ControlPoints[start].Type = length <= 2 ? PathType.LINEAR : length == 3 ? PathType.PERFECTCURVE : PathType.BEZIER;
|
||||
sliderPath.ControlPoints[start].Type = length <= 2 ? PathType.LINEAR : length == 3 ? PathType.PERFECT_CURVE : PathType.BEZIER;
|
||||
} while (rng.Next(3) != 0);
|
||||
|
||||
if (rng.Next(5) == 0)
|
||||
|
|
|
@ -214,7 +214,7 @@ public void TestSliderOffscreenPath()
|
|||
Path = new SliderPath(new[]
|
||||
{
|
||||
// Circular arc shoots over the top of the screen.
|
||||
new PathControlPoint(new Vector2(0, 0), PathType.PERFECTCURVE),
|
||||
new PathControlPoint(new Vector2(0, 0), PathType.PERFECT_CURVE),
|
||||
new PathControlPoint(new Vector2(-100, -200)),
|
||||
new PathControlPoint(new Vector2(100, -200))
|
||||
}),
|
||||
|
|
|
@ -25,7 +25,7 @@ public void TestSelectDoesNotModify()
|
|||
|
||||
PathControlPoint[] points =
|
||||
{
|
||||
new PathControlPoint(new Vector2(0), PathType.PERFECTCURVE),
|
||||
new PathControlPoint(new Vector2(0), PathType.PERFECT_CURVE),
|
||||
new PathControlPoint(new Vector2(-100, 0)),
|
||||
new PathControlPoint(new Vector2(100, 20))
|
||||
};
|
||||
|
|
|
@ -64,7 +64,7 @@ public void TestPerfectCurveTooManyPoints()
|
|||
addContextMenuItemStep("Perfect curve");
|
||||
|
||||
assertControlPointPathType(0, PathType.BEZIER);
|
||||
assertControlPointPathType(1, PathType.PERFECTCURVE);
|
||||
assertControlPointPathType(1, PathType.PERFECT_CURVE);
|
||||
assertControlPointPathType(3, PathType.BEZIER);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public void TestPerfectCurveLastThreePoints()
|
|||
addContextMenuItemStep("Perfect curve");
|
||||
|
||||
assertControlPointPathType(0, PathType.BEZIER);
|
||||
assertControlPointPathType(2, PathType.PERFECTCURVE);
|
||||
assertControlPointPathType(2, PathType.PERFECT_CURVE);
|
||||
assertControlPointPathType(4, null);
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ public void TestPerfectCurveTooManyPointsLinear()
|
|||
addContextMenuItemStep("Perfect curve");
|
||||
|
||||
assertControlPointPathType(0, PathType.LINEAR);
|
||||
assertControlPointPathType(1, PathType.PERFECTCURVE);
|
||||
assertControlPointPathType(1, PathType.PERFECT_CURVE);
|
||||
assertControlPointPathType(3, PathType.LINEAR);
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ public void TestPerfectCurveChangeToBezier()
|
|||
createVisualiser(true);
|
||||
|
||||
addControlPointStep(new Vector2(200), PathType.BEZIER);
|
||||
addControlPointStep(new Vector2(300), PathType.PERFECTCURVE);
|
||||
addControlPointStep(new Vector2(300), PathType.PERFECT_CURVE);
|
||||
addControlPointStep(new Vector2(500, 300));
|
||||
addControlPointStep(new Vector2(700, 200), PathType.BEZIER);
|
||||
addControlPointStep(new Vector2(500, 100));
|
||||
|
|
|
@ -38,9 +38,9 @@ public void Setup() => Schedule(() =>
|
|||
Position = new Vector2(256, 192),
|
||||
Path = new SliderPath(new[]
|
||||
{
|
||||
new PathControlPoint(Vector2.Zero, PathType.PERFECTCURVE),
|
||||
new PathControlPoint(Vector2.Zero, PathType.PERFECT_CURVE),
|
||||
new PathControlPoint(new Vector2(150, 150)),
|
||||
new PathControlPoint(new Vector2(300, 0), PathType.PERFECTCURVE),
|
||||
new PathControlPoint(new Vector2(300, 0), PathType.PERFECT_CURVE),
|
||||
new PathControlPoint(new Vector2(400, 0)),
|
||||
new PathControlPoint(new Vector2(400, 150))
|
||||
})
|
||||
|
@ -182,7 +182,7 @@ public void TestDragControlPoint()
|
|||
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
|
||||
assertControlPointPosition(1, new Vector2(150, 50));
|
||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
||||
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -210,7 +210,7 @@ public void TestDragMultipleControlPoints()
|
|||
AddAssert("three control point pieces selected", () => this.ChildrenOfType<PathControlPointPiece<Slider>>().Count(piece => piece.IsSelected.Value) == 3);
|
||||
|
||||
assertControlPointPosition(2, new Vector2(450, 50));
|
||||
assertControlPointType(2, PathType.PERFECTCURVE);
|
||||
assertControlPointType(2, PathType.PERFECT_CURVE);
|
||||
|
||||
assertControlPointPosition(3, new Vector2(550, 50));
|
||||
|
||||
|
@ -249,7 +249,7 @@ public void TestDragMultipleControlPointsIncludingHead()
|
|||
AddAssert("slider moved", () => Precision.AlmostEquals(slider.Position, new Vector2(256, 192) + new Vector2(150, 50)));
|
||||
|
||||
assertControlPointPosition(0, Vector2.Zero);
|
||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
||||
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||
|
||||
assertControlPointPosition(1, new Vector2(0, 100));
|
||||
|
||||
|
@ -288,7 +288,7 @@ public void TestDragControlPointPathRecovery()
|
|||
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
|
||||
assertControlPointPosition(1, new Vector2(150, 50));
|
||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
||||
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -304,7 +304,7 @@ public void TestDragControlPointPathRecoveryOtherSegment()
|
|||
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
|
||||
assertControlPointPosition(4, new Vector2(150, 150));
|
||||
assertControlPointType(2, PathType.PERFECTCURVE);
|
||||
assertControlPointType(2, PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -312,12 +312,12 @@ public void TestDragControlPointPathAfterChangingType()
|
|||
{
|
||||
AddStep("change type to bezier", () => slider.Path.ControlPoints[2].Type = PathType.BEZIER);
|
||||
AddStep("add point", () => slider.Path.ControlPoints.Add(new PathControlPoint(new Vector2(500, 10))));
|
||||
AddStep("change type to perfect", () => slider.Path.ControlPoints[3].Type = PathType.PERFECTCURVE);
|
||||
AddStep("change type to perfect", () => slider.Path.ControlPoints[3].Type = PathType.PERFECT_CURVE);
|
||||
|
||||
moveMouseToControlPoint(4);
|
||||
AddStep("hold", () => InputManager.PressButton(MouseButton.Left));
|
||||
|
||||
assertControlPointType(3, PathType.PERFECTCURVE);
|
||||
assertControlPointType(3, PathType.PERFECT_CURVE);
|
||||
|
||||
addMovementStep(new Vector2(350, 0.01f));
|
||||
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
|
|
|
@ -126,7 +126,7 @@ public void TestDeletingPointCausesSliderDeletion()
|
|||
|
||||
PathControlPoint[] points =
|
||||
{
|
||||
new PathControlPoint(new Vector2(0), PathType.PERFECTCURVE),
|
||||
new PathControlPoint(new Vector2(0), PathType.PERFECT_CURVE),
|
||||
new PathControlPoint(new Vector2(100, 0)),
|
||||
new PathControlPoint(new Vector2(0, 10))
|
||||
};
|
||||
|
|
|
@ -90,7 +90,7 @@ public void TestPlaceNormalControlPoint()
|
|||
assertPlaced(true);
|
||||
assertControlPointCount(3);
|
||||
assertControlPointPosition(1, new Vector2(100, 0));
|
||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
||||
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -172,7 +172,7 @@ public void TestMoveToBezierThenPlacePerfectCurve()
|
|||
|
||||
assertPlaced(true);
|
||||
assertControlPointCount(3);
|
||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
||||
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -241,7 +241,7 @@ public void TestPlaceLinearSegmentThenPlacePerfectCurveSegment()
|
|||
assertControlPointPosition(1, new Vector2(100, 0));
|
||||
assertControlPointPosition(2, new Vector2(100));
|
||||
assertControlPointType(0, PathType.LINEAR);
|
||||
assertControlPointType(1, PathType.PERFECTCURVE);
|
||||
assertControlPointType(1, PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -269,8 +269,8 @@ public void TestPlacePerfectCurveSegmentThenPlacePerfectCurveSegment()
|
|||
assertControlPointPosition(2, new Vector2(100));
|
||||
assertControlPointPosition(3, new Vector2(200, 100));
|
||||
assertControlPointPosition(4, new Vector2(200));
|
||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
||||
assertControlPointType(2, PathType.PERFECTCURVE);
|
||||
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||
assertControlPointType(2, PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -326,7 +326,7 @@ public void TestPlacePerfectCurveSegmentRecovery()
|
|||
|
||||
assertPlaced(true);
|
||||
assertControlPointCount(3);
|
||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
||||
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -347,7 +347,7 @@ public void TestPlacePerfectCurveSegmentLarge()
|
|||
|
||||
assertPlaced(true);
|
||||
assertControlPointCount(3);
|
||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
||||
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -385,7 +385,7 @@ public void TestPlacePerfectCurveSegmentCompleteArc()
|
|||
|
||||
assertPlaced(true);
|
||||
assertControlPointCount(3);
|
||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
||||
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
private void addMovementStep(Vector2 position) => AddStep($"move mouse to {position}", () => InputManager.MoveMouseTo(InputManager.ToScreenSpace(position)));
|
||||
|
|
|
@ -22,7 +22,7 @@ public partial class TestSceneSliderReversal : TestSceneOsuEditor
|
|||
private readonly PathControlPoint[][] paths =
|
||||
{
|
||||
createPathSegment(
|
||||
PathType.PERFECTCURVE,
|
||||
PathType.PERFECT_CURVE,
|
||||
new Vector2(200, -50),
|
||||
new Vector2(250, 0)
|
||||
),
|
||||
|
|
|
@ -56,7 +56,7 @@ public override void SetUpSteps()
|
|||
{
|
||||
ControlPoints =
|
||||
{
|
||||
new PathControlPoint(Vector2.Zero, PathType.PERFECTCURVE),
|
||||
new PathControlPoint(Vector2.Zero, PathType.PERFECT_CURVE),
|
||||
new PathControlPoint(new Vector2(136, 205)),
|
||||
new PathControlPoint(new Vector2(-4, 226))
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ public void TestRotatingSliderRetainsPerfectControlPointType()
|
|||
{
|
||||
OsuSelectionHandler selectionHandler;
|
||||
|
||||
AddAssert("first control point perfect", () => slider.Path.ControlPoints[0].Type == PathType.PERFECTCURVE);
|
||||
AddAssert("first control point perfect", () => slider.Path.ControlPoints[0].Type == PathType.PERFECT_CURVE);
|
||||
|
||||
AddStep("select slider", () => EditorBeatmap.SelectedHitObjects.Add(slider));
|
||||
AddStep("rotate 90 degrees ccw", () =>
|
||||
|
@ -190,7 +190,7 @@ public void TestRotatingSliderRetainsPerfectControlPointType()
|
|||
selectionHandler.HandleRotation(-90);
|
||||
});
|
||||
|
||||
AddAssert("first control point still perfect", () => slider.Path.ControlPoints[0].Type == PathType.PERFECTCURVE);
|
||||
AddAssert("first control point still perfect", () => slider.Path.ControlPoints[0].Type == PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -223,7 +223,7 @@ public void TestFlippingSliderRetainsPerfectControlPointType()
|
|||
{
|
||||
OsuSelectionHandler selectionHandler;
|
||||
|
||||
AddAssert("first control point perfect", () => slider.Path.ControlPoints[0].Type == PathType.PERFECTCURVE);
|
||||
AddAssert("first control point perfect", () => slider.Path.ControlPoints[0].Type == PathType.PERFECT_CURVE);
|
||||
|
||||
AddStep("select slider", () => EditorBeatmap.SelectedHitObjects.Add(slider));
|
||||
AddStep("flip slider horizontally", () =>
|
||||
|
@ -232,7 +232,7 @@ public void TestFlippingSliderRetainsPerfectControlPointType()
|
|||
selectionHandler.OnPressed(new KeyBindingPressEvent<GlobalAction>(InputManager.CurrentState, GlobalAction.EditorFlipVertically));
|
||||
});
|
||||
|
||||
AddAssert("first control point still perfect", () => slider.Path.ControlPoints[0].Type == PathType.PERFECTCURVE);
|
||||
AddAssert("first control point still perfect", () => slider.Path.ControlPoints[0].Type == PathType.PERFECT_CURVE);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -45,9 +45,9 @@ public void TestBasicSplit()
|
|||
Position = new Vector2(0, 50),
|
||||
Path = new SliderPath(new[]
|
||||
{
|
||||
new PathControlPoint(Vector2.Zero, PathType.PERFECTCURVE),
|
||||
new PathControlPoint(Vector2.Zero, PathType.PERFECT_CURVE),
|
||||
new PathControlPoint(new Vector2(150, 150)),
|
||||
new PathControlPoint(new Vector2(300, 0), PathType.PERFECTCURVE),
|
||||
new PathControlPoint(new Vector2(300, 0), PathType.PERFECT_CURVE),
|
||||
new PathControlPoint(new Vector2(400, 0)),
|
||||
new PathControlPoint(new Vector2(400, 150))
|
||||
})
|
||||
|
@ -73,20 +73,20 @@ public void TestBasicSplit()
|
|||
|
||||
AddAssert("slider split", () => slider is not null && EditorBeatmap.HitObjects.Count == 2 &&
|
||||
sliderCreatedFor((Slider)EditorBeatmap.HitObjects[0], 0, EditorBeatmap.HitObjects[1].StartTime - split_gap,
|
||||
(new Vector2(0, 50), PathType.PERFECTCURVE),
|
||||
(new Vector2(0, 50), PathType.PERFECT_CURVE),
|
||||
(new Vector2(150, 200), null),
|
||||
(new Vector2(300, 50), null)
|
||||
) && sliderCreatedFor((Slider)EditorBeatmap.HitObjects[1], slider.StartTime, endTime + split_gap,
|
||||
(new Vector2(300, 50), PathType.PERFECTCURVE),
|
||||
(new Vector2(300, 50), PathType.PERFECT_CURVE),
|
||||
(new Vector2(400, 50), null),
|
||||
(new Vector2(400, 200), null)
|
||||
));
|
||||
|
||||
AddStep("undo", () => Editor.Undo());
|
||||
AddAssert("original slider restored", () => EditorBeatmap.HitObjects.Count == 1 && sliderCreatedFor((Slider)EditorBeatmap.HitObjects[0], 0, endTime,
|
||||
(new Vector2(0, 50), PathType.PERFECTCURVE),
|
||||
(new Vector2(0, 50), PathType.PERFECT_CURVE),
|
||||
(new Vector2(150, 200), null),
|
||||
(new Vector2(300, 50), PathType.PERFECTCURVE),
|
||||
(new Vector2(300, 50), PathType.PERFECT_CURVE),
|
||||
(new Vector2(400, 50), null),
|
||||
(new Vector2(400, 200), null)
|
||||
));
|
||||
|
@ -104,7 +104,7 @@ public void TestDoubleSplit()
|
|||
Position = new Vector2(0, 50),
|
||||
Path = new SliderPath(new[]
|
||||
{
|
||||
new PathControlPoint(Vector2.Zero, PathType.PERFECTCURVE),
|
||||
new PathControlPoint(Vector2.Zero, PathType.PERFECT_CURVE),
|
||||
new PathControlPoint(new Vector2(150, 150)),
|
||||
new PathControlPoint(new Vector2(300, 0), PathType.BEZIER),
|
||||
new PathControlPoint(new Vector2(400, 0)),
|
||||
|
@ -139,7 +139,7 @@ public void TestDoubleSplit()
|
|||
|
||||
AddAssert("slider split", () => slider is not null && EditorBeatmap.HitObjects.Count == 3 &&
|
||||
sliderCreatedFor((Slider)EditorBeatmap.HitObjects[0], 0, EditorBeatmap.HitObjects[1].StartTime - split_gap,
|
||||
(new Vector2(0, 50), PathType.PERFECTCURVE),
|
||||
(new Vector2(0, 50), PathType.PERFECT_CURVE),
|
||||
(new Vector2(150, 200), null),
|
||||
(new Vector2(300, 50), null)
|
||||
) && sliderCreatedFor((Slider)EditorBeatmap.HitObjects[1], EditorBeatmap.HitObjects[0].GetEndTime() + split_gap, slider.StartTime - split_gap,
|
||||
|
@ -165,9 +165,9 @@ public void TestSplitRetainsHitsounds()
|
|||
Position = new Vector2(0, 50),
|
||||
Path = new SliderPath(new[]
|
||||
{
|
||||
new PathControlPoint(Vector2.Zero, PathType.PERFECTCURVE),
|
||||
new PathControlPoint(Vector2.Zero, PathType.PERFECT_CURVE),
|
||||
new PathControlPoint(new Vector2(150, 150)),
|
||||
new PathControlPoint(new Vector2(300, 0), PathType.PERFECTCURVE),
|
||||
new PathControlPoint(new Vector2(300, 0), PathType.PERFECT_CURVE),
|
||||
new PathControlPoint(new Vector2(400, 0)),
|
||||
new PathControlPoint(new Vector2(400, 150))
|
||||
})
|
||||
|
|
|
@ -219,7 +219,7 @@ private Drawable testDistanceOverflow(int repeats = 0)
|
|||
{
|
||||
StartTime = Time.Current + time_offset,
|
||||
Position = new Vector2(239, 176),
|
||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
||||
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(154, 28),
|
||||
|
@ -255,7 +255,7 @@ private Drawable createSlider(float circleSize = 2, float distance = max_length,
|
|||
SliderVelocityMultiplier = speedMultiplier,
|
||||
StartTime = Time.Current + time_offset,
|
||||
Position = new Vector2(0, -(distance / 2)),
|
||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
||||
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(0, distance),
|
||||
|
@ -273,7 +273,7 @@ private Drawable testPerfect(int repeats = 0)
|
|||
{
|
||||
StartTime = Time.Current + time_offset,
|
||||
Position = new Vector2(-max_length / 2, 0),
|
||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
||||
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(max_length / 2, max_length / 2),
|
||||
|
|
|
@ -478,7 +478,7 @@ private void performTest(List<ReplayFrame> frames, Slider? slider = null, double
|
|||
StartTime = time_slider_start,
|
||||
Position = new Vector2(0, 0),
|
||||
SliderVelocityMultiplier = 0.1f,
|
||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
||||
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(slider_path_length, 0),
|
||||
|
|
|
@ -217,7 +217,7 @@ private void addSeekStep(Func<double> getTime)
|
|||
{
|
||||
StartTime = 3000,
|
||||
Position = new Vector2(100, 100),
|
||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
||||
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(300, 200)
|
||||
|
@ -227,7 +227,7 @@ private void addSeekStep(Func<double> getTime)
|
|||
{
|
||||
StartTime = 13000,
|
||||
Position = new Vector2(100, 100),
|
||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
||||
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(300, 200)
|
||||
|
@ -238,7 +238,7 @@ private void addSeekStep(Func<double> getTime)
|
|||
{
|
||||
StartTime = 23000,
|
||||
Position = new Vector2(100, 100),
|
||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
||||
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(300, 200)
|
||||
|
|
|
@ -221,7 +221,7 @@ protected override bool OnDragStart(DragStartEvent e)
|
|||
/// </summary>
|
||||
private void updatePathType()
|
||||
{
|
||||
if (ControlPoint.Type != PathType.PERFECTCURVE)
|
||||
if (ControlPoint.Type != PathType.PERFECT_CURVE)
|
||||
return;
|
||||
|
||||
if (PointsInSegment.Count > 3)
|
||||
|
@ -259,19 +259,19 @@ private Color4 getColourFromNodeType()
|
|||
if (ControlPoint.Type is not PathType pathType)
|
||||
return colours.Yellow;
|
||||
|
||||
switch (pathType)
|
||||
switch (pathType.Type)
|
||||
{
|
||||
case { Type: SplineType.Catmull }:
|
||||
case SplineType.Catmull:
|
||||
return colours.SeaFoam;
|
||||
|
||||
case { Type: SplineType.BSpline, Degree: null }:
|
||||
return colours.PinkLighter;
|
||||
case SplineType.BSpline:
|
||||
if (!pathType.Degree.HasValue)
|
||||
return colours.PinkLighter;
|
||||
|
||||
case { Type: SplineType.BSpline, Degree: >= 1 }:
|
||||
int idx = Math.Clamp(pathType.Degree.Value, 0, 3);
|
||||
return new[] { colours.PinkDarker, colours.PinkDark, colours.Pink, colours.PinkLight }[idx];
|
||||
|
||||
case { Type: SplineType.PerfectCurve }:
|
||||
case SplineType.PerfectCurve:
|
||||
return colours.PurpleDark;
|
||||
|
||||
default:
|
||||
|
|
|
@ -368,7 +368,7 @@ public MenuItem[] ContextMenuItems
|
|||
|
||||
// todo: hide/disable items which aren't valid for selected points
|
||||
curveTypeItems.Add(createMenuItemForPathType(PathType.LINEAR));
|
||||
curveTypeItems.Add(createMenuItemForPathType(PathType.PERFECTCURVE));
|
||||
curveTypeItems.Add(createMenuItemForPathType(PathType.PERFECT_CURVE));
|
||||
curveTypeItems.Add(createMenuItemForPathType(PathType.BEZIER));
|
||||
curveTypeItems.Add(createMenuItemForPathType(PathType.BSpline(3)));
|
||||
curveTypeItems.Add(createMenuItemForPathType(PathType.CATMULL));
|
||||
|
|
|
@ -251,7 +251,7 @@ private void updatePathType()
|
|||
break;
|
||||
|
||||
case 3:
|
||||
segmentStart.Type = PathType.PERFECTCURVE;
|
||||
segmentStart.Type = PathType.PERFECT_CURVE;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace osu.Game.Rulesets.Osu.Edit
|
||||
{
|
||||
public partial class OsuSliderDrawingSettingsProvider : Drawable, ISliderDrawingSettingsProvider
|
||||
public partial class OsuSliderDrawingSettingsProvider : Drawable, ISliderDrawingSettingsProvider, IToolboxAttachment
|
||||
{
|
||||
public BindableFloat Tolerance { get; } = new BindableFloat(0.1f)
|
||||
{
|
||||
|
@ -27,12 +27,14 @@ public partial class OsuSliderDrawingSettingsProvider : Drawable, ISliderDrawing
|
|||
|
||||
private ExpandableSlider<int> toleranceSlider = null!;
|
||||
|
||||
public OsuSliderDrawingSettingsProvider()
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
sliderTolerance.BindValueChanged(v =>
|
||||
{
|
||||
float newValue = v.NewValue / 100f;
|
||||
if (!Precision.AlmostEquals(newValue, Tolerance.Value, 1e-7f))
|
||||
if (!Precision.AlmostEquals(newValue, Tolerance.Value))
|
||||
Tolerance.Value = newValue;
|
||||
});
|
||||
Tolerance.BindValueChanged(v =>
|
||||
|
|
|
@ -808,7 +808,7 @@ public void TestMultiSegmentSliders()
|
|||
var first = ((IHasPath)decoded.HitObjects[0]).Path;
|
||||
|
||||
Assert.That(first.ControlPoints[0].Position, Is.EqualTo(Vector2.Zero));
|
||||
Assert.That(first.ControlPoints[0].Type, Is.EqualTo(PathType.PERFECTCURVE));
|
||||
Assert.That(first.ControlPoints[0].Type, Is.EqualTo(PathType.PERFECT_CURVE));
|
||||
Assert.That(first.ControlPoints[1].Position, Is.EqualTo(new Vector2(161, -244)));
|
||||
Assert.That(first.ControlPoints[1].Type, Is.EqualTo(null));
|
||||
|
||||
|
@ -827,7 +827,7 @@ public void TestMultiSegmentSliders()
|
|||
var second = ((IHasPath)decoded.HitObjects[1]).Path;
|
||||
|
||||
Assert.That(second.ControlPoints[0].Position, Is.EqualTo(Vector2.Zero));
|
||||
Assert.That(second.ControlPoints[0].Type, Is.EqualTo(PathType.PERFECTCURVE));
|
||||
Assert.That(second.ControlPoints[0].Type, Is.EqualTo(PathType.PERFECT_CURVE));
|
||||
Assert.That(second.ControlPoints[1].Position, Is.EqualTo(new Vector2(161, -244)));
|
||||
Assert.That(second.ControlPoints[1].Type, Is.EqualTo(null));
|
||||
Assert.That(second.ControlPoints[2].Position, Is.EqualTo(new Vector2(376, -3)));
|
||||
|
@ -904,12 +904,12 @@ public void TestMultiSegmentSliders()
|
|||
var seventh = ((IHasPath)decoded.HitObjects[6]).Path;
|
||||
|
||||
Assert.That(seventh.ControlPoints[0].Position, Is.EqualTo(Vector2.Zero));
|
||||
Assert.That(seventh.ControlPoints[0].Type == PathType.PERFECTCURVE);
|
||||
Assert.That(seventh.ControlPoints[0].Type == PathType.PERFECT_CURVE);
|
||||
Assert.That(seventh.ControlPoints[1].Position, Is.EqualTo(new Vector2(75, 145)));
|
||||
Assert.That(seventh.ControlPoints[1].Type == null);
|
||||
Assert.That(seventh.ControlPoints[2].Position, Is.EqualTo(new Vector2(170, 75)));
|
||||
|
||||
Assert.That(seventh.ControlPoints[2].Type == PathType.PERFECTCURVE);
|
||||
Assert.That(seventh.ControlPoints[2].Type == PathType.PERFECT_CURVE);
|
||||
Assert.That(seventh.ControlPoints[3].Position, Is.EqualTo(new Vector2(300, 145)));
|
||||
Assert.That(seventh.ControlPoints[3].Type == null);
|
||||
Assert.That(seventh.ControlPoints[4].Position, Is.EqualTo(new Vector2(410, 20)));
|
||||
|
|
|
@ -143,7 +143,7 @@ public void TestComplex()
|
|||
{
|
||||
path.ControlPoints.AddRange(createSegment(PathType.LINEAR, Vector2.Zero, new Vector2(100, 0)));
|
||||
path.ControlPoints.AddRange(createSegment(PathType.BEZIER, new Vector2(100, 0), new Vector2(150, 30), new Vector2(100, 100)));
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECTCURVE, new Vector2(100, 100), new Vector2(25, 50), Vector2.Zero));
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECT_CURVE, new Vector2(100, 100), new Vector2(25, 50), Vector2.Zero));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ public void TestPerfectCurveAngles(float height, float width)
|
|||
{
|
||||
AddStep("create path", () =>
|
||||
{
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECTCURVE, Vector2.Zero, new Vector2(width / 2, height), new Vector2(width, 0)));
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECT_CURVE, Vector2.Zero, new Vector2(width / 2, height), new Vector2(width, 0)));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -172,11 +172,11 @@ public void TestPerfectCurveFallbackScenarios(int points)
|
|||
switch (points)
|
||||
{
|
||||
case 2:
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECTCURVE, Vector2.Zero, new Vector2(0, 100)));
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECT_CURVE, Vector2.Zero, new Vector2(0, 100)));
|
||||
break;
|
||||
|
||||
case 4:
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECTCURVE, Vector2.Zero, new Vector2(0, 100), new Vector2(100), new Vector2(100, 0)));
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECT_CURVE, Vector2.Zero, new Vector2(0, 100), new Vector2(100), new Vector2(100, 0)));
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -149,11 +149,11 @@ public void TestPerfectCurveFallbackScenarios(int points)
|
|||
switch (points)
|
||||
{
|
||||
case 2:
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECTCURVE, Vector2.Zero, new Vector2(0, 100)));
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECT_CURVE, Vector2.Zero, new Vector2(0, 100)));
|
||||
break;
|
||||
|
||||
case 4:
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECTCURVE, Vector2.Zero, new Vector2(0, 100), new Vector2(100), new Vector2(100, 0)));
|
||||
path.ControlPoints.AddRange(createSegment(PathType.PERFECT_CURVE, Vector2.Zero, new Vector2(0, 100), new Vector2(100), new Vector2(100, 0)));
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -437,7 +437,7 @@ private void addPathData(TextWriter writer, IHasPath pathData, Vector2 position)
|
|||
// Explicit segments have a new format in which the type is injected into the middle of the control point string.
|
||||
// To preserve compatibility with osu-stable as much as possible, explicit segments with the same type are converted to use implicit segments by duplicating the control point.
|
||||
// One exception are consecutive perfect curves, which aren't supported in osu!stable and can lead to decoding issues if encoded as implicit segments
|
||||
bool needsExplicitSegment = point.Type != lastType || point.Type == PathType.PERFECTCURVE;
|
||||
bool needsExplicitSegment = point.Type != lastType || point.Type == PathType.PERFECT_CURVE;
|
||||
|
||||
// Another exception to this is when the last two control points of the last segment were duplicated. This is not a scenario supported by osu!stable.
|
||||
// Lazer does not add implicit segments for the last two control points of _any_ explicit segment, so an explicit segment is forced in order to maintain consistency with the decoder.
|
||||
|
@ -453,25 +453,21 @@ private void addPathData(TextWriter writer, IHasPath pathData, Vector2 position)
|
|||
|
||||
if (needsExplicitSegment)
|
||||
{
|
||||
switch (point.Type)
|
||||
switch (point.Type?.Type)
|
||||
{
|
||||
case { Type: SplineType.BSpline, Degree: > 0 }:
|
||||
writer.Write($"B{point.Type.Value.Degree}|");
|
||||
case SplineType.BSpline:
|
||||
writer.Write(point.Type.Value.Degree > 0 ? $"B{point.Type.Value.Degree}|" : "B|");
|
||||
break;
|
||||
|
||||
case { Type: SplineType.BSpline, Degree: <= 0 }:
|
||||
writer.Write("B|");
|
||||
break;
|
||||
|
||||
case { Type: SplineType.Catmull }:
|
||||
case SplineType.Catmull:
|
||||
writer.Write("C|");
|
||||
break;
|
||||
|
||||
case { Type: SplineType.PerfectCurve }:
|
||||
case SplineType.PerfectCurve:
|
||||
writer.Write("P|");
|
||||
break;
|
||||
|
||||
case { Type: SplineType.Linear }:
|
||||
case SplineType.Linear:
|
||||
writer.Write("L|");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
public abstract partial class ComposerDistanceSnapProvider : Component, IDistanceSnapProvider, IScrollBindingHandler<GlobalAction>
|
||||
public abstract partial class ComposerDistanceSnapProvider : Component, IDistanceSnapProvider, IScrollBindingHandler<GlobalAction>, IToolboxAttachment
|
||||
{
|
||||
private const float adjust_step = 0.1f;
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// 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.
|
||||
|
||||
namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
public interface IToolboxAttachment
|
||||
{
|
||||
void AttachToToolbox(ExpandingToolboxContainer toolbox);
|
||||
}
|
||||
}
|
|
@ -126,9 +126,9 @@ public static List<PathControlPoint> ConvertToModernBezier(IList<PathControlPoin
|
|||
var segmentVertices = vertices.AsSpan().Slice(start, i - start + 1);
|
||||
var segmentType = controlPoints[start].Type ?? PathType.LINEAR;
|
||||
|
||||
switch (segmentType)
|
||||
switch (segmentType.Type)
|
||||
{
|
||||
case { Type: SplineType.Catmull }:
|
||||
case SplineType.Catmull:
|
||||
foreach (var segment in ConvertCatmullToBezierAnchors(segmentVertices))
|
||||
{
|
||||
for (int j = 0; j < segment.Length - 1; j++)
|
||||
|
@ -139,7 +139,7 @@ public static List<PathControlPoint> ConvertToModernBezier(IList<PathControlPoin
|
|||
|
||||
break;
|
||||
|
||||
case { Type: SplineType.Linear }:
|
||||
case SplineType.Linear:
|
||||
foreach (var segment in ConvertLinearToBezierAnchors(segmentVertices))
|
||||
{
|
||||
for (int j = 0; j < segment.Length - 1; j++)
|
||||
|
@ -150,7 +150,7 @@ public static List<PathControlPoint> ConvertToModernBezier(IList<PathControlPoin
|
|||
|
||||
break;
|
||||
|
||||
case { Type: SplineType.PerfectCurve }:
|
||||
case SplineType.PerfectCurve:
|
||||
var circleResult = ConvertCircleToBezierAnchors(segmentVertices);
|
||||
|
||||
for (int j = 0; j < circleResult.Length - 1; j++)
|
||||
|
|
|
@ -224,19 +224,19 @@ private PathType convertPathType(string input)
|
|||
{
|
||||
default:
|
||||
case 'C':
|
||||
return new PathType(SplineType.Catmull);
|
||||
return PathType.CATMULL;
|
||||
|
||||
case 'B':
|
||||
if (input.Length > 1 && int.TryParse(input.Substring(1), out int degree) && degree > 0)
|
||||
return new PathType { Type = SplineType.BSpline, Degree = degree };
|
||||
return PathType.BSpline(degree);
|
||||
|
||||
return new PathType(SplineType.BSpline);
|
||||
|
||||
case 'L':
|
||||
return new PathType(SplineType.Linear);
|
||||
return PathType.LINEAR;
|
||||
|
||||
case 'P':
|
||||
return new PathType(SplineType.PerfectCurve);
|
||||
return PathType.PERFECT_CURVE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ private IEnumerable<Memory<PathControlPoint>> convertPoints(ReadOnlyMemory<strin
|
|||
readPoint(endPoint, offset, out vertices[^1]);
|
||||
|
||||
// Edge-case rules (to match stable).
|
||||
if (type == PathType.PERFECTCURVE)
|
||||
if (type == PathType.PERFECT_CURVE)
|
||||
{
|
||||
if (vertices.Length != 3)
|
||||
type = PathType.BEZIER;
|
||||
|
|
|
@ -53,7 +53,7 @@ public static void Reverse(this SliderPath sliderPath, out Vector2 positionalOff
|
|||
inheritedLinearPoints.ForEach(p => p.Type = null);
|
||||
|
||||
// Recalculate middle perfect curve control points at the end of the slider path.
|
||||
if (controlPoints.Count >= 3 && controlPoints[^3].Type == PathType.PERFECTCURVE && controlPoints[^2].Type is null && segmentEnds.Any())
|
||||
if (controlPoints.Count >= 3 && controlPoints[^3].Type == PathType.PERFECT_CURVE && controlPoints[^2].Type is null && segmentEnds.Any())
|
||||
{
|
||||
double lastSegmentStart = segmentEnds.Length > 1 ? segmentEnds[^2] : 0;
|
||||
double lastSegmentEnd = segmentEnds[^1];
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Types
|
||||
{
|
||||
|
@ -14,12 +13,12 @@ public enum SplineType
|
|||
PerfectCurve
|
||||
}
|
||||
|
||||
public readonly struct PathType
|
||||
public readonly struct PathType : IEquatable<PathType>
|
||||
{
|
||||
public static readonly PathType CATMULL = new PathType(SplineType.Catmull);
|
||||
public static readonly PathType BEZIER = new PathType(SplineType.BSpline);
|
||||
public static readonly PathType LINEAR = new PathType(SplineType.Linear);
|
||||
public static readonly PathType PERFECTCURVE = new PathType(SplineType.PerfectCurve);
|
||||
public static readonly PathType PERFECT_CURVE = new PathType(SplineType.PerfectCurve);
|
||||
|
||||
/// <summary>
|
||||
/// The type of the spline that should be used to interpret the control points of the path.
|
||||
|
@ -52,8 +51,13 @@ public override bool Equals(object? obj)
|
|||
|
||||
public static PathType BSpline(int degree)
|
||||
{
|
||||
Debug.Assert(degree > 0);
|
||||
if (degree <= 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(degree), "The degree of a B-Spline path must be greater than zero.");
|
||||
|
||||
return new PathType { Type = SplineType.BSpline, Degree = degree };
|
||||
}
|
||||
|
||||
public bool Equals(PathType other)
|
||||
=> Type == other.Type && Degree == other.Degree;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="11.5.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2023.1113.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.1023.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2023.1110.0" />
|
||||
<PackageReference Include="Sentry" Version="3.40.0" />
|
||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||
<PackageReference Include="SharpCompress" Version="0.33.0" />
|
||||
|
|
Loading…
Reference in New Issue