2017-02-17 04:05:03 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-04-17 16:43:48 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2017-02-17 04:05:03 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Overlays.Mods;
|
2017-03-28 20:03:34 +08:00
|
|
|
|
using osu.Framework.Testing;
|
2017-04-17 16:43:48 +08:00
|
|
|
|
using osu.Game.Database;
|
2017-05-05 12:00:05 +08:00
|
|
|
|
using osu.Game.Screens.Play.HUD;
|
|
|
|
|
using OpenTK;
|
2017-02-17 04:05:03 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Desktop.VisualTests.Tests
|
|
|
|
|
{
|
2017-05-05 12:00:05 +08:00
|
|
|
|
internal class TestCaseMods : TestCase
|
2017-02-17 04:05:03 +08:00
|
|
|
|
{
|
2017-05-05 12:00:05 +08:00
|
|
|
|
public override string Description => @"Mod select overlay and in-game display";
|
|
|
|
|
|
|
|
|
|
private ModSelectOverlay modSelect;
|
|
|
|
|
private ModDisplay modDisplay;
|
2017-02-17 04:05:03 +08:00
|
|
|
|
|
2017-04-17 16:43:48 +08:00
|
|
|
|
private RulesetDatabase rulesets;
|
|
|
|
|
|
2017-05-05 12:00:05 +08:00
|
|
|
|
|
2017-04-17 16:43:48 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(RulesetDatabase rulesets)
|
|
|
|
|
{
|
|
|
|
|
this.rulesets = rulesets;
|
|
|
|
|
}
|
2017-02-17 04:05:03 +08:00
|
|
|
|
|
|
|
|
|
public override void Reset()
|
|
|
|
|
{
|
|
|
|
|
base.Reset();
|
|
|
|
|
|
2017-05-05 12:00:05 +08:00
|
|
|
|
Add(modSelect = new ModSelectOverlay
|
2017-02-17 04:05:03 +08:00
|
|
|
|
{
|
2017-02-18 19:28:22 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2017-02-17 04:05:03 +08:00
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
});
|
|
|
|
|
|
2017-05-05 12:00:05 +08:00
|
|
|
|
Add(modDisplay = new ModDisplay
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Position = new Vector2(0, 25),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
modDisplay.Current.BindTo(modSelect.SelectedMods);
|
|
|
|
|
|
|
|
|
|
AddStep("Toggle", modSelect.ToggleVisibility);
|
2017-04-15 04:22:41 +08:00
|
|
|
|
|
2017-04-17 16:43:48 +08:00
|
|
|
|
foreach (var ruleset in rulesets.AllRulesets)
|
2017-05-05 12:00:05 +08:00
|
|
|
|
AddStep(ruleset.CreateInstance().Description, () => modSelect.Ruleset.Value = ruleset);
|
2017-02-17 04:05:03 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|