1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-14 04:12:55 +08:00

Fix song select potentially starting play before the carousel (and bindables) have been initialised

This commit is contained in:
Dean Herbert 2019-03-21 20:52:34 +09:00
parent 4789aa81cb
commit a10e43410a

View File

@ -300,6 +300,10 @@ namespace osu.Game.Screens.Select
/// <param name="performStartAction">Whether to trigger <see cref="OnStart"/>.</param> /// <param name="performStartAction">Whether to trigger <see cref="OnStart"/>.</param>
public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true) public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true)
{ {
// This is very important as we have not yet bound to screen-level bindables before the carousel load is completed.
if (!Carousel.BeatmapSetsLoaded)
return;
// if we have a pending filter operation, we want to run it now. // if we have a pending filter operation, we want to run it now.
// it could change selection (ie. if the ruleset has been changed). // it could change selection (ie. if the ruleset has been changed).
Carousel.FlushPendingFilterOperations(); Carousel.FlushPendingFilterOperations();
@ -610,19 +614,19 @@ namespace osu.Game.Screens.Select
private bool boundLocalBindables; private bool boundLocalBindables;
private void bindBindables() private void bindBindables()
{ {
if (boundLocalBindables) if (boundLocalBindables)
return; return;
// manual binding to parent ruleset to allow for delayed load in the incoming direction. // manual binding to parent ruleset to allow for delayed load in the incoming direction.
rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value; rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value;
Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue); Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue);
decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue; decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue;
decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r; decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r;
Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true); Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true);
Beatmap.BindValueChanged(workingBeatmapChanged); Beatmap.BindValueChanged(workingBeatmapChanged);
boundLocalBindables = true; boundLocalBindables = true;
} }