1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:52:55 +08:00

Stack freemods for the local user

This commit is contained in:
smoogipoo 2021-02-01 18:16:38 +09:00
parent 3e74f8fd9e
commit e134af82f5
2 changed files with 12 additions and 7 deletions

View File

@ -444,10 +444,20 @@ namespace osu.Game.Overlays.Mods
if (!Stacked)
modEnumeration = ModValidation.FlattenMods(modEnumeration);
section.Mods = modEnumeration.Where(IsValidMod);
section.Mods = modEnumeration.Select(validModOrNull).Where(m => m != null);
}
}
[CanBeNull]
private Mod validModOrNull([NotNull] Mod mod)
{
if (!(mod is MultiMod multi))
return IsValidMod(mod) ? mod : null;
var validSubset = multi.Mods.Select(validModOrNull).Where(m => m != null).ToArray();
return validSubset.Length == 0 ? null : new MultiMod(validSubset);
}
private void selectedModsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
{
foreach (var section in ModSectionsContainer.Children)

View File

@ -210,7 +210,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
new Dimension(GridSizeMode.AutoSize),
}
},
userModsSelectOverlay = new UserModSelectOverlay
userModsSelectOverlay = new SoloModSelectOverlay
{
SelectedMods = { BindTarget = UserMods },
IsValidMod = _ => false
@ -351,10 +351,5 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
if (client != null)
client.LoadRequested -= onLoadRequested;
}
private class UserModSelectOverlay : SoloModSelectOverlay
{
protected override bool Stacked => false;
}
}
}