2017-09-18 21:32:49 +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-11-23 15:00:33 +08:00
|
|
|
|
using System.ComponentModel;
|
2017-09-18 21:32:49 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Overlays.Mods;
|
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
|
using osu.Game.Screens.Play.HUD;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual
|
|
|
|
|
{
|
2017-11-23 15:00:33 +08:00
|
|
|
|
[Description("mod select and icon display")]
|
2017-09-18 21:32:49 +08:00
|
|
|
|
internal class TestCaseMods : OsuTestCase
|
|
|
|
|
{
|
|
|
|
|
private ModSelectOverlay modSelect;
|
|
|
|
|
private ModDisplay modDisplay;
|
|
|
|
|
|
|
|
|
|
private RulesetStore rulesets;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(RulesetStore rulesets)
|
|
|
|
|
{
|
|
|
|
|
this.rulesets = rulesets;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
Add(modSelect = new ModSelectOverlay
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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-10-16 16:02:31 +08:00
|
|
|
|
foreach (var ruleset in rulesets.AvailableRulesets)
|
2017-09-18 21:32:49 +08:00
|
|
|
|
AddStep(ruleset.CreateInstance().Description, () => modSelect.Ruleset.Value = ruleset);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|