1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 10:23:02 +08:00

Don't expose such specific information from ModSelectOverlay

This commit is contained in:
Dean Herbert 2023-07-20 12:58:13 +09:00
parent 4057fcd70e
commit 18c5fc689f
2 changed files with 11 additions and 11 deletions

View File

@ -111,11 +111,7 @@ namespace osu.Game.Overlays.Mods
private readonly Bindable<Dictionary<ModType, IReadOnlyList<Mod>>> globalAvailableMods = new Bindable<Dictionary<ModType, IReadOnlyList<Mod>>>(); private readonly Bindable<Dictionary<ModType, IReadOnlyList<Mod>>> globalAvailableMods = new Bindable<Dictionary<ModType, IReadOnlyList<Mod>>>();
public IEnumerable<Mod> AllAvailableAndValidMods => allAvailableMods public IEnumerable<ModState> AllAvailableMods => AvailableMods.Value.SelectMany(pair => pair.Value);
.Select(s => s.Mod)
.Where(m => isValidMod(m));
private IEnumerable<ModState> allAvailableMods => AvailableMods.Value.SelectMany(pair => pair.Value);
private readonly BindableBool customisationVisible = new BindableBool(); private readonly BindableBool customisationVisible = new BindableBool();
@ -386,7 +382,7 @@ namespace osu.Game.Overlays.Mods
private void filterMods() private void filterMods()
{ {
foreach (var modState in allAvailableMods) foreach (var modState in AllAvailableMods)
modState.ValidForSelection.Value = modState.Mod.HasImplementation && IsValidMod.Invoke(modState.Mod); modState.ValidForSelection.Value = modState.Mod.HasImplementation && IsValidMod.Invoke(modState.Mod);
} }
@ -411,7 +407,7 @@ namespace osu.Game.Overlays.Mods
bool anyCustomisableModActive = false; bool anyCustomisableModActive = false;
bool anyModPendingConfiguration = false; bool anyModPendingConfiguration = false;
foreach (var modState in allAvailableMods) foreach (var modState in AllAvailableMods)
{ {
anyCustomisableModActive |= modState.Active.Value && modState.Mod.GetSettingsSourceProperties().Any(); anyCustomisableModActive |= modState.Active.Value && modState.Mod.GetSettingsSourceProperties().Any();
anyModPendingConfiguration |= modState.PendingConfiguration; anyModPendingConfiguration |= modState.PendingConfiguration;
@ -468,7 +464,7 @@ namespace osu.Game.Overlays.Mods
var newSelection = new List<Mod>(); var newSelection = new List<Mod>();
foreach (var modState in allAvailableMods) foreach (var modState in AllAvailableMods)
{ {
var matchingSelectedMod = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == modState.Mod.GetType()); var matchingSelectedMod = SelectedMods.Value.SingleOrDefault(selected => selected.GetType() == modState.Mod.GetType());
@ -495,7 +491,7 @@ namespace osu.Game.Overlays.Mods
if (externalSelectionUpdateInProgress) if (externalSelectionUpdateInProgress)
return; return;
var candidateSelection = allAvailableMods.Where(modState => modState.Active.Value) var candidateSelection = AllAvailableMods.Where(modState => modState.Active.Value)
.Select(modState => modState.Mod) .Select(modState => modState.Mod)
.ToArray(); .ToArray();

View File

@ -97,7 +97,7 @@ namespace osu.Game.Screens.OnlinePlay
/// </summary> /// </summary>
private void toggleAllFreeMods() private void toggleAllFreeMods()
{ {
var availableMods = freeModSelectOverlay.AllAvailableAndValidMods.ToArray(); var availableMods = allAvailableAndValidMods.ToArray();
Current.Value = Current.Value.Count == availableMods.Length Current.Value = Current.Value.Count == availableMods.Length
? Array.Empty<Mod>() ? Array.Empty<Mod>()
@ -108,7 +108,7 @@ namespace osu.Game.Screens.OnlinePlay
{ {
int current = Current.Value.Count; int current = Current.Value.Count;
if (current == freeModSelectOverlay.AllAvailableAndValidMods.Count()) if (current == allAvailableAndValidMods.Count())
{ {
count.Text = "all"; count.Text = "all";
circle.FadeColour(colours.Yellow, 200, Easing.OutQuint); circle.FadeColour(colours.Yellow, 200, Easing.OutQuint);
@ -124,5 +124,9 @@ namespace osu.Game.Screens.OnlinePlay
circle.FadeColour(colours.Gray4, 200, Easing.OutQuint); circle.FadeColour(colours.Gray4, 200, Easing.OutQuint);
} }
} }
private IEnumerable<Mod> allAvailableAndValidMods => freeModSelectOverlay.AllAvailableMods
.Where(state => state.ValidForSelection.Value)
.Select(state => state.Mod);
} }
} }