mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Update with framework-side bindable list changes
This commit is contained in:
@ -4,6 +4,8 @@
|
||||
using osu.Game.Overlays.BeatmapSet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Mania;
|
||||
@ -15,6 +17,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
@ -44,27 +47,31 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Ruleset = { BindTarget = ruleset }
|
||||
});
|
||||
|
||||
modSelector.SelectedMods.ItemsAdded += mods =>
|
||||
modSelector.SelectedMods.CollectionChanged += (_, args) =>
|
||||
{
|
||||
mods.ForEach(mod => selectedMods.Add(new OsuSpriteText
|
||||
switch (args.Action)
|
||||
{
|
||||
Text = mod.Acronym,
|
||||
}));
|
||||
};
|
||||
|
||||
modSelector.SelectedMods.ItemsRemoved += mods =>
|
||||
{
|
||||
mods.ForEach(mod =>
|
||||
{
|
||||
foreach (var selected in selectedMods)
|
||||
{
|
||||
if (selected.Text == mod.Acronym)
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
args.NewItems.Cast<Mod>().ForEach(mod => selectedMods.Add(new OsuSpriteText
|
||||
{
|
||||
selectedMods.Remove(selected);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
Text = mod.Acronym,
|
||||
}));
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
args.OldItems.Cast<Mod>().ForEach(mod =>
|
||||
{
|
||||
foreach (var selected in selectedMods)
|
||||
{
|
||||
if (selected.Text == mod.Acronym)
|
||||
{
|
||||
selectedMods.Remove(selected);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
AddStep("osu ruleset", () => ruleset.Value = new OsuRuleset().RulesetInfo);
|
||||
|
Reference in New Issue
Block a user