From 8e9b55ef6dbd061666e75b4b1228eeaa43d93bd8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 17 Nov 2021 11:28:43 +0900 Subject: [PATCH] Disallow selection of invalid items --- .../OnlinePlay/DrawableRoomPlaylistItem.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index 2fa1a79ddd..96ff44fab5 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -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));