Restore editor clock time after difficulty switch

This commit is contained in:
Bartłomiej Dach
2021-09-11 18:36:57 +02:00
parent 80e54d51f2
commit 3fc72271f1
3 changed files with 41 additions and 3 deletions

View File

@ -20,6 +20,13 @@ namespace osu.Game.Screens.Edit
/// </summary>
public class EditorLoader : ScreenWithBeatmapBackground
{
/// <summary>
/// The stored state from the last editor opened.
/// This will be read by the next editor instance to be opened to restore any relevant previous state.
/// </summary>
[CanBeNull]
public EditorState State;
public override float BackgroundParallaxAmount => 0.1f;
public override bool AllowBackButton => false;
@ -61,7 +68,7 @@ namespace osu.Game.Screens.Edit
}
}
public void ScheduleDifficultySwitch(BeatmapInfo beatmapInfo)
public void ScheduleDifficultySwitch(BeatmapInfo nextBeatmap, EditorState editorState)
{
scheduledDifficultySwitch?.Cancel();
ValidForResume = true;
@ -70,7 +77,8 @@ namespace osu.Game.Screens.Edit
scheduledDifficultySwitch = Schedule(() =>
{
Beatmap.Value = beatmapManager.GetWorkingBeatmap(beatmapInfo);
Beatmap.Value = beatmapManager.GetWorkingBeatmap(nextBeatmap);
State = editorState;
// This screen is a weird exception to the rule that nothing after song select changes the global beatmap.
// Because of this, we need to update the background stack's beatmap to match.