2019-01-24 08:43:03 +00: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.
|
2018-06-07 11:24:33 +00:00
|
|
|
|
|
2018-06-07 11:49:06 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2018-06-07 11:24:33 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Allocation;
|
2018-06-07 11:49:06 +00:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2018-06-08 06:16:14 +00:00
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2022-10-05 10:14:31 +00:00
|
|
|
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
2018-06-08 06:16:14 +00:00
|
|
|
|
using osu.Game.Rulesets.Mania.Objects;
|
|
|
|
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
2018-06-07 11:24:33 +00:00
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2019-04-10 08:54:57 +00:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2018-06-07 11:49:06 +00:00
|
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
2018-11-06 06:46:36 +00:00
|
|
|
|
using osu.Game.Tests.Visual;
|
2018-11-20 07:51:59 +00:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-06-07 11:24:33 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Tests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
2019-05-14 19:37:25 +00:00
|
|
|
|
public partial class TestSceneColumn : ManiaInputTestScene
|
2018-06-07 11:24:33 +00:00
|
|
|
|
{
|
2019-04-10 08:54:57 +00:00
|
|
|
|
[Cached(typeof(IReadOnlyList<Mod>))]
|
|
|
|
|
private IReadOnlyList<Mod> mods { get; set; } = Array.Empty<Mod>();
|
|
|
|
|
|
2022-10-05 10:14:31 +00:00
|
|
|
|
[Cached]
|
|
|
|
|
private readonly StageDefinition stage = new StageDefinition(1);
|
|
|
|
|
|
2018-06-08 06:16:14 +00:00
|
|
|
|
private readonly List<Column> columns = new List<Column>();
|
|
|
|
|
|
2019-05-14 19:37:25 +00:00
|
|
|
|
public TestSceneColumn()
|
2018-06-07 11:49:06 +00:00
|
|
|
|
: base(2)
|
2018-06-07 11:24:33 +00:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
2018-06-07 11:49:06 +00:00
|
|
|
|
Child = new FillFlowContainer
|
2018-06-07 11:24:33 +00:00
|
|
|
|
{
|
2018-06-07 11:49:06 +00:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-06-07 11:24:33 +00:00
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2018-06-07 11:49:06 +00:00
|
|
|
|
Spacing = new Vector2(20, 0),
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
2018-11-12 09:24:18 +00:00
|
|
|
|
createColumn(ScrollingDirection.Up, ManiaAction.Key1, 0),
|
|
|
|
|
createColumn(ScrollingDirection.Down, ManiaAction.Key2, 1)
|
2018-06-07 11:49:06 +00:00
|
|
|
|
}
|
2018-06-07 11:24:33 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
2018-06-07 11:49:06 +00:00
|
|
|
|
|
2018-06-08 06:16:14 +00:00
|
|
|
|
protected override void LoadComplete()
|
2018-06-07 11:49:06 +00:00
|
|
|
|
{
|
2018-06-08 06:16:14 +00:00
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
AddStep("note", createNote);
|
2018-06-08 06:28:57 +00:00
|
|
|
|
AddStep("hold note", createHoldNote);
|
2018-06-08 06:16:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void createNote()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < columns.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var obj = new Note { Column = i, StartTime = Time.Current + 2000 };
|
|
|
|
|
obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
|
|
|
|
|
2018-07-02 03:31:41 +00:00
|
|
|
|
columns[i].Add(new DrawableNote(obj));
|
2018-06-08 06:16:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-08 06:28:57 +00:00
|
|
|
|
private void createHoldNote()
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < columns.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var obj = new HoldNote { Column = i, StartTime = Time.Current + 2000, Duration = 500 };
|
|
|
|
|
obj.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
|
|
|
|
|
2018-07-02 03:31:41 +00:00
|
|
|
|
columns[i].Add(new DrawableHoldNote(obj));
|
2018-06-08 06:28:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-12 09:24:18 +00:00
|
|
|
|
private Drawable createColumn(ScrollingDirection direction, ManiaAction action, int index)
|
2018-06-08 06:16:14 +00:00
|
|
|
|
{
|
2022-10-04 09:24:49 +00:00
|
|
|
|
var column = new Column(index, false)
|
2018-06-08 06:16:14 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Height = 0.85f,
|
2022-10-05 11:02:02 +00:00
|
|
|
|
AccentColour = { Value = Color4.OrangeRed },
|
2018-07-02 03:31:41 +00:00
|
|
|
|
Action = { Value = action },
|
2018-06-08 06:16:14 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
columns.Add(column);
|
2018-06-08 11:13:24 +00:00
|
|
|
|
|
2018-06-08 12:41:20 +00:00
|
|
|
|
return new ScrollingTestContainer(direction)
|
2018-06-08 11:13:24 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
2018-11-07 08:24:05 +00:00
|
|
|
|
TimeRange = 2000,
|
2018-06-08 11:13:24 +00:00
|
|
|
|
Child = column
|
|
|
|
|
};
|
2018-06-08 06:16:14 +00:00
|
|
|
|
}
|
2018-06-07 11:24:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|