mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
Fix code style/quality issues
This commit is contained in:
parent
8ad8764947
commit
fa976a5aa0
@ -140,7 +140,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor
|
|||||||
|
|
||||||
AddStep("update hit object path", () =>
|
AddStep("update hit object path", () =>
|
||||||
{
|
{
|
||||||
hitObject.Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
hitObject.Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||||
{
|
{
|
||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
new Vector2(100, 100),
|
new Vector2(100, 100),
|
||||||
@ -190,14 +190,14 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestVertexResampling()
|
public void TestVertexResampling()
|
||||||
{
|
{
|
||||||
addBlueprintStep(100, 100, new SliderPath(PathType.PERFECTCURVE, new[]
|
addBlueprintStep(100, 100, new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||||
{
|
{
|
||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
new Vector2(100, 100),
|
new Vector2(100, 100),
|
||||||
new Vector2(50, 200),
|
new Vector2(50, 200),
|
||||||
}), 0.5);
|
}), 0.5);
|
||||||
AddAssert("1 vertex per 1 nested HO", () => getVertices().Count == hitObject.NestedHitObjects.Count);
|
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);
|
addAddVertexSteps(150, 150);
|
||||||
AddAssert("slider path change to linear", () => hitObject.Path.ControlPoints[0].Type == PathType.LINEAR);
|
AddAssert("slider path change to linear", () => hitObject.Path.ControlPoints[0].Type == PathType.LINEAR);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
} while (rng.Next(2) != 0);
|
} while (rng.Next(2) != 0);
|
||||||
|
|
||||||
int length = sliderPath.ControlPoints.Count - start + 1;
|
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);
|
} while (rng.Next(3) != 0);
|
||||||
|
|
||||||
if (rng.Next(5) == 0)
|
if (rng.Next(5) == 0)
|
||||||
|
@ -214,7 +214,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor.Checks
|
|||||||
Path = new SliderPath(new[]
|
Path = new SliderPath(new[]
|
||||||
{
|
{
|
||||||
// Circular arc shoots over the top of the screen.
|
// 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)),
|
||||||
new PathControlPoint(new Vector2(100, -200))
|
new PathControlPoint(new Vector2(100, -200))
|
||||||
}),
|
}),
|
||||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
|
|
||||||
PathControlPoint[] points =
|
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, 0)),
|
||||||
new PathControlPoint(new Vector2(100, 20))
|
new PathControlPoint(new Vector2(100, 20))
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
addContextMenuItemStep("Perfect curve");
|
addContextMenuItemStep("Perfect curve");
|
||||||
|
|
||||||
assertControlPointPathType(0, PathType.BEZIER);
|
assertControlPointPathType(0, PathType.BEZIER);
|
||||||
assertControlPointPathType(1, PathType.PERFECTCURVE);
|
assertControlPointPathType(1, PathType.PERFECT_CURVE);
|
||||||
assertControlPointPathType(3, PathType.BEZIER);
|
assertControlPointPathType(3, PathType.BEZIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
addContextMenuItemStep("Perfect curve");
|
addContextMenuItemStep("Perfect curve");
|
||||||
|
|
||||||
assertControlPointPathType(0, PathType.BEZIER);
|
assertControlPointPathType(0, PathType.BEZIER);
|
||||||
assertControlPointPathType(2, PathType.PERFECTCURVE);
|
assertControlPointPathType(2, PathType.PERFECT_CURVE);
|
||||||
assertControlPointPathType(4, null);
|
assertControlPointPathType(4, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
addContextMenuItemStep("Perfect curve");
|
addContextMenuItemStep("Perfect curve");
|
||||||
|
|
||||||
assertControlPointPathType(0, PathType.LINEAR);
|
assertControlPointPathType(0, PathType.LINEAR);
|
||||||
assertControlPointPathType(1, PathType.PERFECTCURVE);
|
assertControlPointPathType(1, PathType.PERFECT_CURVE);
|
||||||
assertControlPointPathType(3, PathType.LINEAR);
|
assertControlPointPathType(3, PathType.LINEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
createVisualiser(true);
|
createVisualiser(true);
|
||||||
|
|
||||||
addControlPointStep(new Vector2(200), PathType.BEZIER);
|
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(500, 300));
|
||||||
addControlPointStep(new Vector2(700, 200), PathType.BEZIER);
|
addControlPointStep(new Vector2(700, 200), PathType.BEZIER);
|
||||||
addControlPointStep(new Vector2(500, 100));
|
addControlPointStep(new Vector2(500, 100));
|
||||||
|
@ -38,9 +38,9 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
Position = new Vector2(256, 192),
|
Position = new Vector2(256, 192),
|
||||||
Path = new SliderPath(new[]
|
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(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, 0)),
|
||||||
new PathControlPoint(new Vector2(400, 150))
|
new PathControlPoint(new Vector2(400, 150))
|
||||||
})
|
})
|
||||||
@ -182,7 +182,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||||
|
|
||||||
assertControlPointPosition(1, new Vector2(150, 50));
|
assertControlPointPosition(1, new Vector2(150, 50));
|
||||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -210,7 +210,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
AddAssert("three control point pieces selected", () => this.ChildrenOfType<PathControlPointPiece<Slider>>().Count(piece => piece.IsSelected.Value) == 3);
|
AddAssert("three control point pieces selected", () => this.ChildrenOfType<PathControlPointPiece<Slider>>().Count(piece => piece.IsSelected.Value) == 3);
|
||||||
|
|
||||||
assertControlPointPosition(2, new Vector2(450, 50));
|
assertControlPointPosition(2, new Vector2(450, 50));
|
||||||
assertControlPointType(2, PathType.PERFECTCURVE);
|
assertControlPointType(2, PathType.PERFECT_CURVE);
|
||||||
|
|
||||||
assertControlPointPosition(3, new Vector2(550, 50));
|
assertControlPointPosition(3, new Vector2(550, 50));
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
AddAssert("slider moved", () => Precision.AlmostEquals(slider.Position, new Vector2(256, 192) + new Vector2(150, 50)));
|
AddAssert("slider moved", () => Precision.AlmostEquals(slider.Position, new Vector2(256, 192) + new Vector2(150, 50)));
|
||||||
|
|
||||||
assertControlPointPosition(0, Vector2.Zero);
|
assertControlPointPosition(0, Vector2.Zero);
|
||||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||||
|
|
||||||
assertControlPointPosition(1, new Vector2(0, 100));
|
assertControlPointPosition(1, new Vector2(0, 100));
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||||
|
|
||||||
assertControlPointPosition(1, new Vector2(150, 50));
|
assertControlPointPosition(1, new Vector2(150, 50));
|
||||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -304,7 +304,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||||
|
|
||||||
assertControlPointPosition(4, new Vector2(150, 150));
|
assertControlPointPosition(4, new Vector2(150, 150));
|
||||||
assertControlPointType(2, PathType.PERFECTCURVE);
|
assertControlPointType(2, PathType.PERFECT_CURVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -312,12 +312,12 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
{
|
{
|
||||||
AddStep("change type to bezier", () => slider.Path.ControlPoints[2].Type = PathType.BEZIER);
|
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("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);
|
moveMouseToControlPoint(4);
|
||||||
AddStep("hold", () => InputManager.PressButton(MouseButton.Left));
|
AddStep("hold", () => InputManager.PressButton(MouseButton.Left));
|
||||||
|
|
||||||
assertControlPointType(3, PathType.PERFECTCURVE);
|
assertControlPointType(3, PathType.PERFECT_CURVE);
|
||||||
|
|
||||||
addMovementStep(new Vector2(350, 0.01f));
|
addMovementStep(new Vector2(350, 0.01f));
|
||||||
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
AddStep("release", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||||
|
@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
|
|
||||||
PathControlPoint[] points =
|
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, 0)),
|
||||||
new PathControlPoint(new Vector2(0, 10))
|
new PathControlPoint(new Vector2(0, 10))
|
||||||
};
|
};
|
||||||
|
@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
assertPlaced(true);
|
assertPlaced(true);
|
||||||
assertControlPointCount(3);
|
assertControlPointCount(3);
|
||||||
assertControlPointPosition(1, new Vector2(100, 0));
|
assertControlPointPosition(1, new Vector2(100, 0));
|
||||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -172,7 +172,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
|
|
||||||
assertPlaced(true);
|
assertPlaced(true);
|
||||||
assertControlPointCount(3);
|
assertControlPointCount(3);
|
||||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -241,7 +241,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
assertControlPointPosition(1, new Vector2(100, 0));
|
assertControlPointPosition(1, new Vector2(100, 0));
|
||||||
assertControlPointPosition(2, new Vector2(100));
|
assertControlPointPosition(2, new Vector2(100));
|
||||||
assertControlPointType(0, PathType.LINEAR);
|
assertControlPointType(0, PathType.LINEAR);
|
||||||
assertControlPointType(1, PathType.PERFECTCURVE);
|
assertControlPointType(1, PathType.PERFECT_CURVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -269,8 +269,8 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
assertControlPointPosition(2, new Vector2(100));
|
assertControlPointPosition(2, new Vector2(100));
|
||||||
assertControlPointPosition(3, new Vector2(200, 100));
|
assertControlPointPosition(3, new Vector2(200, 100));
|
||||||
assertControlPointPosition(4, new Vector2(200));
|
assertControlPointPosition(4, new Vector2(200));
|
||||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||||
assertControlPointType(2, PathType.PERFECTCURVE);
|
assertControlPointType(2, PathType.PERFECT_CURVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -326,7 +326,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
|
|
||||||
assertPlaced(true);
|
assertPlaced(true);
|
||||||
assertControlPointCount(3);
|
assertControlPointCount(3);
|
||||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -347,7 +347,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
|
|
||||||
assertPlaced(true);
|
assertPlaced(true);
|
||||||
assertControlPointCount(3);
|
assertControlPointCount(3);
|
||||||
assertControlPointType(0, PathType.PERFECTCURVE);
|
assertControlPointType(0, PathType.PERFECT_CURVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -385,7 +385,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
|
|
||||||
assertPlaced(true);
|
assertPlaced(true);
|
||||||
assertControlPointCount(3);
|
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)));
|
private void addMovementStep(Vector2 position) => AddStep($"move mouse to {position}", () => InputManager.MoveMouseTo(InputManager.ToScreenSpace(position)));
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
private readonly PathControlPoint[][] paths =
|
private readonly PathControlPoint[][] paths =
|
||||||
{
|
{
|
||||||
createPathSegment(
|
createPathSegment(
|
||||||
PathType.PERFECTCURVE,
|
PathType.PERFECT_CURVE,
|
||||||
new Vector2(200, -50),
|
new Vector2(200, -50),
|
||||||
new Vector2(250, 0)
|
new Vector2(250, 0)
|
||||||
),
|
),
|
||||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
{
|
{
|
||||||
ControlPoints =
|
ControlPoints =
|
||||||
{
|
{
|
||||||
new PathControlPoint(Vector2.Zero, PathType.PERFECTCURVE),
|
new PathControlPoint(Vector2.Zero, PathType.PERFECT_CURVE),
|
||||||
new PathControlPoint(new Vector2(136, 205)),
|
new PathControlPoint(new Vector2(136, 205)),
|
||||||
new PathControlPoint(new Vector2(-4, 226))
|
new PathControlPoint(new Vector2(-4, 226))
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
{
|
{
|
||||||
OsuSelectionHandler selectionHandler;
|
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("select slider", () => EditorBeatmap.SelectedHitObjects.Add(slider));
|
||||||
AddStep("rotate 90 degrees ccw", () =>
|
AddStep("rotate 90 degrees ccw", () =>
|
||||||
@ -190,7 +190,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
selectionHandler.HandleRotation(-90);
|
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]
|
[Test]
|
||||||
@ -223,7 +223,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
{
|
{
|
||||||
OsuSelectionHandler selectionHandler;
|
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("select slider", () => EditorBeatmap.SelectedHitObjects.Add(slider));
|
||||||
AddStep("flip slider horizontally", () =>
|
AddStep("flip slider horizontally", () =>
|
||||||
@ -232,7 +232,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
selectionHandler.OnPressed(new KeyBindingPressEvent<GlobalAction>(InputManager.CurrentState, GlobalAction.EditorFlipVertically));
|
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]
|
[Test]
|
||||||
|
@ -45,9 +45,9 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
Position = new Vector2(0, 50),
|
Position = new Vector2(0, 50),
|
||||||
Path = new SliderPath(new[]
|
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(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, 0)),
|
||||||
new PathControlPoint(new Vector2(400, 150))
|
new PathControlPoint(new Vector2(400, 150))
|
||||||
})
|
})
|
||||||
@ -73,20 +73,20 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
|
|
||||||
AddAssert("slider split", () => slider is not null && EditorBeatmap.HitObjects.Count == 2 &&
|
AddAssert("slider split", () => slider is not null && EditorBeatmap.HitObjects.Count == 2 &&
|
||||||
sliderCreatedFor((Slider)EditorBeatmap.HitObjects[0], 0, EditorBeatmap.HitObjects[1].StartTime - split_gap,
|
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(150, 200), null),
|
||||||
(new Vector2(300, 50), null)
|
(new Vector2(300, 50), null)
|
||||||
) && sliderCreatedFor((Slider)EditorBeatmap.HitObjects[1], slider.StartTime, endTime + split_gap,
|
) && 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, 50), null),
|
||||||
(new Vector2(400, 200), null)
|
(new Vector2(400, 200), null)
|
||||||
));
|
));
|
||||||
|
|
||||||
AddStep("undo", () => Editor.Undo());
|
AddStep("undo", () => Editor.Undo());
|
||||||
AddAssert("original slider restored", () => EditorBeatmap.HitObjects.Count == 1 && sliderCreatedFor((Slider)EditorBeatmap.HitObjects[0], 0, endTime,
|
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(150, 200), null),
|
||||||
(new Vector2(300, 50), PathType.PERFECTCURVE),
|
(new Vector2(300, 50), PathType.PERFECT_CURVE),
|
||||||
(new Vector2(400, 50), null),
|
(new Vector2(400, 50), null),
|
||||||
(new Vector2(400, 200), null)
|
(new Vector2(400, 200), null)
|
||||||
));
|
));
|
||||||
@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
Position = new Vector2(0, 50),
|
Position = new Vector2(0, 50),
|
||||||
Path = new SliderPath(new[]
|
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(150, 150)),
|
||||||
new PathControlPoint(new Vector2(300, 0), PathType.BEZIER),
|
new PathControlPoint(new Vector2(300, 0), PathType.BEZIER),
|
||||||
new PathControlPoint(new Vector2(400, 0)),
|
new PathControlPoint(new Vector2(400, 0)),
|
||||||
@ -139,7 +139,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
|
|
||||||
AddAssert("slider split", () => slider is not null && EditorBeatmap.HitObjects.Count == 3 &&
|
AddAssert("slider split", () => slider is not null && EditorBeatmap.HitObjects.Count == 3 &&
|
||||||
sliderCreatedFor((Slider)EditorBeatmap.HitObjects[0], 0, EditorBeatmap.HitObjects[1].StartTime - split_gap,
|
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(150, 200), null),
|
||||||
(new Vector2(300, 50), null)
|
(new Vector2(300, 50), null)
|
||||||
) && sliderCreatedFor((Slider)EditorBeatmap.HitObjects[1], EditorBeatmap.HitObjects[0].GetEndTime() + split_gap, slider.StartTime - split_gap,
|
) && sliderCreatedFor((Slider)EditorBeatmap.HitObjects[1], EditorBeatmap.HitObjects[0].GetEndTime() + split_gap, slider.StartTime - split_gap,
|
||||||
@ -165,9 +165,9 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
|||||||
Position = new Vector2(0, 50),
|
Position = new Vector2(0, 50),
|
||||||
Path = new SliderPath(new[]
|
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(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, 0)),
|
||||||
new PathControlPoint(new Vector2(400, 150))
|
new PathControlPoint(new Vector2(400, 150))
|
||||||
})
|
})
|
||||||
|
@ -219,7 +219,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
StartTime = Time.Current + time_offset,
|
StartTime = Time.Current + time_offset,
|
||||||
Position = new Vector2(239, 176),
|
Position = new Vector2(239, 176),
|
||||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||||
{
|
{
|
||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
new Vector2(154, 28),
|
new Vector2(154, 28),
|
||||||
@ -255,7 +255,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
SliderVelocityMultiplier = speedMultiplier,
|
SliderVelocityMultiplier = speedMultiplier,
|
||||||
StartTime = Time.Current + time_offset,
|
StartTime = Time.Current + time_offset,
|
||||||
Position = new Vector2(0, -(distance / 2)),
|
Position = new Vector2(0, -(distance / 2)),
|
||||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||||
{
|
{
|
||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
new Vector2(0, distance),
|
new Vector2(0, distance),
|
||||||
@ -273,7 +273,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
StartTime = Time.Current + time_offset,
|
StartTime = Time.Current + time_offset,
|
||||||
Position = new Vector2(-max_length / 2, 0),
|
Position = new Vector2(-max_length / 2, 0),
|
||||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||||
{
|
{
|
||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
new Vector2(max_length / 2, max_length / 2),
|
new Vector2(max_length / 2, max_length / 2),
|
||||||
|
@ -478,7 +478,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
StartTime = time_slider_start,
|
StartTime = time_slider_start,
|
||||||
Position = new Vector2(0, 0),
|
Position = new Vector2(0, 0),
|
||||||
SliderVelocityMultiplier = 0.1f,
|
SliderVelocityMultiplier = 0.1f,
|
||||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||||
{
|
{
|
||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
new Vector2(slider_path_length, 0),
|
new Vector2(slider_path_length, 0),
|
||||||
|
@ -217,7 +217,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
StartTime = 3000,
|
StartTime = 3000,
|
||||||
Position = new Vector2(100, 100),
|
Position = new Vector2(100, 100),
|
||||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||||
{
|
{
|
||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
new Vector2(300, 200)
|
new Vector2(300, 200)
|
||||||
@ -227,7 +227,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
StartTime = 13000,
|
StartTime = 13000,
|
||||||
Position = new Vector2(100, 100),
|
Position = new Vector2(100, 100),
|
||||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||||
{
|
{
|
||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
new Vector2(300, 200)
|
new Vector2(300, 200)
|
||||||
@ -238,7 +238,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
StartTime = 23000,
|
StartTime = 23000,
|
||||||
Position = new Vector2(100, 100),
|
Position = new Vector2(100, 100),
|
||||||
Path = new SliderPath(PathType.PERFECTCURVE, new[]
|
Path = new SliderPath(PathType.PERFECT_CURVE, new[]
|
||||||
{
|
{
|
||||||
Vector2.Zero,
|
Vector2.Zero,
|
||||||
new Vector2(300, 200)
|
new Vector2(300, 200)
|
||||||
|
@ -221,7 +221,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void updatePathType()
|
private void updatePathType()
|
||||||
{
|
{
|
||||||
if (ControlPoint.Type != PathType.PERFECTCURVE)
|
if (ControlPoint.Type != PathType.PERFECT_CURVE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (PointsInSegment.Count > 3)
|
if (PointsInSegment.Count > 3)
|
||||||
@ -259,19 +259,19 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
if (ControlPoint.Type is not PathType pathType)
|
if (ControlPoint.Type is not PathType pathType)
|
||||||
return colours.Yellow;
|
return colours.Yellow;
|
||||||
|
|
||||||
switch (pathType)
|
switch (pathType.Type)
|
||||||
{
|
{
|
||||||
case { Type: SplineType.Catmull }:
|
case SplineType.Catmull:
|
||||||
return colours.SeaFoam;
|
return colours.SeaFoam;
|
||||||
|
|
||||||
case { Type: SplineType.BSpline, Degree: null }:
|
case SplineType.BSpline:
|
||||||
|
if (!pathType.Degree.HasValue)
|
||||||
return colours.PinkLighter;
|
return colours.PinkLighter;
|
||||||
|
|
||||||
case { Type: SplineType.BSpline, Degree: >= 1 }:
|
|
||||||
int idx = Math.Clamp(pathType.Degree.Value, 0, 3);
|
int idx = Math.Clamp(pathType.Degree.Value, 0, 3);
|
||||||
return new[] { colours.PinkDarker, colours.PinkDark, colours.Pink, colours.PinkLight }[idx];
|
return new[] { colours.PinkDarker, colours.PinkDark, colours.Pink, colours.PinkLight }[idx];
|
||||||
|
|
||||||
case { Type: SplineType.PerfectCurve }:
|
case SplineType.PerfectCurve:
|
||||||
return colours.PurpleDark;
|
return colours.PurpleDark;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -368,7 +368,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
|||||||
|
|
||||||
// todo: hide/disable items which aren't valid for selected points
|
// todo: hide/disable items which aren't valid for selected points
|
||||||
curveTypeItems.Add(createMenuItemForPathType(PathType.LINEAR));
|
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.BEZIER));
|
||||||
curveTypeItems.Add(createMenuItemForPathType(PathType.BSpline(3)));
|
curveTypeItems.Add(createMenuItemForPathType(PathType.BSpline(3)));
|
||||||
curveTypeItems.Add(createMenuItemForPathType(PathType.CATMULL));
|
curveTypeItems.Add(createMenuItemForPathType(PathType.CATMULL));
|
||||||
|
@ -251,7 +251,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
segmentStart.Type = PathType.PERFECTCURVE;
|
segmentStart.Type = PathType.PERFECT_CURVE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -10,7 +10,7 @@ using osu.Game.Rulesets.Edit;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit
|
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)
|
public BindableFloat Tolerance { get; } = new BindableFloat(0.1f)
|
||||||
{
|
{
|
||||||
@ -27,12 +27,14 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
|
|
||||||
private ExpandableSlider<int> toleranceSlider = null!;
|
private ExpandableSlider<int> toleranceSlider = null!;
|
||||||
|
|
||||||
public OsuSliderDrawingSettingsProvider()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
sliderTolerance.BindValueChanged(v =>
|
sliderTolerance.BindValueChanged(v =>
|
||||||
{
|
{
|
||||||
float newValue = v.NewValue / 100f;
|
float newValue = v.NewValue / 100f;
|
||||||
if (!Precision.AlmostEquals(newValue, Tolerance.Value, 1e-7f))
|
if (!Precision.AlmostEquals(newValue, Tolerance.Value))
|
||||||
Tolerance.Value = newValue;
|
Tolerance.Value = newValue;
|
||||||
});
|
});
|
||||||
Tolerance.BindValueChanged(v =>
|
Tolerance.BindValueChanged(v =>
|
||||||
|
@ -808,7 +808,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
var first = ((IHasPath)decoded.HitObjects[0]).Path;
|
var first = ((IHasPath)decoded.HitObjects[0]).Path;
|
||||||
|
|
||||||
Assert.That(first.ControlPoints[0].Position, Is.EqualTo(Vector2.Zero));
|
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].Position, Is.EqualTo(new Vector2(161, -244)));
|
||||||
Assert.That(first.ControlPoints[1].Type, Is.EqualTo(null));
|
Assert.That(first.ControlPoints[1].Type, Is.EqualTo(null));
|
||||||
|
|
||||||
@ -827,7 +827,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
var second = ((IHasPath)decoded.HitObjects[1]).Path;
|
var second = ((IHasPath)decoded.HitObjects[1]).Path;
|
||||||
|
|
||||||
Assert.That(second.ControlPoints[0].Position, Is.EqualTo(Vector2.Zero));
|
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].Position, Is.EqualTo(new Vector2(161, -244)));
|
||||||
Assert.That(second.ControlPoints[1].Type, Is.EqualTo(null));
|
Assert.That(second.ControlPoints[1].Type, Is.EqualTo(null));
|
||||||
Assert.That(second.ControlPoints[2].Position, Is.EqualTo(new Vector2(376, -3)));
|
Assert.That(second.ControlPoints[2].Position, Is.EqualTo(new Vector2(376, -3)));
|
||||||
@ -904,12 +904,12 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
var seventh = ((IHasPath)decoded.HitObjects[6]).Path;
|
var seventh = ((IHasPath)decoded.HitObjects[6]).Path;
|
||||||
|
|
||||||
Assert.That(seventh.ControlPoints[0].Position, Is.EqualTo(Vector2.Zero));
|
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].Position, Is.EqualTo(new Vector2(75, 145)));
|
||||||
Assert.That(seventh.ControlPoints[1].Type == null);
|
Assert.That(seventh.ControlPoints[1].Type == null);
|
||||||
Assert.That(seventh.ControlPoints[2].Position, Is.EqualTo(new Vector2(170, 75)));
|
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].Position, Is.EqualTo(new Vector2(300, 145)));
|
||||||
Assert.That(seventh.ControlPoints[3].Type == null);
|
Assert.That(seventh.ControlPoints[3].Type == null);
|
||||||
Assert.That(seventh.ControlPoints[4].Position, Is.EqualTo(new Vector2(410, 20)));
|
Assert.That(seventh.ControlPoints[4].Position, Is.EqualTo(new Vector2(410, 20)));
|
||||||
|
@ -143,7 +143,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
path.ControlPoints.AddRange(createSegment(PathType.LINEAR, Vector2.Zero, new Vector2(100, 0)));
|
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.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 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
AddStep("create path", () =>
|
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 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
switch (points)
|
switch (points)
|
||||||
{
|
{
|
||||||
case 2:
|
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;
|
break;
|
||||||
|
|
||||||
case 4:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -149,11 +149,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
switch (points)
|
switch (points)
|
||||||
{
|
{
|
||||||
case 2:
|
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;
|
break;
|
||||||
|
|
||||||
case 4:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -437,7 +437,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
// Explicit segments have a new format in which the type is injected into the middle of the control point string.
|
// 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.
|
// 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
|
// 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.
|
// 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.
|
// 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 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
if (needsExplicitSegment)
|
if (needsExplicitSegment)
|
||||||
{
|
{
|
||||||
switch (point.Type)
|
switch (point.Type?.Type)
|
||||||
{
|
{
|
||||||
case { Type: SplineType.BSpline, Degree: > 0 }:
|
case SplineType.BSpline:
|
||||||
writer.Write($"B{point.Type.Value.Degree}|");
|
writer.Write(point.Type.Value.Degree > 0 ? $"B{point.Type.Value.Degree}|" : "B|");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case { Type: SplineType.BSpline, Degree: <= 0 }:
|
case SplineType.Catmull:
|
||||||
writer.Write("B|");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case { Type: SplineType.Catmull }:
|
|
||||||
writer.Write("C|");
|
writer.Write("C|");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case { Type: SplineType.PerfectCurve }:
|
case SplineType.PerfectCurve:
|
||||||
writer.Write("P|");
|
writer.Write("P|");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case { Type: SplineType.Linear }:
|
case SplineType.Linear:
|
||||||
writer.Write("L|");
|
writer.Write("L|");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ using osu.Game.Screens.Edit.Components.TernaryButtons;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit
|
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;
|
private const float adjust_step = 0.1f;
|
||||||
|
|
||||||
|
10
osu.Game/Rulesets/Edit/IToolboxAttachment.cs
Normal file
10
osu.Game/Rulesets/Edit/IToolboxAttachment.cs
Normal file
@ -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 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
var segmentVertices = vertices.AsSpan().Slice(start, i - start + 1);
|
var segmentVertices = vertices.AsSpan().Slice(start, i - start + 1);
|
||||||
var segmentType = controlPoints[start].Type ?? PathType.LINEAR;
|
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))
|
foreach (var segment in ConvertCatmullToBezierAnchors(segmentVertices))
|
||||||
{
|
{
|
||||||
for (int j = 0; j < segment.Length - 1; j++)
|
for (int j = 0; j < segment.Length - 1; j++)
|
||||||
@ -139,7 +139,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case { Type: SplineType.Linear }:
|
case SplineType.Linear:
|
||||||
foreach (var segment in ConvertLinearToBezierAnchors(segmentVertices))
|
foreach (var segment in ConvertLinearToBezierAnchors(segmentVertices))
|
||||||
{
|
{
|
||||||
for (int j = 0; j < segment.Length - 1; j++)
|
for (int j = 0; j < segment.Length - 1; j++)
|
||||||
@ -150,7 +150,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case { Type: SplineType.PerfectCurve }:
|
case SplineType.PerfectCurve:
|
||||||
var circleResult = ConvertCircleToBezierAnchors(segmentVertices);
|
var circleResult = ConvertCircleToBezierAnchors(segmentVertices);
|
||||||
|
|
||||||
for (int j = 0; j < circleResult.Length - 1; j++)
|
for (int j = 0; j < circleResult.Length - 1; j++)
|
||||||
|
@ -224,19 +224,19 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 'C':
|
case 'C':
|
||||||
return new PathType(SplineType.Catmull);
|
return PathType.CATMULL;
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
if (input.Length > 1 && int.TryParse(input.Substring(1), out int degree) && degree > 0)
|
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);
|
return new PathType(SplineType.BSpline);
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
return new PathType(SplineType.Linear);
|
return PathType.LINEAR;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
return new PathType(SplineType.PerfectCurve);
|
return PathType.PERFECT_CURVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
readPoint(endPoint, offset, out vertices[^1]);
|
readPoint(endPoint, offset, out vertices[^1]);
|
||||||
|
|
||||||
// Edge-case rules (to match stable).
|
// Edge-case rules (to match stable).
|
||||||
if (type == PathType.PERFECTCURVE)
|
if (type == PathType.PERFECT_CURVE)
|
||||||
{
|
{
|
||||||
if (vertices.Length != 3)
|
if (vertices.Length != 3)
|
||||||
type = PathType.BEZIER;
|
type = PathType.BEZIER;
|
||||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
inheritedLinearPoints.ForEach(p => p.Type = null);
|
inheritedLinearPoints.ForEach(p => p.Type = null);
|
||||||
|
|
||||||
// Recalculate middle perfect curve control points at the end of the slider path.
|
// 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 lastSegmentStart = segmentEnds.Length > 1 ? segmentEnds[^2] : 0;
|
||||||
double lastSegmentEnd = segmentEnds[^1];
|
double lastSegmentEnd = segmentEnds[^1];
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// 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 System;
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Types
|
namespace osu.Game.Rulesets.Objects.Types
|
||||||
{
|
{
|
||||||
@ -14,12 +13,12 @@ namespace osu.Game.Rulesets.Objects.Types
|
|||||||
PerfectCurve
|
PerfectCurve
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly struct PathType
|
public readonly struct PathType : IEquatable<PathType>
|
||||||
{
|
{
|
||||||
public static readonly PathType CATMULL = new PathType(SplineType.Catmull);
|
public static readonly PathType CATMULL = new PathType(SplineType.Catmull);
|
||||||
public static readonly PathType BEZIER = new PathType(SplineType.BSpline);
|
public static readonly PathType BEZIER = new PathType(SplineType.BSpline);
|
||||||
public static readonly PathType LINEAR = new PathType(SplineType.Linear);
|
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>
|
/// <summary>
|
||||||
/// The type of the spline that should be used to interpret the control points of the path.
|
/// The type of the spline that should be used to interpret the control points of the path.
|
||||||
@ -52,8 +51,13 @@ namespace osu.Game.Rulesets.Objects.Types
|
|||||||
|
|
||||||
public static PathType BSpline(int degree)
|
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 };
|
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>
|
||||||
<PackageReference Include="Realm" Version="11.5.0" />
|
<PackageReference Include="Realm" Version="11.5.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2023.1113.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" />
|
<PackageReference Include="Sentry" Version="3.40.0" />
|
||||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||||
<PackageReference Include="SharpCompress" Version="0.33.0" />
|
<PackageReference Include="SharpCompress" Version="0.33.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user