mirror of
https://github.com/ppy/osu.git
synced 2025-01-16 00:13:12 +08:00
Showcase both horizontal and vertical styles in TestCaseScrollingPlayfield.
This commit is contained in:
parent
346aebebc0
commit
ea073c02b3
@ -50,17 +50,27 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
|
|
||||||
WorkingBeatmap beatmap = new TestWorkingBeatmap(b);
|
WorkingBeatmap beatmap = new TestWorkingBeatmap(b);
|
||||||
|
|
||||||
TestHitRenderer hitRenderer;
|
TestHitRenderer horizontalHitRenderer;
|
||||||
Add(hitRenderer = new TestHitRenderer(beatmap, true));
|
Add(horizontalHitRenderer = new TestHitRenderer(Axes.X, beatmap, true));
|
||||||
|
|
||||||
AddStep("Reverse direction", () => hitRenderer.Playfield.Reversed.Toggle());
|
TestHitRenderer verticalHitRenderer;
|
||||||
|
Add(verticalHitRenderer = new TestHitRenderer(Axes.Y, beatmap, true));
|
||||||
|
|
||||||
|
AddStep("Reverse direction", () =>
|
||||||
|
{
|
||||||
|
horizontalHitRenderer.Playfield.Reversed.Toggle();
|
||||||
|
verticalHitRenderer.Playfield.Reversed.Toggle();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestHitRenderer : ScrollingHitRenderer<TestPlayfield, TestHitObject, TestJudgement>
|
private class TestHitRenderer : ScrollingHitRenderer<TestPlayfield, TestHitObject, TestJudgement>
|
||||||
{
|
{
|
||||||
public TestHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
private readonly Axes scrollingAxes;
|
||||||
|
|
||||||
|
public TestHitRenderer(Axes scrollingAxes, WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||||
: base(beatmap, isForCurrentRuleset)
|
: base(beatmap, isForCurrentRuleset)
|
||||||
{
|
{
|
||||||
|
this.scrollingAxes = scrollingAxes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public new TestPlayfield Playfield => base.Playfield;
|
public new TestPlayfield Playfield => base.Playfield;
|
||||||
@ -69,9 +79,9 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
|
|
||||||
protected override BeatmapConverter<TestHitObject> CreateBeatmapConverter() => new TestBeatmapConverter();
|
protected override BeatmapConverter<TestHitObject> CreateBeatmapConverter() => new TestBeatmapConverter();
|
||||||
|
|
||||||
protected override Playfield<TestHitObject, TestJudgement> CreatePlayfield() => new TestPlayfield();
|
protected override Playfield<TestHitObject, TestJudgement> CreatePlayfield() => new TestPlayfield(scrollingAxes);
|
||||||
|
|
||||||
protected override DrawableHitObject<TestHitObject, TestJudgement> GetVisualRepresentation(TestHitObject h) => new DrawableTestHitObject(h);
|
protected override DrawableHitObject<TestHitObject, TestJudgement> GetVisualRepresentation(TestHitObject h) => new DrawableTestHitObject(scrollingAxes, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestScoreProcessor : ScoreProcessor<TestHitObject, TestJudgement>
|
private class TestScoreProcessor : ScoreProcessor<TestHitObject, TestJudgement>
|
||||||
@ -93,10 +103,14 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
|
|
||||||
private class DrawableTestHitObject : DrawableScrollingHitObject<TestHitObject, TestJudgement>
|
private class DrawableTestHitObject : DrawableScrollingHitObject<TestHitObject, TestJudgement>
|
||||||
{
|
{
|
||||||
public DrawableTestHitObject(TestHitObject hitObject)
|
public DrawableTestHitObject(Axes scrollingAxes, TestHitObject hitObject)
|
||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
{
|
{
|
||||||
|
if (scrollingAxes == Axes.Y)
|
||||||
|
Anchor = Anchor.TopCentre;
|
||||||
|
else
|
||||||
Anchor = Anchor.CentreLeft;
|
Anchor = Anchor.CentreLeft;
|
||||||
|
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
@ -119,8 +133,8 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container<Drawable> content;
|
private readonly Container<Drawable> content;
|
||||||
|
|
||||||
public TestPlayfield()
|
public TestPlayfield(Axes scrollingAxes)
|
||||||
: base(Axes.X)
|
: base(scrollingAxes)
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user