1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-29 13:42:54 +08:00

Recreate test beatmap of EditorTestScene on set up

This commit is contained in:
Salman Ahmed 2022-01-25 13:01:30 +03:00
parent d8270fe14f
commit a93873e8ca

View File

@ -43,28 +43,16 @@ namespace osu.Game.Tests.Visual
}; };
private TestBeatmapManager testBeatmapManager; private TestBeatmapManager testBeatmapManager;
private WorkingBeatmap working;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(GameHost host, AudioManager audio, RulesetStore rulesets) private void load(GameHost host, AudioManager audio, RulesetStore rulesets)
{ {
Add(logo); Add(logo);
working = CreateWorkingBeatmap(Ruleset.Value);
if (IsolateSavingFromDatabase) if (IsolateSavingFromDatabase)
Dependencies.CacheAs<BeatmapManager>(testBeatmapManager = new TestBeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); Dependencies.CacheAs<BeatmapManager>(testBeatmapManager = new TestBeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default));
} }
protected override void LoadComplete()
{
base.LoadComplete();
Beatmap.Value = working;
if (testBeatmapManager != null)
testBeatmapManager.TestBeatmap = working;
}
protected virtual bool EditorComponentsReady => Editor.ChildrenOfType<HitObjectComposer>().FirstOrDefault()?.IsLoaded == true protected virtual bool EditorComponentsReady => Editor.ChildrenOfType<HitObjectComposer>().FirstOrDefault()?.IsLoaded == true
&& Editor.ChildrenOfType<TimelineArea>().FirstOrDefault()?.IsLoaded == true; && Editor.ChildrenOfType<TimelineArea>().FirstOrDefault()?.IsLoaded == true;
@ -78,6 +66,11 @@ namespace osu.Game.Tests.Visual
protected virtual void LoadEditor() protected virtual void LoadEditor()
{ {
Beatmap.Value = CreateWorkingBeatmap(Ruleset.Value);
if (testBeatmapManager != null)
testBeatmapManager.TestBeatmap = Beatmap.Value;
LoadScreen(editorLoader = new TestEditorLoader()); LoadScreen(editorLoader = new TestEditorLoader());
} }