mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Extract helper property for accessing all mods
This commit is contained in:
@ -65,6 +65,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
private readonly Bindable<Dictionary<ModType, IReadOnlyList<Mod>>> availableMods = new Bindable<Dictionary<ModType, IReadOnlyList<Mod>>>();
|
private readonly Bindable<Dictionary<ModType, IReadOnlyList<Mod>>> availableMods = new Bindable<Dictionary<ModType, IReadOnlyList<Mod>>>();
|
||||||
private readonly Dictionary<ModType, IReadOnlyList<ModState>> localAvailableMods = new Dictionary<ModType, IReadOnlyList<ModState>>();
|
private readonly Dictionary<ModType, IReadOnlyList<ModState>> localAvailableMods = new Dictionary<ModType, IReadOnlyList<ModState>>();
|
||||||
|
private IEnumerable<ModState> allLocalAvailableMods => localAvailableMods.SelectMany(pair => pair.Value);
|
||||||
|
|
||||||
private readonly BindableBool customisationVisible = new BindableBool();
|
private readonly BindableBool customisationVisible = new BindableBool();
|
||||||
|
|
||||||
@ -294,7 +295,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
private void filterMods()
|
private void filterMods()
|
||||||
{
|
{
|
||||||
foreach (var modState in localAvailableMods.Values.SelectMany(m => m))
|
foreach (var modState in allLocalAvailableMods)
|
||||||
modState.Filtered.Value = !modState.Mod.HasImplementation || !IsValidMod.Invoke(modState.Mod);
|
modState.Filtered.Value = !modState.Mod.HasImplementation || !IsValidMod.Invoke(modState.Mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +373,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
var newSelection = new List<Mod>();
|
var newSelection = new List<Mod>();
|
||||||
|
|
||||||
foreach (var modState in localAvailableMods.SelectMany(pair => pair.Value))
|
foreach (var modState in allLocalAvailableMods)
|
||||||
{
|
{
|
||||||
var matchingSelectedMod = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == modState.Mod.GetType());
|
var matchingSelectedMod = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == modState.Mod.GetType());
|
||||||
|
|
||||||
@ -399,8 +400,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
if (externalSelectionUpdateInProgress)
|
if (externalSelectionUpdateInProgress)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var candidateSelection = localAvailableMods.SelectMany(pair => pair.Value)
|
var candidateSelection = allLocalAvailableMods.Where(modState => modState.Active.Value)
|
||||||
.Where(modState => modState.Active.Value)
|
|
||||||
.Select(modState => modState.Mod)
|
.Select(modState => modState.Mod)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user