1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:57:36 +08:00

Rewrite SelectionLayer testcase to construct an entire HitObjectComposer

This commit is contained in:
smoogipoo 2018-02-20 13:50:55 +09:00
parent 4a5cd6520c
commit 2c37a7e19f

View File

@ -5,15 +5,13 @@ using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using OpenTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Edit.Layers.Selection;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Tests.Visual
{
@ -27,44 +25,31 @@ namespace osu.Game.Tests.Visual
};
[BackgroundDependencyLoader]
private void load()
private void load(OsuGameBase osuGame)
{
var playfield = new OsuEditPlayfield();
Children = new Drawable[]
osuGame.Beatmap.Value = new TestWorkingBeatmap(new Beatmap
{
new Container
HitObjects = new List<HitObject>
{
RelativeSizeAxes = Axes.Both,
Clock = new FramedClock(new StopwatchClock()),
Child = playfield
new HitCircle { Position = new Vector2(256, 192), Scale = 0.5f },
new HitCircle { Position = new Vector2(344, 148), Scale = 0.5f },
new Slider
{
ControlPoints = new List<Vector2>
{
new Vector2(128, 256),
new Vector2(344, 256),
},
Distance = 400,
Position = new Vector2(128, 256),
Velocity = 1,
TickDistance = 100,
Scale = 0.5f,
}
},
new SelectionLayer(playfield)
};
});
var hitCircle1 = new HitCircle { Position = new Vector2(256, 192), Scale = 0.5f };
var hitCircle2 = new HitCircle { Position = new Vector2(344, 148), Scale = 0.5f };
var slider = new Slider
{
ControlPoints = new List<Vector2>
{
new Vector2(128, 256),
new Vector2(344, 256),
},
Distance = 400,
Position = new Vector2(128, 256),
Velocity = 1,
TickDistance = 100,
Scale = 0.5f,
};
hitCircle1.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
hitCircle2.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
slider.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
playfield.Add(new DrawableHitCircle(hitCircle1));
playfield.Add(new DrawableHitCircle(hitCircle2));
playfield.Add(new DrawableSlider(slider));
Child = new OsuHitObjectComposer(new OsuRuleset());
}
}
}