From 7122aa0519188441d67218b4d3a4498a85aa755f Mon Sep 17 00:00:00 2001 From: andy840119 Date: Mon, 7 Feb 2022 21:00:30 +0800 Subject: [PATCH 1/2] 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, From 61e1780dc7f9f7b0984556d8cedae7128c750340 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Mon, 7 Feb 2022 21:00:42 +0800 Subject: [PATCH 2/2] remove the duplicated DI. --- .../Editor/TestSceneKaraokeEditor.cs | 2 -- .../Screens/TestSceneKaraokeSkinEditor.cs | 3 --- 2 files changed, 5 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneKaraokeEditor.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneKaraokeEditor.cs index 466425aa1..716c38425 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneKaraokeEditor.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneKaraokeEditor.cs @@ -54,8 +54,6 @@ private void load() Dependencies.Cache(dialogOverlay); Dependencies.Cache(lyricCheckerManager); - - Dependencies.Cache(new EditorClock()); } } } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Screens/TestSceneKaraokeSkinEditor.cs b/osu.Game.Rulesets.Karaoke.Tests/Screens/TestSceneKaraokeSkinEditor.cs index a4efdbb52..32266f56a 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Screens/TestSceneKaraokeSkinEditor.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Screens/TestSceneKaraokeSkinEditor.cs @@ -28,9 +28,6 @@ public class TestSceneKaraokeSkinEditor : ScreenTestScene [BackgroundDependencyLoader] private void load(SkinManager skinManager) { - // todo: karaoke skin editor might not need editor clock eventually? - Dependencies.Cache(new EditorClock()); - skinManager.CurrentSkinInfo.Value = DefaultKaraokeSkin.CreateInfo().ToLiveUnmanaged(); karaokeSkin = skinManager.CurrentSkin.Value as KaraokeSkin;