From 81ccd62be0230b426ec97e541b55a3cabcab945d Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 10 May 2023 00:54:34 +0800 Subject: [PATCH 1/5] Remove the nullable disable annotation in the preview namespace. --- .../Screens/Settings/Previews/DefaultPreview.cs | 2 -- .../Settings/Previews/Gameplay/LyricPreview.cs | 6 ++---- .../Previews/Gameplay/NotePlayfieldPreview.cs | 2 -- .../Previews/Gameplay/ShowCursorPreview.cs | 2 -- .../Previews/Graphics/ManageFontPreview.cs | 14 ++++++-------- .../Previews/Input/MicrophoneDevicePreview.cs | 2 -- .../Settings/Previews/SettingsSubsectionPreview.cs | 2 -- .../Settings/Previews/UnderConstructionPreview.cs | 2 -- 8 files changed, 8 insertions(+), 24 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/DefaultPreview.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/DefaultPreview.cs index 81a4cb2d3..ef9aeeb77 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/DefaultPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/DefaultPreview.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 osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs index 7f5977a42..7c655566f 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/LyricPreview.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.Collections.Generic; using System.Globalization; using osu.Framework.Allocation; @@ -31,9 +29,9 @@ public partial class LyricPreview : SettingsSubsectionPreview private readonly Bindable preferLanguage = new(); [Resolved] - private FontStore fontStore { get; set; } + private FontStore fontStore { get; set; } = null!; - private KaraokeLocalFontStore localFontStore; + private KaraokeLocalFontStore localFontStore = null!; private readonly DrawableLyric drawableLyric; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/NotePlayfieldPreview.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/NotePlayfieldPreview.cs index 84906d4e0..83194e425 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/NotePlayfieldPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/NotePlayfieldPreview.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.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/ShowCursorPreview.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/ShowCursorPreview.cs index 18a671733..d2933b8fc 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/ShowCursorPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Gameplay/ShowCursorPreview.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 osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Graphics/ManageFontPreview.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Graphics/ManageFontPreview.cs index 55b05b195..200b11d82 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Graphics/ManageFontPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Graphics/ManageFontPreview.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; @@ -36,11 +34,11 @@ public ManageFontPreview() ShowBackground = false; } - private EggContainer eggContainer; - private FillFlowContainer textContainer; + private EggContainer eggContainer = null!; + private FillFlowContainer textContainer = null!; [BackgroundDependencyLoader] - private void load(TextureStore textures, OsuColour colours) + private void load(OsuColour colours) { Children = new Drawable[] { @@ -126,7 +124,7 @@ private void load(TextureStore textures, OsuColour colours) return ("Eggs/camp-tent", 0.5f, 50); default: - return (null, 0, 0); + return (string.Empty, 0, 0); } } }; @@ -168,7 +166,7 @@ public partial class GenerateRowContainer : BeatSyncedContainer private readonly GenerateDirection direction; - public Action ClickedText; + public Action? ClickedText; public GenerateRowContainer(GenerateDirection direction) { @@ -268,7 +266,7 @@ static Colour4 getRandomColour() public partial class EggContainer : BeatSyncedContainer { [Resolved] - private TextureStore textures { get; set; } + private TextureStore textures { get; set; } = null!; public void GenerateEgg(string textureName, float scale, float yOffset) { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Input/MicrophoneDevicePreview.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Input/MicrophoneDevicePreview.cs index 35222293b..b9743c0ec 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Input/MicrophoneDevicePreview.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/Input/MicrophoneDevicePreview.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.Linq; using ManagedBass; using osu.Framework.Allocation; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/SettingsSubsectionPreview.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/SettingsSubsectionPreview.cs index 33cec6bce..e57d98a55 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/SettingsSubsectionPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/SettingsSubsectionPreview.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 osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/UnderConstructionPreview.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/UnderConstructionPreview.cs index 375fcfa07..4c3389a3f 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/UnderConstructionPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Previews/UnderConstructionPreview.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 osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; From 516d0073717e4df27d26807df6567fe5399e53a8 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 10 May 2023 00:55:58 +0800 Subject: [PATCH 2/5] Remove the nullable disable annotation in the section namespace. --- .../Screens/Settings/Sections/ConfigSection.cs | 2 -- .../Screens/Settings/Sections/Gameplay/GeneralSettings.cs | 2 -- .../Screens/Settings/Sections/Gameplay/LyricSettings.cs | 2 -- .../Screens/Settings/Sections/Gameplay/NoteSettings.cs | 2 -- .../Screens/Settings/Sections/Gameplay/ScoringSettings.cs | 2 -- .../Screens/Settings/Sections/Gameplay/TranslateSettings.cs | 2 -- .../Screens/Settings/Sections/Graphics/LyricFontSettings.cs | 2 -- .../Screens/Settings/Sections/Graphics/ManageFontSettings.cs | 2 -- .../Screens/Settings/Sections/Graphics/NoteFontSettings.cs | 2 -- .../Screens/Settings/Sections/Graphics/TransparentSettings.cs | 2 -- .../Screens/Settings/Sections/Input/MicrophoneSettings.cs | 2 -- .../Screens/Settings/Sections/ScoringSection.cs | 2 -- .../Screens/Settings/Sections/StyleSection.cs | 2 -- 13 files changed, 26 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ConfigSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ConfigSection.cs index 3591c79b1..fb8ebadcc 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ConfigSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ConfigSection.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 osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/GeneralSettings.cs index 943f25470..67589c2ea 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/GeneralSettings.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 osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Game.Overlays.Settings; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/LyricSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/LyricSettings.cs index 5a36d056b..72c4fe71b 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/LyricSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/LyricSettings.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 osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Game.Overlays.Settings; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/NoteSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/NoteSettings.cs index 1b46b1725..e7e2b424d 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/NoteSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/NoteSettings.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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/ScoringSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/ScoringSettings.cs index a66f49578..40b026e9c 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/ScoringSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/ScoringSettings.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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslateSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslateSettings.cs index 8ae898ec9..dcea58001 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslateSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Gameplay/TranslateSettings.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.Globalization; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.cs index 14da5efe1..dcd781730 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/LyricFontSettings.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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/ManageFontSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/ManageFontSettings.cs index 117739b4a..25043395a 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/ManageFontSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/ManageFontSettings.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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/NoteFontSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/NoteFontSettings.cs index 1bdc9dcde..bb9b6cc4c 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/NoteFontSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/NoteFontSettings.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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/TransparentSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/TransparentSettings.cs index eb730a565..01545fce2 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/TransparentSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Graphics/TransparentSettings.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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Input/MicrophoneSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Input/MicrophoneSettings.cs index daadb3df4..bcc09f074 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Input/MicrophoneSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/Input/MicrophoneSettings.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 osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Localisation; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ScoringSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ScoringSection.cs index 68778ec36..8fb02e66b 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ScoringSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/ScoringSection.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 osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/StyleSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/StyleSection.cs index e7c779689..206ef41e6 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/StyleSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Sections/StyleSection.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 osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; From 14dab6c69b21e8fad6ef4ff2b60dc6cc99a9f4fe Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 10 May 2023 01:01:57 +0800 Subject: [PATCH 3/5] Remove nullable disable annotation in the settings namespace. --- osu.Game.Rulesets.Karaoke/Screens/Settings/Header.cs | 4 +--- .../Screens/Settings/KaraokeSettings.cs | 4 +--- .../Screens/Settings/KaraokeSettingsColourProvider.cs | 2 -- .../Screens/Settings/KaraokeSettingsPanel.cs | 6 ++---- .../Screens/Settings/KaraokeSettingsSection.cs | 2 -- .../Screens/Settings/KaraokeSettingsSubsection.cs | 6 ++---- .../Screens/Settings/KaraokeVersionManager.cs | 2 -- osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsFont.cs | 4 +--- .../Screens/Settings/SettingsLanguage.cs | 2 -- .../Screens/Settings/SettingsMicrophoneDeviceDropdown.cs | 2 -- 10 files changed, 7 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/Header.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/Header.cs index 2c44c5d40..0adf071d9 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/Header.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/Header.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.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -25,7 +23,7 @@ public partial class Header : Container public const float HEIGHT = 75; [Resolved] - private KaraokeSettingsColourProvider colourProvider { get; set; } + private KaraokeSettingsColourProvider colourProvider { get; set; } = null!; private readonly Box background; private readonly KaraokeConfigHeaderTitle title; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettings.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettings.cs index 77a5bf993..5bd8b0160 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettings.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettings.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 osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; @@ -31,7 +29,7 @@ public partial class KaraokeSettings : OsuScreen private Bindable selectedSection = new(); [Cached] - private Bindable selectedSubsection = new(); + private Bindable selectedSubsection = new(); private readonly KaraokeConfigWaveContainer waves; private readonly Box background; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsColourProvider.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsColourProvider.cs index 50e3b4c40..102507024 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsColourProvider.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsColourProvider.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 osu.Game.Overlays.Settings; using osu.Game.Rulesets.Karaoke.Screens.Settings.Sections; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsPanel.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsPanel.cs index 0f9dee65e..b50102f6c 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsPanel.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsPanel.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.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -25,7 +23,7 @@ public partial class KaraokeSettingsPanel : SettingsPanel { public new const float WIDTH = 300; - private Box hoverBackground; + private Box hoverBackground = null!; protected override IEnumerable CreateSections() => new SettingsSection[] { @@ -75,7 +73,7 @@ public void ScrollToSection(SettingsSection settingsSection) public IReadOnlyList Sections => SectionsContainer.Children; [BackgroundDependencyLoader] - private void load(KaraokeSettingsColourProvider colourProvider, Bindable selectedSection, Bindable selectedSubsection) + private void load(KaraokeSettingsColourProvider colourProvider, Bindable selectedSection, Bindable selectedSubsection) { initialSelectionContainer(); initialContentContainer(); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsSection.cs index 46eeb3c64..4c8827e4d 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsSection.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.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsSubsection.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsSubsection.cs index 98610a567..a829ab3f2 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsSubsection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeSettingsSubsection.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 osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Input.Events; @@ -15,10 +13,10 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Settings; public abstract partial class KaraokeSettingsSubsection : SettingsSubsection { [Resolved] - protected KaraokeRulesetConfigManager Config { get; private set; } + protected KaraokeRulesetConfigManager Config { get; private set; } = null!; [Resolved] - private Bindable selectedSubsection { get; set; } + private Bindable selectedSubsection { get; set; } = null!; public virtual SettingsSubsectionPreview CreatePreview() => new UnderConstructionPreview(); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeVersionManager.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeVersionManager.cs index 3abafbaed..b4d49d616 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeVersionManager.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/KaraokeVersionManager.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 osu.Framework.Allocation; using osu.Framework.Development; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsFont.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsFont.cs index 60513f13f..aa52df0ed 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsFont.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsFont.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.Linq; using osu.Framework.Bindables; using osu.Framework.Extensions; @@ -32,7 +30,7 @@ private partial class FontSelectionButton : CompositeDrawable, IHasCurrentValue< private const float height = 30; private readonly BindableWithCurrent current = new(); - private BindableFontUsage bindableFontUsage; + private BindableFontUsage? bindableFontUsage; private readonly GridContainer grid; private readonly SettingsButton fontButton; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsLanguage.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsLanguage.cs index 0ed8dcee7..94066d93b 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsLanguage.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsLanguage.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.Globalization; using osu.Framework.Bindables; using osu.Framework.Extensions; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsMicrophoneDeviceDropdown.cs b/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsMicrophoneDeviceDropdown.cs index 2100b93f7..05822f016 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsMicrophoneDeviceDropdown.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Settings/SettingsMicrophoneDeviceDropdown.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.Collections.Generic; using System.Linq; using osu.Framework.Allocation; From 7679d745cbcd4c96d9ca5921063eb6ecd59d78b9 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 10 May 2023 01:02:12 +0800 Subject: [PATCH 4/5] Should always able to get the karaoke ruleset. --- osu.Game.Rulesets.Karaoke/Extensions/OsuGameExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Extensions/OsuGameExtensions.cs b/osu.Game.Rulesets.Karaoke/Extensions/OsuGameExtensions.cs index 8d2924168..f2b32300e 100644 --- a/osu.Game.Rulesets.Karaoke/Extensions/OsuGameExtensions.cs +++ b/osu.Game.Rulesets.Karaoke/Extensions/OsuGameExtensions.cs @@ -15,10 +15,10 @@ namespace osu.Game.Rulesets.Karaoke.Extensions; /// public static class OsuGameExtensions { - public static KaraokeRuleset? GetRuleset(this DependencyContainer dependencies) + public static KaraokeRuleset GetRuleset(this DependencyContainer dependencies) { var rulesets = dependencies.Get().AvailableRulesets.Select(info => info.CreateInstance()); - return rulesets.FirstOrDefault(r => r is KaraokeRuleset) as KaraokeRuleset; + return rulesets.OfType().First(); } private static Container? getBasePlacementContainer(this OsuGame game) From e8ab0962dadc8db016cae839e4df8d1a7bf628e6 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 10 May 2023 01:02:33 +0800 Subject: [PATCH 5/5] Default value should not be null now. Use empty string instead. --- osu.Game.Rulesets.Karaoke/UI/KaraokeSettingsSubsection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke/UI/KaraokeSettingsSubsection.cs b/osu.Game.Rulesets.Karaoke/UI/KaraokeSettingsSubsection.cs index f064818bb..a2b7a814b 100644 --- a/osu.Game.Rulesets.Karaoke/UI/KaraokeSettingsSubsection.cs +++ b/osu.Game.Rulesets.Karaoke/UI/KaraokeSettingsSubsection.cs @@ -73,7 +73,7 @@ private void load() // Device new SettingsMicrophoneDeviceDropdown { - ClassicDefault = null, + ClassicDefault = string.Empty, LabelText = KaraokeSettingsSubsectionStrings.MicrophoneDevice, Current = config.GetBindable(KaraokeRulesetSetting.MicrophoneDevice) },