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

Cleanups + add auto to TestCaseHitCircle

This commit is contained in:
smoogipoo 2017-12-27 19:47:55 +09:00
parent 4d5216da00
commit fdafc2107e

View File

@ -5,6 +5,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Tests.Visual;
@ -17,33 +18,49 @@ namespace osu.Game.Rulesets.Osu.Tests
private readonly Container content;
protected override Container<Drawable> Content => content;
private bool auto;
private int depthIndex;
public TestCaseHitCircle()
{
base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 }));
AddStep("Single", addHitCircle);
AddStep("Single", () => addSingle());
AddStep("Stream", addStream);
AddToggleStep("Auto", v => auto = v);
}
private void addHitCircle()
private void addSingle(double timeOffset = 0, Vector2? positionOffset = null)
{
var circle = new HitCircle { StartTime = Time.Current + 1000 };
positionOffset = positionOffset ?? Vector2.Zero;
var circle = new HitCircle
{
StartTime = Time.Current + 1000 + timeOffset,
Position = positionOffset.Value
};
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
Add(new DrawableHitCircle(circle) { Anchor = Anchor.Centre });
var drawable = new DrawableHitCircle(circle)
{
Anchor = Anchor.Centre,
Depth = depthIndex++
};
if (auto)
drawable.State.Value = ArmedState.Hit;
Add(drawable);
}
private void addStream()
{
Vector2 pos = Vector2.Zero;
for (int i = 1000; i <= 2000; i += 100)
for (int i = 0; i <= 1000; i += 100)
{
var circle = new HitCircle { StartTime = Time.Current + i, Position = pos };
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
Add(new DrawableHitCircle(circle) { Anchor = Anchor.Centre, Depth = i});
addSingle(i, pos);
pos += new Vector2(10);
}
}