Refactor mod panel selection logic to avoid overwriting

This commit is contained in:
Bartłomiej Dach
2022-08-16 22:41:32 +02:00
parent a494e55d93
commit 6bfdfeb153
3 changed files with 35 additions and 21 deletions

View File

@ -143,9 +143,25 @@ namespace osu.Game.Overlays.Mods
}
};
Action = () => Active.Toggle();
Action = () =>
{
if (!Active.Value)
Select();
else
Deselect();
};
}
/// <summary>
/// Performs all actions necessary to select this <see cref="ModSelectPanel"/>.
/// </summary>
protected abstract void Select();
/// <summary>
/// Performs all actions necessary to deselect this <see cref="ModSelectPanel"/>.
/// </summary>
protected abstract void Deselect();
[BackgroundDependencyLoader]
private void load(AudioManager audio, ISamplePlaybackDisabler? samplePlaybackDisabler)
{