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

More correctly handle rulesets which don't support replay recording

This commit is contained in:
Dean Herbert 2020-03-24 15:44:39 +09:00
parent 2feb66d423
commit a7bfaad60f

View File

@ -650,24 +650,28 @@ namespace osu.Game.Screens.Play
this.Push(CreateResults(DrawableRuleset.ReplayScore.ScoreInfo)); this.Push(CreateResults(DrawableRuleset.ReplayScore.ScoreInfo));
else else
{ {
var score = new Score var score = new Score { ScoreInfo = CreateScore() };
{
ScoreInfo = CreateScore(),
Replay = recordingReplay
};
using (var stream = new MemoryStream()) LegacyByteArrayReader replayReader = null;
{
new LegacyScoreEncoder(score, gameplayBeatmap).Encode(stream);
scoreManager.Import(score.ScoreInfo, new LegacyByteArrayReader(stream.ToArray(), "replay.osr")) if (recordingReplay?.Frames.Count > 0)
.ContinueWith(imported => Schedule(() => {
{ score.Replay = recordingReplay;
// screen may be in the exiting transition phase.
if (this.IsCurrentScreen()) using (var stream = new MemoryStream())
this.Push(CreateResults(imported.Result)); {
})); new LegacyScoreEncoder(score, gameplayBeatmap).Encode(stream);
replayReader = new LegacyByteArrayReader(stream.ToArray(), "replay.osr");
}
} }
scoreManager.Import(score.ScoreInfo, replayReader)
.ContinueWith(imported => Schedule(() =>
{
// screen may be in the exiting transition phase.
if (this.IsCurrentScreen())
this.Push(CreateResults(imported.Result));
}));
} }
}); });
} }