1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-22 22:17:46 +08:00

Restore clipboard content after difficulty switch

This commit is contained in:
Bartłomiej Dach 2021-09-11 17:55:11 +02:00
parent 79d0f4835e
commit 35ee889e5b
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
2 changed files with 9 additions and 1 deletions

View File

@ -744,13 +744,16 @@ namespace osu.Game.Screens.Edit
protected void SwitchToDifficulty(BeatmapInfo nextBeatmap) => loader?.ScheduleDifficultySwitch(nextBeatmap, new EditorState
{
Time = clock.CurrentTimeAccurate
Time = clock.CurrentTimeAccurate,
ClipboardContent = editorBeatmap.BeatmapInfo.RulesetID == nextBeatmap.RulesetID ? clipboard.Value : null
});
private void restoreState([NotNull] EditorState state)
{
if (state.Time != null)
clock.Seek(state.Time.Value);
clipboard.Value = state.ClipboardContent ?? clipboard.Value;
}
private void cancelExit() => loader?.CancelPendingDifficultySwitch();

View File

@ -15,5 +15,10 @@ namespace osu.Game.Screens.Edit
/// The current clock time when a difficulty switch was requested.
/// </summary>
public double? Time { get; set; }
/// <summary>
/// The current editor clipboard content at the time when a difficulty switch was requested.
/// </summary>
public string? ClipboardContent { get; set; }
}
}