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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2020-04-23 13:01:50 +08:00
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
2020-04-23 13:39:34 +08:00
|
|
|
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;
|
2020-04-23 13:39:34 +08:00
|
|
|
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 partial class TestSceneDrawableBarLine : TaikoSkinnableTestScene
|
|
|
|
{
|
|
|
|
[Cached(typeof(IScrollingInfo))]
|
|
|
|
private ScrollingTestContainer.TestScrollingInfo info = new ScrollingTestContainer.TestScrollingInfo
|
|
|
|
{
|
|
|
|
Direction = { Value = ScrollingDirection.Left },
|
|
|
|
TimeRange = { Value = 5000 },
|
|
|
|
};
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2021-06-02 15:04:53 +08:00
|
|
|
AddStep("Bar line", () => SetContents(_ =>
|
2020-04-23 13:01:50 +08:00
|
|
|
{
|
2020-04-23 13:39:34 +08:00
|
|
|
ScrollingHitObjectContainer hoc;
|
|
|
|
|
|
|
|
var cont = new Container
|
2020-04-23 13:01:50 +08:00
|
|
|
{
|
2020-04-23 13:39:34 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-11-07 12:22:01 +08:00
|
|
|
Height = 0.2f,
|
2020-04-23 13:01:50 +08:00
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
2020-04-23 13:39:34 +08:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2021-08-25 14:24:13 +08:00
|
|
|
new TaikoPlayfield(),
|
2020-04-23 13:39:34 +08:00
|
|
|
hoc = new ScrollingHitObjectContainer()
|
|
|
|
}
|
2020-04-23 13:01:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
hoc.Add(new DrawableBarLine(createBarLineAtCurrentTime())
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
});
|
|
|
|
|
2020-04-23 13:39:34 +08:00
|
|
|
return cont;
|
2020-04-23 13:01:50 +08:00
|
|
|
}));
|
|
|
|
|
2021-06-02 15:04:53 +08:00
|
|
|
AddStep("Bar line (major)", () => SetContents(_ =>
|
2020-04-23 13:01:50 +08:00
|
|
|
{
|
2020-04-23 13:39:34 +08:00
|
|
|
ScrollingHitObjectContainer hoc;
|
|
|
|
|
|
|
|
var cont = new Container
|
2020-04-23 13:01:50 +08:00
|
|
|
{
|
2020-04-23 13:39:34 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-11-07 12:22:01 +08:00
|
|
|
Height = 0.2f,
|
2020-04-23 13:01:50 +08:00
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
2020-04-23 13:39:34 +08:00
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2021-08-25 14:24:13 +08:00
|
|
|
new TaikoPlayfield(),
|
2020-04-23 13:39:34 +08:00
|
|
|
hoc = new ScrollingHitObjectContainer()
|
|
|
|
}
|
2020-04-23 13:01:50 +08:00
|
|
|
};
|
|
|
|
|
2020-12-14 02:59:07 +08:00
|
|
|
hoc.Add(new DrawableBarLine(createBarLineAtCurrentTime(true))
|
2020-04-23 13:01:50 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
});
|
|
|
|
|
2020-04-23 13:39:34 +08:00
|
|
|
return cont;
|
2020-04-23 13:01:50 +08:00
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
private BarLine createBarLineAtCurrentTime(bool major = false)
|
|
|
|
{
|
2021-12-10 13:15:00 +08:00
|
|
|
var barLine = new BarLine
|
2020-04-23 13:01:50 +08:00
|
|
|
{
|
|
|
|
Major = major,
|
2022-11-07 12:22:01 +08:00
|
|
|
StartTime = Time.Current + 5000,
|
2020-04-23 13:01:50 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
var cpi = new ControlPointInfo();
|
|
|
|
cpi.Add(0, new TimingControlPoint { BeatLength = 500 });
|
|
|
|
|
2021-12-10 13:15:00 +08:00
|
|
|
barLine.ApplyDefaults(cpi, new BeatmapDifficulty());
|
2020-04-23 13:01:50 +08:00
|
|
|
|
2021-12-10 13:15:00 +08:00
|
|
|
return barLine;
|
2020-04-23 13:01:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|