mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 00:09:55 +09:00
Fix selection not being preserved when IsValidMod changes
This commit is contained in:
@ -367,7 +367,7 @@ namespace osu.Game.Overlays.Mods
|
||||
base.LoadComplete();
|
||||
|
||||
availableMods.BindValueChanged(_ => updateAvailableMods(), true);
|
||||
SelectedMods.BindValueChanged(selectedModsChanged, true);
|
||||
SelectedMods.BindValueChanged(_ => updateSelectedButtons(), true);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
@ -435,6 +435,8 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
section.Mods = modEnumeration.Select(getValidModOrNull).Where(m => m != null);
|
||||
}
|
||||
|
||||
updateSelectedButtons();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -459,10 +461,13 @@ namespace osu.Game.Overlays.Mods
|
||||
return validSubset.Length == 1 ? validSubset[0] : new MultiMod(validSubset);
|
||||
}
|
||||
|
||||
private void selectedModsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
||||
private void updateSelectedButtons()
|
||||
{
|
||||
// Enumeration below may update the bindable list.
|
||||
var selectedMods = SelectedMods.Value.ToList();
|
||||
|
||||
foreach (var section in ModSectionsContainer.Children)
|
||||
section.UpdateSelectedMods(mods.NewValue);
|
||||
section.UpdateSelectedButtons(selectedMods);
|
||||
|
||||
updateMods();
|
||||
}
|
||||
|
Reference in New Issue
Block a user