mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 08:03:52 +09:00
Allow song select to refresh the global WorkingBeatmap
after an external update
This commit is contained in:
@ -296,8 +296,24 @@ namespace osu.Game.Screens.Select
|
||||
base.LoadComplete();
|
||||
|
||||
modSelectOverlayRegistration = OverlayManager?.RegisterBlockingOverlay(ModSelect);
|
||||
|
||||
beatmaps.OnInvalidated += workingBeatmapInvalidated;
|
||||
}
|
||||
|
||||
private void workingBeatmapInvalidated(WorkingBeatmap working) => Scheduler.AddOnce(w =>
|
||||
{
|
||||
// The global beatmap may have already been updated (ie. by the editor).
|
||||
// Only perform the actual switch if we still need to.
|
||||
if (w == Beatmap.Value)
|
||||
{
|
||||
// Not sure if this refresh is required.
|
||||
var beatmapInfo = beatmaps.QueryBeatmap(b => b.ID == w.BeatmapInfo.ID);
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo);
|
||||
}
|
||||
|
||||
updateComponentFromBeatmap(Beatmap.Value);
|
||||
}, working);
|
||||
|
||||
/// <summary>
|
||||
/// Creates the buttons to be displayed in the footer.
|
||||
/// </summary>
|
||||
@ -700,6 +716,8 @@ namespace osu.Game.Screens.Select
|
||||
music.TrackChanged -= ensureTrackLooping;
|
||||
|
||||
modSelectOverlayRegistration?.Dispose();
|
||||
|
||||
beatmaps.OnInvalidated -= workingBeatmapInvalidated;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user