diff --git a/osu.Game/Online/Rooms/PlaylistItem.cs b/osu.Game/Online/Rooms/PlaylistItem.cs index cb550281a9..4a94191a34 100644 --- a/osu.Game/Online/Rooms/PlaylistItem.cs +++ b/osu.Game/Online/Rooms/PlaylistItem.cs @@ -30,6 +30,11 @@ namespace osu.Game.Online.Rooms [JsonProperty("expired")] public bool Expired { get; set; } + [JsonIgnore] + public IBindable Valid => valid; + + private readonly Bindable valid = new BindableBool(true); + [JsonIgnore] public readonly Bindable Beatmap = new Bindable(); @@ -69,6 +74,8 @@ namespace osu.Game.Online.Rooms Ruleset.BindValueChanged(ruleset => RulesetID = ruleset.NewValue?.ID ?? 0); } + public void MarkInvalid() => valid.Value = false; + public void MapObjects(RulesetStore rulesets) { Beatmap.Value ??= apiBeatmap; diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index a1e3bfdd8b..90cb362d5c 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -45,6 +45,7 @@ namespace osu.Game.Screens.OnlinePlay private ModDisplay modDisplay; private readonly Bindable beatmap = new Bindable(); + private readonly IBindable valid = new Bindable(); private readonly Bindable ruleset = new Bindable(); private readonly BindableList requiredMods = new BindableList(); @@ -65,14 +66,18 @@ namespace osu.Game.Screens.OnlinePlay this.allowSelection = allowSelection; beatmap.BindTo(item.Beatmap); + valid.BindTo(item.Valid); ruleset.BindTo(item.Ruleset); requiredMods.BindTo(item.RequiredMods); ShowDragHandle.Value = allowEdit; } + [Resolved] + private OsuColour colours { get; set; } + [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load() { if (!allowEdit) HandleColour = HandleColour.Opacity(0); @@ -88,6 +93,7 @@ namespace osu.Game.Screens.OnlinePlay beatmap.BindValueChanged(_ => Scheduler.AddOnce(refresh)); ruleset.BindValueChanged(_ => Scheduler.AddOnce(refresh)); + valid.BindValueChanged(_ => Scheduler.AddOnce(refresh)); requiredMods.CollectionChanged += (_, __) => Scheduler.AddOnce(refresh); refresh(); @@ -97,6 +103,12 @@ namespace osu.Game.Screens.OnlinePlay private void refresh() { + if (!valid.Value) + { + maskingContainer.BorderThickness = 5; + maskingContainer.BorderColour = colours.Red; + } + difficultyIconContainer.Child = new DifficultyIcon(Item.Beatmap.Value, ruleset.Value, requiredMods, performBackgroundDifficultyLookup: false) { Size = new Vector2(32) }; panelBackground.Beatmap.Value = Item.Beatmap.Value;