1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-30 21:42:56 +08:00
osu-lazer/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs

113 lines
3.3 KiB
C#
Raw Normal View History

// 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 19:24:33 +08:00
using System;
using System.Collections.Generic;
2018-06-07 19:24:33 +08:00
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
2018-06-08 14:16:14 +08:00
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
2018-06-07 19:24:33 +08:00
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mania.UI.Components;
using osu.Game.Rulesets.UI.Scrolling;
2018-11-06 14:46:36 +08:00
using osu.Game.Tests.Visual;
2018-11-20 15:51:59 +08:00
using osuTK;
using osuTK.Graphics;
2018-06-07 19:24:33 +08:00
namespace osu.Game.Rulesets.Mania.Tests
{
[TestFixture]
public class TestCaseColumn : ManiaInputTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(Column),
typeof(ColumnBackground),
typeof(ColumnKeyArea),
typeof(ColumnHitObjectArea)
};
2018-06-08 14:16:14 +08:00
private readonly List<Column> columns = new List<Column>();
2018-06-07 19:24:33 +08:00
public TestCaseColumn()
: base(2)
2018-06-07 19:24:33 +08:00
{
}
[BackgroundDependencyLoader]
private void load()
{
Child = new FillFlowContainer
2018-06-07 19:24:33 +08:00
{
RelativeSizeAxes = Axes.Both,
2018-06-07 19:24:33 +08:00
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Spacing = new Vector2(20, 0),
Children = new[]
{
2018-11-12 17:24:18 +08:00
createColumn(ScrollingDirection.Up, ManiaAction.Key1, 0),
createColumn(ScrollingDirection.Down, ManiaAction.Key2, 1)
}
2018-06-07 19:24:33 +08:00
};
}
2018-06-08 14:16:14 +08:00
protected override void LoadComplete()
{
2018-06-08 14:16:14 +08:00
base.LoadComplete();
AddStep("note", createNote);
2018-06-08 14:28:57 +08:00
AddStep("hold note", createHoldNote);
2018-06-08 14:16:14 +08: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());
columns[i].Add(new DrawableNote(obj));
2018-06-08 14:16:14 +08:00
}
}
2018-06-08 14:28:57 +08: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());
columns[i].Add(new DrawableHoldNote(obj));
2018-06-08 14:28:57 +08:00
}
}
2018-11-12 17:24:18 +08:00
private Drawable createColumn(ScrollingDirection direction, ManiaAction action, int index)
2018-06-08 14:16:14 +08:00
{
2018-11-12 17:24:18 +08:00
var column = new Column(index)
2018-06-08 14:16:14 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Height = 0.85f,
AccentColour = Color4.OrangeRed,
Action = { Value = action },
2018-06-08 14:16:14 +08:00
};
columns.Add(column);
return new ScrollingTestContainer(direction)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
TimeRange = 2000,
Child = column
};
2018-06-08 14:16:14 +08:00
}
2018-06-07 19:24:33 +08:00
}
}