1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00
osu-lazer/osu.Game.Rulesets.Taiko.Tests/Skinning/TestSceneDrawableBarLine.cs

101 lines
3.1 KiB
C#
Raw Normal View History

2020-04-23 13:01:50 +08:00
// 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.
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2020-04-23 13:01:50 +08:00
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.Taiko.UI;
2020-04-23 13:01:50 +08:00
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Taiko.Tests.Skinning
{
[TestFixture]
public class TestSceneDrawableBarLine : TaikoSkinnableTestScene
{
[Cached(typeof(IScrollingInfo))]
private ScrollingTestContainer.TestScrollingInfo info = new ScrollingTestContainer.TestScrollingInfo
{
Direction = { Value = ScrollingDirection.Left },
TimeRange = { Value = 5000 },
};
[BackgroundDependencyLoader]
private void load()
{
2020-04-27 07:36:48 +08:00
AddStep("Bar line", () => SetContents(() =>
2020-04-23 13:01:50 +08:00
{
ScrollingHitObjectContainer hoc;
var cont = new Container
2020-04-23 13:01:50 +08:00
{
RelativeSizeAxes = Axes.Both,
Height = 0.8f,
2020-04-23 13:01:50 +08:00
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new TaikoPlayfield(new ControlPointInfo()),
hoc = new ScrollingHitObjectContainer()
}
2020-04-23 13:01:50 +08:00
};
hoc.Add(new DrawableBarLine(createBarLineAtCurrentTime())
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
return cont;
2020-04-23 13:01:50 +08:00
}));
AddStep("Bar line (major)", () => SetContents(() =>
{
ScrollingHitObjectContainer hoc;
var cont = new Container
2020-04-23 13:01:50 +08:00
{
RelativeSizeAxes = Axes.Both,
Height = 0.8f,
2020-04-23 13:01:50 +08:00
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new TaikoPlayfield(new ControlPointInfo()),
hoc = new ScrollingHitObjectContainer()
}
2020-04-23 13:01:50 +08:00
};
hoc.Add(new DrawableBarLine(createBarLineAtCurrentTime(true))
2020-04-23 13:01:50 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
return cont;
2020-04-23 13:01:50 +08:00
}));
}
private BarLine createBarLineAtCurrentTime(bool major = false)
{
2020-04-27 07:36:36 +08:00
var barline = new BarLine
2020-04-23 13:01:50 +08:00
{
Major = major,
StartTime = Time.Current + 2000,
2020-04-23 13:01:50 +08:00
};
var cpi = new ControlPointInfo();
cpi.Add(0, new TimingControlPoint { BeatLength = 500 });
2020-04-27 07:36:36 +08:00
barline.ApplyDefaults(cpi, new BeatmapDifficulty());
2020-04-23 13:01:50 +08:00
2020-04-27 07:36:36 +08:00
return barline;
2020-04-23 13:01:50 +08:00
}
}
}