1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:52:57 +08:00

Merge pull request #13324 from peppy/fix-collection-enumeration-replay

Detach gameplay score from replay recorder before importing
This commit is contained in:
Dan Balasescu 2021-06-04 10:44:23 +09:00 committed by GitHub
commit a648cdfd14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 3 deletions

View File

@ -267,6 +267,12 @@ namespace osu.Game.Rulesets.UI
if (!(KeyBindingInputManager is IHasRecordingHandler recordingInputManager))
throw new InvalidOperationException($"A {nameof(KeyBindingInputManager)} which supports recording is not available");
if (score == null)
{
recordingInputManager.Recorder = null;
return;
}
var recorder = CreateReplayRecorder(score);
if (recorder == null)
@ -511,7 +517,7 @@ namespace osu.Game.Rulesets.UI
/// Sets a replay to be used to record gameplay.
/// </summary>
/// <param name="score">The target to be recorded to.</param>
public abstract void SetRecordTarget(Score score);
public abstract void SetRecordTarget([CanBeNull] Score score);
/// <summary>
/// Invoked when the interactive user requests resuming from a paused state.

View File

@ -30,12 +30,14 @@ namespace osu.Game.Rulesets.UI
{
set
{
if (recorder != null)
if (value != null && recorder != null)
throw new InvalidOperationException("Cannot attach more than one recorder");
recorder?.Expire();
recorder = value;
KeyBindingContainer.Add(recorder);
if (recorder != null)
KeyBindingContainer.Add(recorder);
}
}

View File

@ -636,6 +636,9 @@ namespace osu.Game.Screens.Play
ValidForResume = false;
// ensure we are not writing to the replay any more, as we are about to consume and store the score.
DrawableRuleset.SetRecordTarget(null);
if (!Configuration.ShowResults) return;
prepareScoreForDisplayTask ??= Task.Run(async () =>