2018-06-07 11:24:33 +00:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
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;
|
|
|
|
|
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;
|
2018-06-07 11:49:06 +00:00
|
|
|
|
using osu.Game.Rulesets.Mania.UI.Components;
|
|
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
|
|
|
|
using OpenTK;
|
2018-06-07 11:24:33 +00:00
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Tests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class TestCaseColumn : ManiaInputTestCase
|
|
|
|
|
{
|
2018-06-07 11:49:06 +00:00
|
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
|
{
|
|
|
|
|
typeof(Column),
|
2018-06-07 12:13:57 +00:00
|
|
|
|
typeof(ColumnBackground),
|
2018-06-07 12:40:12 +00:00
|
|
|
|
typeof(ColumnKeyArea),
|
|
|
|
|
typeof(ColumnHitObjectArea)
|
2018-06-07 11:49:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
2018-06-08 06:16:14 +00:00
|
|
|
|
private readonly List<Column> columns = new List<Column>();
|
|
|
|
|
|
2018-06-07 11:24:33 +00:00
|
|
|
|
public TestCaseColumn()
|
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[]
|
|
|
|
|
{
|
|
|
|
|
createColumn(ScrollingDirection.Up, ManiaAction.Key1),
|
|
|
|
|
createColumn(ScrollingDirection.Down, ManiaAction.Key2)
|
|
|
|
|
}
|
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());
|
|
|
|
|
|
|
|
|
|
columns[i].Add(new DrawableNote(obj, columns[i].Action));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
|
|
columns[i].Add(new DrawableHoldNote(obj, columns[i].Action));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-08 11:13:24 +00:00
|
|
|
|
private Drawable createColumn(ScrollingDirection direction, ManiaAction action)
|
2018-06-08 06:16:14 +00:00
|
|
|
|
{
|
|
|
|
|
var column = new Column(direction)
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Height = 0.85f,
|
|
|
|
|
AccentColour = Color4.OrangeRed,
|
|
|
|
|
Action = action,
|
|
|
|
|
VisibleTimeRange = { Value = 2000 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
Child = column
|
|
|
|
|
};
|
2018-06-08 06:16:14 +00:00
|
|
|
|
}
|
2018-06-07 11:24:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|