From 6ee8ce722b30e16ce69fffb4e99ab4aab59dc8ab Mon Sep 17 00:00:00 2001 From: andy840119 Date: Tue, 9 May 2023 22:10:46 +0800 Subject: [PATCH 1/5] Remove premit null in the BDL because there's no nullable injection. --- .../Edit/Components/UserInterfaceV2/NoteEditPopover.cs | 2 +- osu.Game.Rulesets.Karaoke/Edit/EditorNotePlayfield.cs | 2 +- osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs | 2 +- .../Screens/Edit/Beatmaps/Lyrics/Compose/Panel.cs | 2 +- .../Edit/Beatmaps/Lyrics/Compose/SpecialActionToolbar.cs | 2 +- .../Screens/Edit/Beatmaps/Lyrics/Compose/Toolbar/Separator.cs | 2 +- .../Screens/Edit/Beatmaps/Lyrics/LyricEditorVerifier.cs | 2 +- .../Edit/Import/Lyrics/DragFile/Components/DrawableDragFile.cs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Edit/Components/UserInterfaceV2/NoteEditPopover.cs b/osu.Game.Rulesets.Karaoke/Edit/Components/UserInterfaceV2/NoteEditPopover.cs index 12b602c54..715cb20c9 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Components/UserInterfaceV2/NoteEditPopover.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Components/UserInterfaceV2/NoteEditPopover.cs @@ -103,7 +103,7 @@ public NoteSection(Note note) }); } - [BackgroundDependencyLoader(true)] + [BackgroundDependencyLoader] private void load(HitObjectComposer composer) { // todo: not a good way to get change handler, might remove or found another way eventually. diff --git a/osu.Game.Rulesets.Karaoke/Edit/EditorNotePlayfield.cs b/osu.Game.Rulesets.Karaoke/Edit/EditorNotePlayfield.cs index 47eaf89fa..6067b5ea5 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/EditorNotePlayfield.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/EditorNotePlayfield.cs @@ -40,7 +40,7 @@ public EditorNotePlayfield(int columns) }); } - [BackgroundDependencyLoader(true)] + [BackgroundDependencyLoader] private void load() { // todo : load data from scoring manager. diff --git a/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs b/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs index 0ce9fbf07..ce043ae24 100644 --- a/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs +++ b/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs @@ -36,7 +36,7 @@ public KaraokeInputManager(RulesetInfo ruleset) private IBeatmap beatmap; - [BackgroundDependencyLoader(true)] + [BackgroundDependencyLoader] private void load(KaraokeRulesetConfigManager config, IBindable> mods, IBindable beatmap, KaraokeSessionStatics session, EditorBeatmap editorBeatmap) { if (editorBeatmap != null) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/Panel.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/Panel.cs index 9e9ddd080..9741ef5fa 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/Panel.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/Panel.cs @@ -57,7 +57,7 @@ protected Panel() protected abstract IReadOnlyList CreateSections(); - [BackgroundDependencyLoader(true)] + [BackgroundDependencyLoader] private void load(ILyricEditorState state, LyricEditorColourProvider colourProvider, AudioManager audio) { bindableMode.BindTo(state.BindableMode); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/SpecialActionToolbar.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/SpecialActionToolbar.cs index 19f1870e6..aa99a9692 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/SpecialActionToolbar.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/SpecialActionToolbar.cs @@ -54,7 +54,7 @@ public SpecialActionToolbar() }; } - [BackgroundDependencyLoader(true)] + [BackgroundDependencyLoader] private void load(ILyricEditorState state, LyricEditorColourProvider colourProvider) { bindableModeAndSubMode.BindTo(state.BindableModeAndSubMode); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/Toolbar/Separator.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/Toolbar/Separator.cs index 2b8d2a8fd..df7e024d9 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/Toolbar/Separator.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/Toolbar/Separator.cs @@ -25,7 +25,7 @@ public Separator() }; } - [BackgroundDependencyLoader(true)] + [BackgroundDependencyLoader] private void load(ILyricEditorState state, LyricEditorColourProvider colourProvider) { bindableMode.BindValueChanged(x => diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorVerifier.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorVerifier.cs index bbe701179..af34859fa 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorVerifier.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorVerifier.cs @@ -72,7 +72,7 @@ protected override void LoadComplete() recalculateIssues(); } - [BackgroundDependencyLoader(true)] + [BackgroundDependencyLoader] private void load(KaraokeRulesetEditCheckerConfigManager? rulesetEditCheckerConfigManager) { // todo: adjust the config in the config. diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/DragFile/Components/DrawableDragFile.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/DragFile/Components/DrawableDragFile.cs index 105690fb1..fa8ec7ac1 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/DragFile/Components/DrawableDragFile.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/DragFile/Components/DrawableDragFile.cs @@ -26,7 +26,7 @@ public partial class DrawableDragFile : Container private RoundedButton importButton; - [BackgroundDependencyLoader(true)] + [BackgroundDependencyLoader] private void load(OsuColour colours) { Masking = true; From 74e068ebd388147f279bbd97bedbf9eac44dc7b5 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Tue, 9 May 2023 22:11:24 +0800 Subject: [PATCH 2/5] Remove un-need injection. Or remove the [NotNull] attribute. --- .../Objects/Drawables/DrawableKaraokeScrollingHitObject.cs | 5 ++--- .../Screens/Edit/Beatmaps/Lyrics/Compose/LyricComposer.cs | 4 ++-- .../Screens/Edit/Beatmaps/Singers/Rows/LyricPlacementRow.cs | 6 ++---- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableKaraokeScrollingHitObject.cs b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableKaraokeScrollingHitObject.cs index 0f37bd72c..14654ebe0 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableKaraokeScrollingHitObject.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableKaraokeScrollingHitObject.cs @@ -3,7 +3,6 @@ #nullable disable -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -23,8 +22,8 @@ protected DrawableKaraokeScrollingHitObject(KaraokeHitObject hitObject) { } - [BackgroundDependencyLoader(true)] - private void load([NotNull] IScrollingInfo scrollingInfo) + [BackgroundDependencyLoader] + private void load(IScrollingInfo scrollingInfo) { Direction.BindTo(scrollingInfo.Direction); Direction.BindValueChanged(OnDirectionChanged, true); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/LyricComposer.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/LyricComposer.cs index 981470dc2..9703b1845 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/LyricComposer.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Compose/LyricComposer.cs @@ -152,8 +152,8 @@ public LyricComposer() } } - [BackgroundDependencyLoader(true)] - private void load(KaraokeRulesetLyricEditorConfigManager lyricEditorConfigManager, ILyricEditorState state, ITimeTagModeState timeTagModeState) + [BackgroundDependencyLoader] + private void load(KaraokeRulesetLyricEditorConfigManager lyricEditorConfigManager, ILyricEditorState state) { lyricEditorConfigManager.BindWith(KaraokeRulesetLyricEditorSetting.ShowPropertyPanelInComposer, panelStatus[PanelType.Property]); lyricEditorConfigManager.BindWith(KaraokeRulesetLyricEditorSetting.ShowInvalidInfoInComposer, panelStatus[PanelType.InvalidInfo]); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/Rows/LyricPlacementRow.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/Rows/LyricPlacementRow.cs index 12c697430..674cdd5d8 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/Rows/LyricPlacementRow.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/Rows/LyricPlacementRow.cs @@ -3,14 +3,12 @@ #nullable disable -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Overlays; using osu.Game.Rulesets.Karaoke.Beatmaps.Metadatas; -using osu.Game.Rulesets.Karaoke.Edit; namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Singers.Rows; @@ -25,8 +23,8 @@ protected LyricPlacementColumn(Singer singer) this.singer = singer; } - [BackgroundDependencyLoader(true)] - private void load(OverlayColourProvider colourProvider, [CanBeNull] KaraokeHitObjectComposer composer) + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) { InternalChildren = new Drawable[] { From 68d49e11856538baa630d913e50aec7475e0b89f Mon Sep 17 00:00:00 2001 From: andy840119 Date: Tue, 9 May 2023 22:13:04 +0800 Subject: [PATCH 3/5] Mark the params as nullable. --- osu.Game.Rulesets.Karaoke/UI/NotePlayfield.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/UI/NotePlayfield.cs b/osu.Game.Rulesets.Karaoke/UI/NotePlayfield.cs index 55c14165b..50e2ae589 100644 --- a/osu.Game.Rulesets.Karaoke/UI/NotePlayfield.cs +++ b/osu.Game.Rulesets.Karaoke/UI/NotePlayfield.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System.Linq; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -211,8 +210,8 @@ internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result explosion.Delay(200).Expire(true); } - [BackgroundDependencyLoader(true)] - private void load([CanBeNull] KaraokeSessionStatics session) + [BackgroundDependencyLoader] + private void load(KaraokeSessionStatics? session) { session?.BindWith(KaraokeRulesetSession.ScoringPitch, scoringPitch); From a4d2edb4a87048a0d7680b0987638581e90b6664 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Tue, 9 May 2023 22:20:16 +0800 Subject: [PATCH 4/5] Remove un-need using. --- .../Overlays/Changelog/Sidebar/ChangelogSection.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke/Overlays/Changelog/Sidebar/ChangelogSection.cs b/osu.Game.Rulesets.Karaoke/Overlays/Changelog/Sidebar/ChangelogSection.cs index 370f4b59a..238e975bf 100644 --- a/osu.Game.Rulesets.Karaoke/Overlays/Changelog/Sidebar/ChangelogSection.cs +++ b/osu.Game.Rulesets.Karaoke/Overlays/Changelog/Sidebar/ChangelogSection.cs @@ -11,7 +11,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Platform; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Overlays; From df0c361513144c8f210b438852658b4cd9cf8cdf Mon Sep 17 00:00:00 2001 From: andy840119 Date: Tue, 9 May 2023 23:51:30 +0800 Subject: [PATCH 5/5] Fix the test case broken. --- osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs b/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs index ce043ae24..9c8f315be 100644 --- a/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs +++ b/osu.Game.Rulesets.Karaoke/KaraokeInputManager.cs @@ -1,8 +1,6 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -34,10 +32,10 @@ public KaraokeInputManager(RulesetInfo ruleset) UseParentInput = false; } - private IBeatmap beatmap; + private IBeatmap beatmap = null!; [BackgroundDependencyLoader] - private void load(KaraokeRulesetConfigManager config, IBindable> mods, IBindable beatmap, KaraokeSessionStatics session, EditorBeatmap editorBeatmap) + private void load(KaraokeRulesetConfigManager config, IBindable> mods, IBindable beatmap, KaraokeSessionStatics session, EditorBeatmap? editorBeatmap) { if (editorBeatmap != null) {