1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 14:07:25 +08:00

Correctly delay loading of PlaySongSelect-specific components

This commit is contained in:
Dean Herbert 2017-09-01 18:22:38 +09:00
parent f9d02afb00
commit 3d61cde266
2 changed files with 10 additions and 7 deletions

View File

@ -54,13 +54,11 @@ namespace osu.Game.Screens.Select
ValidForResume = false;
Push(new Editor());
}, Key.Number3);
Beatmap.ValueChanged += beatmap_ValueChanged;
}
private void beatmap_ValueChanged(WorkingBeatmap beatmap)
protected override void UpdateBeatmap(WorkingBeatmap beatmap)
{
if (!IsCurrentScreen) return;
base.UpdateBeatmap(beatmap);
beatmap.Mods.BindTo(modSelect.SelectedMods);

View File

@ -244,7 +244,7 @@ namespace osu.Game.Screens.Select
ensurePlayingSelected(preview);
}
changeBackground(Beatmap.Value);
UpdateBeatmap(Beatmap.Value);
};
selectionChangedDebounce?.Cancel();
@ -312,7 +312,7 @@ namespace osu.Game.Screens.Select
{
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
{
changeBackground(Beatmap);
UpdateBeatmap(Beatmap);
ensurePlayingSelected();
}
@ -358,7 +358,12 @@ namespace osu.Game.Screens.Select
initialAddSetsTask?.Cancel();
}
private void changeBackground(WorkingBeatmap beatmap)
/// <summary>
/// Allow components in SongSelect to update their loaded beatmap details.
/// This is a debounced call (unlike directly binding to WorkingBeatmap.ValueChanged).
/// </summary>
/// <param name="beatmap">The working beatmap.</param>
protected virtual void UpdateBeatmap(WorkingBeatmap beatmap)
{
var backgroundModeBeatmap = Background as BackgroundScreenBeatmap;
if (backgroundModeBeatmap != null)