// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Overlays.BeatmapSet; using System; using System.Collections.Generic; using osu.Framework.Graphics; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Taiko; using osu.Game.Rulesets.Catch; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Extensions.IEnumerableExtensions; namespace osu.Game.Tests.Visual.Online { public class TestSceneLeaderboardModSelector : OsuTestScene { public override IReadOnlyList RequiredTypes => new[] { typeof(LeaderboardModSelector), }; public TestSceneLeaderboardModSelector() { LeaderboardModSelector modSelector; FillFlowContainer selectedMods; Add(selectedMods = new FillFlowContainer { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, }); Add(modSelector = new LeaderboardModSelector { Anchor = Anchor.Centre, Origin = Anchor.Centre, }); modSelector.SelectedMods.ItemsAdded += mods => { mods.ForEach(mod => selectedMods.Add(new SpriteText { Text = mod.Acronym, })); }; modSelector.SelectedMods.ItemsRemoved += mods => { mods.ForEach(mod => { foreach (var selected in selectedMods) { if (selected.Text == mod.Acronym) { selectedMods.Remove(selected); break; } } }); }; AddStep("osu ruleset", () => modSelector.Ruleset = new OsuRuleset().RulesetInfo); AddStep("mania ruleset", () => modSelector.Ruleset = new ManiaRuleset().RulesetInfo); AddStep("taiko ruleset", () => modSelector.Ruleset = new TaikoRuleset().RulesetInfo); AddStep("catch ruleset", () => modSelector.Ruleset = new CatchRuleset().RulesetInfo); AddStep("Deselect all", () => modSelector.DeselectAll()); AddStep("null ruleset", () => modSelector.Ruleset = null); } } }