Merge pull request #24419 from peppy/fix-replay-export-queued-op

Fix replay being unexpected exported at results screen after score switch
This commit is contained in:
Bartłomiej Dach 2023-07-30 15:31:17 +02:00 committed by GitHub
commit 3e801d8696
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,6 +83,10 @@ namespace osu.Game.Screens.Ranking
Score.BindValueChanged(score =>
{
// An export may be pending from the last score.
// Reset this to meet user expectations (a new score which has just been switched to shouldn't export)
State.ValueChanged -= exportWhenReady;
downloadTracker?.RemoveAndDisposeImmediately();
if (score.NewValue != null)
@ -117,11 +121,17 @@ namespace osu.Game.Screens.Ranking
return true;
case GlobalAction.ExportReplay:
State.BindValueChanged(exportWhenReady, true);
// start the import via button
if (State.Value != DownloadState.LocallyAvailable)
if (State.Value == DownloadState.LocallyAvailable)
{
State.BindValueChanged(exportWhenReady, true);
}
else
{
// A download needs to be performed before we can export this replay.
button.TriggerClick();
if (button.Enabled.Value)
State.BindValueChanged(exportWhenReady, true);
}
return true;
}