mirror of
https://github.com/ppy/osu
synced 2025-01-11 08:39:31 +00:00
Move screen management logic to EditorLoader
This commit is contained in:
parent
bd7d6dd35d
commit
2d59008f52
@ -740,24 +740,9 @@ namespace osu.Game.Screens.Edit
|
||||
return new DifficultyMenuItem(beatmapInfo, isCurrentDifficulty, switchToDifficulty);
|
||||
}
|
||||
|
||||
private void switchToDifficulty(BeatmapInfo beatmapInfo)
|
||||
{
|
||||
if (loader == null)
|
||||
return;
|
||||
private void switchToDifficulty(BeatmapInfo beatmapInfo) => loader?.ScheduleDifficultySwitch(beatmapInfo);
|
||||
|
||||
loader.ValidForResume = true;
|
||||
this.Exit();
|
||||
loader.ScheduleDifficultySwitch(beatmapInfo);
|
||||
}
|
||||
|
||||
private void cancelExit()
|
||||
{
|
||||
if (loader == null)
|
||||
return;
|
||||
|
||||
loader.ValidForResume = false;
|
||||
loader.CancelDifficultySwitch();
|
||||
}
|
||||
private void cancelExit() => loader?.CancelPendingDifficultySwitch();
|
||||
|
||||
public double SnapTime(double time, double? referenceTime) => editorBeatmap.SnapTime(time, referenceTime);
|
||||
|
||||
|
@ -48,7 +48,10 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
public void ScheduleDifficultySwitch(BeatmapInfo beatmapInfo)
|
||||
{
|
||||
CancelDifficultySwitch();
|
||||
scheduledDifficultySwitch?.Cancel();
|
||||
ValidForResume = true;
|
||||
|
||||
this.MakeCurrent();
|
||||
scheduledDifficultySwitch = Schedule(() =>
|
||||
{
|
||||
Beatmap.Value = beatmapManager.GetWorkingBeatmap(beatmapInfo);
|
||||
@ -56,6 +59,10 @@ namespace osu.Game.Screens.Edit
|
||||
});
|
||||
}
|
||||
|
||||
public void CancelDifficultySwitch() => scheduledDifficultySwitch?.Cancel();
|
||||
public void CancelPendingDifficultySwitch()
|
||||
{
|
||||
scheduledDifficultySwitch?.Cancel();
|
||||
ValidForResume = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user