Eliminate dependency on OsuGame

This commit is contained in:
Bartłomiej Dach 2021-09-05 17:53:57 +02:00
parent c397cc2027
commit a9403b65b3
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
2 changed files with 7 additions and 14 deletions

View File

@ -105,9 +105,6 @@ namespace osu.Game.Screens.Edit
[Resolved]
private MusicController music { get; set; }
[Resolved(CanBeNull = true)]
private OsuGame game { get; set; }
public Editor(EditorLoader loader = null)
{
this.loader = loader;
@ -735,16 +732,12 @@ namespace osu.Game.Screens.Edit
private void switchToDifficulty(BeatmapInfo beatmapInfo)
{
if (loader != null)
loader.ValidForResume = true;
if (loader == null)
return;
game?.PerformFromScreen(screen =>
{
if (screen == null || screen != loader)
return;
loader.PushEditor(beatmapInfo);
}, new[] { typeof(EditorLoader) });
loader.ValidForResume = true;
this.Exit();
loader.PushEditor(beatmapInfo);
}
public double SnapTime(double time, double? referenceTime) => editorBeatmap.SnapTime(time, referenceTime);

View File

@ -24,13 +24,13 @@ namespace osu.Game.Screens.Edit
PushEditor();
}
public void PushEditor([CanBeNull] BeatmapInfo beatmapInfo = null)
public void PushEditor([CanBeNull] BeatmapInfo beatmapInfo = null) => Schedule(() =>
{
if (beatmapInfo != null)
Beatmap.Value = beatmapManager.GetWorkingBeatmap(beatmapInfo);
this.Push(new Editor(this));
ValidForResume = false;
}
});
}
}