1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 21:02:54 +08:00

Fix song select not updating selected beatmap card on editor resume

This commit is contained in:
Salman Ahmed 2022-07-30 18:51:19 +03:00
parent b95aff3e5f
commit faefda9143

View File

@ -405,20 +405,21 @@ namespace osu.Game.Screens.Select
private ScheduledDelegate selectionChangedDebounce; private ScheduledDelegate selectionChangedDebounce;
private void workingBeatmapChanged(ValueChangedEvent<WorkingBeatmap> e) private void updateCarouselSelection(ValueChangedEvent<WorkingBeatmap> e = null)
{ {
if (e.NewValue is DummyWorkingBeatmap || !this.IsCurrentScreen()) return; var beatmap = e?.NewValue ?? Beatmap.Value;
if (beatmap is DummyWorkingBeatmap || !this.IsCurrentScreen()) return;
Logger.Log($"Song select working beatmap updated to {e.NewValue}"); Logger.Log($"Song select working beatmap updated to {beatmap}");
if (!Carousel.SelectBeatmap(e.NewValue.BeatmapInfo, false)) if (!Carousel.SelectBeatmap(beatmap.BeatmapInfo, false))
{ {
// A selection may not have been possible with filters applied. // A selection may not have been possible with filters applied.
// There was possibly a ruleset mismatch. This is a case we can help things along by updating the game-wide ruleset to match. // There was possibly a ruleset mismatch. This is a case we can help things along by updating the game-wide ruleset to match.
if (!e.NewValue.BeatmapInfo.Ruleset.Equals(decoupledRuleset.Value)) if (!beatmap.BeatmapInfo.Ruleset.Equals(decoupledRuleset.Value))
{ {
Ruleset.Value = e.NewValue.BeatmapInfo.Ruleset; Ruleset.Value = beatmap.BeatmapInfo.Ruleset;
transferRulesetValue(); transferRulesetValue();
} }
@ -426,10 +427,10 @@ namespace osu.Game.Screens.Select
// we still want to temporarily show the new beatmap, bypassing filters. // we still want to temporarily show the new beatmap, bypassing filters.
// This will be undone the next time the user changes the filter. // This will be undone the next time the user changes the filter.
var criteria = FilterControl.CreateCriteria(); var criteria = FilterControl.CreateCriteria();
criteria.SelectedBeatmapSet = e.NewValue.BeatmapInfo.BeatmapSet; criteria.SelectedBeatmapSet = beatmap.BeatmapInfo.BeatmapSet;
Carousel.Filter(criteria); Carousel.Filter(criteria);
Carousel.SelectBeatmap(e.NewValue.BeatmapInfo); Carousel.SelectBeatmap(beatmap.BeatmapInfo);
} }
} }
@ -597,6 +598,8 @@ namespace osu.Game.Screens.Select
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending) if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
{ {
updateCarouselSelection();
updateComponentFromBeatmap(Beatmap.Value); updateComponentFromBeatmap(Beatmap.Value);
if (ControlGlobalMusic) if (ControlGlobalMusic)
@ -805,7 +808,7 @@ namespace osu.Game.Screens.Select
}; };
decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r; decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r;
Beatmap.BindValueChanged(workingBeatmapChanged); Beatmap.BindValueChanged(updateCarouselSelection);
boundLocalBindables = true; boundLocalBindables = true;
} }