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

Add back immediate deselection flow to ensure user selections can occur without contention

This commit is contained in:
Dean Herbert 2021-02-04 23:44:46 +09:00
parent 794f9e5e93
commit 0750c3cb6a
2 changed files with 9 additions and 3 deletions

View File

@ -158,7 +158,8 @@ namespace osu.Game.Overlays.Mods
/// Deselect one or more mods in this section.
/// </summary>
/// <param name="modTypes">The types of <see cref="Mod"/>s which should be deselected.</param>
public void DeselectTypes(IEnumerable<Type> modTypes)
/// <param name="immediate">Whether the deselection should happen immediately. Should only be used when required to ensure correct selection flow.</param>
public void DeselectTypes(IEnumerable<Type> modTypes, bool immediate = false)
{
foreach (var button in buttons)
{
@ -167,7 +168,12 @@ namespace osu.Game.Overlays.Mods
foreach (var type in modTypes)
{
if (type.IsInstanceOfType(button.SelectedMod))
pendingSelectionOperations.Enqueue(button.Deselect);
{
if (immediate)
button.Deselect();
else
pendingSelectionOperations.Enqueue(button.Deselect);
}
}
}
}

View File

@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Mods
base.OnModSelected(mod);
foreach (var section in ModSectionsContainer.Children)
section.DeselectTypes(mod.IncompatibleMods);
section.DeselectTypes(mod.IncompatibleMods, true);
}
}
}