Allow mod buttons to not be stacked

This commit is contained in:
smoogipoo
2021-02-02 20:27:41 +09:00
parent 4ecbe058f7
commit 6d620264f4
2 changed files with 51 additions and 23 deletions

View File

@ -22,6 +22,7 @@ using osu.Game.Input.Bindings;
using osu.Game.Overlays.Mods.Sections;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens;
using osu.Game.Utils;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
@ -43,6 +44,11 @@ namespace osu.Game.Overlays.Mods
protected override bool DimMainContent => false;
/// <summary>
/// Whether <see cref="Mod"/>s underneath the same <see cref="MultiMod"/> instance should appear as stacked buttons.
/// </summary>
protected virtual bool Stacked => true;
protected readonly FillFlowContainer<ModSection> ModSectionsContainer;
protected readonly ModSettingsContainer ModSettingsContainer;
@ -405,7 +411,11 @@ namespace osu.Game.Overlays.Mods
if (mods.NewValue == null) return;
foreach (var section in ModSectionsContainer.Children)
section.Mods = mods.NewValue[section.ModType].Where(isValidMod);
{
section.Mods = Stacked
? availableMods.Value[section.ModType]
: ModUtils.FlattenMods(availableMods.Value[section.ModType]);
}
}
private void selectedModsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)