1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 19:22:54 +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>>>();
public IEnumerable<Mod> AllAvailableAndValidMods => allAvailableMods
.Select(s => s.Mod)
.Where(m => isValidMod(m));
private IEnumerable<ModState> allAvailableMods => AvailableMods.Value.SelectMany(pair => pair.Value);
public IEnumerable<ModState> AllAvailableMods => AvailableMods.Value.SelectMany(pair => pair.Value);
private readonly BindableBool customisationVisible = new BindableBool();
@ -386,7 +382,7 @@ namespace osu.Game.Overlays.Mods
private void filterMods()
{
foreach (var modState in allAvailableMods)
foreach (var modState in AllAvailableMods)
modState.ValidForSelection.Value = modState.Mod.HasImplementation && IsValidMod.Invoke(modState.Mod);
}
@ -411,7 +407,7 @@ namespace osu.Game.Overlays.Mods
bool anyCustomisableModActive = false;
bool anyModPendingConfiguration = false;
foreach (var modState in allAvailableMods)
foreach (var modState in AllAvailableMods)
{
anyCustomisableModActive |= modState.Active.Value && modState.Mod.GetSettingsSourceProperties().Any();
anyModPendingConfiguration |= modState.PendingConfiguration;
@ -468,7 +464,7 @@ namespace osu.Game.Overlays.Mods
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());
@ -495,7 +491,7 @@ namespace osu.Game.Overlays.Mods
if (externalSelectionUpdateInProgress)
return;
var candidateSelection = allAvailableMods.Where(modState => modState.Active.Value)
var candidateSelection = AllAvailableMods.Where(modState => modState.Active.Value)
.Select(modState => modState.Mod)
.ToArray();

View File

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