mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 18:12:56 +08:00
Update deselect logic.
Change to DeselectTypes to avoid enumerating children for multi times.
This commit is contained in:
parent
eda7e1b26f
commit
27edc9971e
@ -91,30 +91,21 @@ namespace osu.Game.Overlays.Mods
|
|||||||
public void DeselectAll()
|
public void DeselectAll()
|
||||||
{
|
{
|
||||||
foreach (ModSection section in modSectionsContainer.Children)
|
foreach (ModSection section in modSectionsContainer.Children)
|
||||||
{
|
section.DeselectAll();
|
||||||
foreach (ModButton button in section.Buttons)
|
|
||||||
{
|
|
||||||
button.Deselect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeselectType(Type modType)
|
public void DeselectTypes(Type[] modTypes)
|
||||||
{
|
{
|
||||||
|
if (modTypes.Length == 0) return;
|
||||||
foreach (ModSection section in modSectionsContainer.Children)
|
foreach (ModSection section in modSectionsContainer.Children)
|
||||||
{
|
|
||||||
foreach (ModButton button in section.Buttons)
|
foreach (ModButton button in section.Buttons)
|
||||||
{
|
{
|
||||||
foreach (Mod mod in button.Mods)
|
Mod selected = button.SelectedMod;
|
||||||
{
|
if (selected == null) continue;
|
||||||
if (modType.IsInstanceOfType(mod))
|
foreach (Type type in modTypes)
|
||||||
{
|
if (type.IsInstanceOfType(selected))
|
||||||
button.Deselect();
|
button.Deselect();
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void modButtonPressed(Mod selectedMod)
|
private void modButtonPressed(Mod selectedMod)
|
||||||
|
Loading…
Reference in New Issue
Block a user