mirror of
https://github.com/ppy/osu
synced 2025-01-10 08:09:40 +00:00
Disallow selection of invalid items
This commit is contained in:
parent
6dd684588a
commit
8e9b55ef6d
@ -90,7 +90,24 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
SelectedItem.BindValueChanged(selected => maskingContainer.BorderThickness = selected.NewValue == Model ? 5 : 0, true);
|
||||
SelectedItem.BindValueChanged(selected =>
|
||||
{
|
||||
bool isCurrent = selected.NewValue == Model;
|
||||
|
||||
if (!valid.Value)
|
||||
{
|
||||
// Don't allow selection when not valid.
|
||||
if (isCurrent)
|
||||
{
|
||||
SelectedItem.Value = selected.OldValue;
|
||||
}
|
||||
|
||||
// Don't update border when not valid (the border is displaying this fact).
|
||||
return;
|
||||
}
|
||||
|
||||
maskingContainer.BorderThickness = isCurrent ? 5 : 0;
|
||||
}, true);
|
||||
|
||||
beatmap.BindValueChanged(_ => Scheduler.AddOnce(refresh));
|
||||
ruleset.BindValueChanged(_ => Scheduler.AddOnce(refresh));
|
||||
|
Loading…
Reference in New Issue
Block a user