From 7122aa0519188441d67218b4d3a4498a85aa755f Mon Sep 17 00:00:00 2001 From: andy840119 Date: Mon, 7 Feb 2022 21:00:30 +0800 Subject: [PATCH] should inject local editor clock in every base editor screen. --- .../Screens/Edit/GenericEditor.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/GenericEditor.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/GenericEditor.cs index 35acdc9af..fc4b11a35 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/GenericEditor.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/GenericEditor.cs @@ -41,9 +41,23 @@ public abstract class GenericEditor : ScreenWithBeatmapBackground w private GenericEditorMenuBar menuBar; + private DependencyContainer dependencies; + + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, EditorBeatmap beatmap) + private void load(OsuColour colours, EditorBeatmap editorBeatmap, BindableBeatDivisor beatDivisor) { + // todo: should re-inject editor clock because it will let track cannot change time because it's in another screen. + var clock = new EditorClock(editorBeatmap, beatDivisor) { IsCoupled = false }; + + var loadableBeatmap = Beatmap.Value; + clock.ChangeSource(loadableBeatmap.Track); + + dependencies.CacheAs(clock); + AddInternal(clock); + AddInternal(new OsuContextMenuContainer { RelativeSizeAxes = Axes.Both,