1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 14:03:21 +08:00

Fix MatchSongSelect not handling beatmapset deletions

This commit is contained in:
Jamie Taylor 2019-02-22 11:26:06 +00:00
parent 109abf4d28
commit 7c2ffb1826
No known key found for this signature in database
GPG Key ID: 2ACFA8B6370B8C8C
2 changed files with 24 additions and 1 deletions

View File

@ -39,6 +39,7 @@ namespace osu.Game.Screens.Multi.Match.Components
private void load()
{
beatmaps.ItemAdded += beatmapAdded;
beatmaps.ItemRemoved += beatmapRemoved;
Beatmap.BindValueChanged(b => updateBeatmap(b.NewValue), true);
}
@ -62,6 +63,15 @@ namespace osu.Game.Screens.Multi.Match.Components
Schedule(() => hasBeatmap = true);
}
private void beatmapRemoved(BeatmapSetInfo model)
{
if (Beatmap.Value == null)
return;
if (model.OnlineBeatmapSetID == Beatmap.Value.BeatmapSet.OnlineBeatmapSetID)
Schedule(() => hasBeatmap = false);
}
protected override void Update()
{
base.Update();

View File

@ -3,8 +3,11 @@
using System;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Online.Multiplayer;
using osu.Game.Screens.Multi;
@ -17,6 +20,12 @@ namespace osu.Game.Screens.Select
public string ShortTitle => "song selection";
public override string Title => ShortTitle.Humanize();
[Resolved(typeof(Room))]
protected Bindable<PlaylistItem> CurrentItem { get; private set; }
[Resolved]
private BeatmapManager beatmaps { get; set; }
public MatchSongSelect()
{
Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING };
@ -43,10 +52,14 @@ namespace osu.Game.Screens.Select
public override bool OnExiting(IScreen next)
{
if (base.OnExiting(next))
return true;
Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value?.Beatmap);
Beatmap.Disabled = true;
Ruleset.Disabled = true;
return base.OnExiting(next);
return false;
}
public override void OnEntering(IScreen last)