diff --git a/.editorconfig b/.editorconfig
index 548de8100..b3ec28437 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -9,6 +9,9 @@ indent_style = space
indent_size = 2
trim_trailing_whitespace = true
+[g_*.cs]
+generated_code = true
+
[*.cs]
end_of_line = crlf
insert_final_newline = true
@@ -194,6 +197,9 @@ csharp_style_prefer_switch_expression = false:none
#Style - C# 10 features
csharp_style_namespace_declarations = file_scoped:suggestion
+#Style - C# 12 features
+csharp_style_prefer_primary_constructors = false
+
[*.{yaml,yml}]
insert_final_newline = true
indent_style = space
diff --git a/osu.Game.Rulesets.Karaoke.Tests/Integration/Formats/KarDecoderTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Integration/Formats/KarDecoderTest.cs
index 845b8339d..01fdec528 100644
--- a/osu.Game.Rulesets.Karaoke.Tests/Integration/Formats/KarDecoderTest.cs
+++ b/osu.Game.Rulesets.Karaoke.Tests/Integration/Formats/KarDecoderTest.cs
@@ -30,11 +30,11 @@ public void TestLyricTimeTag(string text, string[] timeTags)
{
// Get first lyric from beatmap
var lyrics = new KarDecoder().Decode(text);
- var lyric = lyrics.FirstOrDefault()!;
+ var lyric = lyrics.First();
// Check time tag
var expected = TestCaseTagHelper.ParseTimeTags(timeTags);
- var actual = lyric?.TimeTags ?? throw new ArgumentNullException(nameof(lyric));
+ var actual = lyric.TimeTags;
TimeTagAssert.ArePropertyEqual(expected, actual);
}
diff --git a/osu.Game.Rulesets.Karaoke.Tests/Integration/Formats/LrcEncoderTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Integration/Formats/LrcEncoderTest.cs
index 9215c99a4..579ded27b 100644
--- a/osu.Game.Rulesets.Karaoke.Tests/Integration/Formats/LrcEncoderTest.cs
+++ b/osu.Game.Rulesets.Karaoke.Tests/Integration/Formats/LrcEncoderTest.cs
@@ -30,11 +30,11 @@ public void TestLyricTimeTag(string text, string[] timeTags)
{
// Get first lyric from beatmap
var lyrics = new LrcDecoder().Decode(text);
- var lyric = lyrics.FirstOrDefault()!;
+ var lyric = lyrics.First();
// Check time tag
var expected = TestCaseTagHelper.ParseTimeTags(timeTags);
- var actual = lyric?.TimeTags ?? throw new ArgumentNullException(nameof(lyric));
+ var actual = lyric.TimeTags;
TimeTagAssert.ArePropertyEqual(expected, actual);
}
diff --git a/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneDrawableJudgement.cs b/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneDrawableJudgement.cs
index 13f466743..e41f3c703 100644
--- a/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneDrawableJudgement.cs
+++ b/osu.Game.Rulesets.Karaoke.Tests/Skinning/TestSceneDrawableJudgement.cs
@@ -6,7 +6,6 @@
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
-using osu.Game.Rulesets.Karaoke.Objects.Drawables;
using osu.Game.Rulesets.Karaoke.UI;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring;
diff --git a/osu.Game.Rulesets.Karaoke.sln.DotSettings b/osu.Game.Rulesets.Karaoke.sln.DotSettings
index 52f77b9ec..8f0692533 100644
--- a/osu.Game.Rulesets.Karaoke.sln.DotSettings
+++ b/osu.Game.Rulesets.Karaoke.sln.DotSettings
@@ -776,9 +776,19 @@ See the LICENCE file in the repository root for full licence text.
<Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /></Policy>
+ <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="Constant fields (private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /></Policy>
+ <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Type parameters"><ElementKinds><Kind Name="TYPE_PARAMETER" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy>
+ <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"><ExtraRule Prefix="_" Suffix="" Style="aaBb" /></Policy></Policy>
+ <Policy><Descriptor Staticness="Any" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Constant fields (not private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></Policy>
+ <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Local functions"><ElementKinds><Kind Name="LOCAL_FUNCTION" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Enum members"><ElementKinds><Kind Name="ENUM_MEMBER" /></ElementKinds></Descriptor><Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /></Policy>
<Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private" Description="private methods"><ElementKinds><Kind Name="ASYNC_METHOD" /><Kind Name="METHOD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
<Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Protected, ProtectedInternal, Internal, Public" Description="internal/protected/public methods"><ElementKinds><Kind Name="ASYNC_METHOD" /><Kind Name="METHOD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy>
<Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Private" Description="private properties"><ElementKinds><Kind Name="PROPERTY" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Local constants"><ElementKinds><Kind Name="LOCAL_CONSTANT" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" /></Policy>
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static readonly fields (not private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></Policy>
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
<Policy><Descriptor Staticness="Static, Instance" AccessRightKinds="Protected, ProtectedInternal, Internal, Public" Description="internal/protected/public properties"><ElementKinds><Kind Name="PROPERTY" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy>
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
@@ -843,6 +853,7 @@ See the LICENCE file in the repository root for full licence text.
True
True
True
+ True
TestFolder
True
True
diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs
index f631e52a1..7ad6ea0fe 100644
--- a/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs
+++ b/osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs
@@ -29,19 +29,17 @@ public override void PreProcess()
base.PreProcess();
applyInvalidProperty(karaokeBeatmap);
+ return;
- static KaraokeBeatmap getKaraokeBeatmap(IBeatmap beatmap)
- {
- // goes to there while parsing the beatmap.
- if (beatmap is KaraokeBeatmap karaokeBeatmap)
- return karaokeBeatmap;
-
- // goes to there while editing the beatmap.
- if (beatmap is EditorBeatmap editorBeatmap)
- return getKaraokeBeatmap(editorBeatmap.PlayableBeatmap);
-
- throw new InvalidCastException($"The beatmap is not a {nameof(KaraokeBeatmap)}");
- }
+ static KaraokeBeatmap getKaraokeBeatmap(IBeatmap beatmap) =>
+ beatmap switch
+ {
+ // goes to there while parsing the beatmap.
+ KaraokeBeatmap karaokeBeatmap => karaokeBeatmap,
+ // goes to there while editing the beatmap.
+ EditorBeatmap editorBeatmap => getKaraokeBeatmap(editorBeatmap.PlayableBeatmap),
+ _ => throw new InvalidCastException($"The beatmap is not a {nameof(KaraokeBeatmap)}"),
+ };
}
private void applyStage(KaraokeBeatmap beatmap)
diff --git a/osu.Game.Rulesets.Karaoke/Edit/Debugging/DebugBeatmapManager.cs b/osu.Game.Rulesets.Karaoke/Edit/Debugging/DebugBeatmapManager.cs
index ffeeceea9..57587c572 100644
--- a/osu.Game.Rulesets.Karaoke/Edit/Debugging/DebugBeatmapManager.cs
+++ b/osu.Game.Rulesets.Karaoke/Edit/Debugging/DebugBeatmapManager.cs
@@ -103,9 +103,7 @@ void addDifficultyToSet(BeatmapSetInfo targetBeatmapSet, IBeatmap newBeatmap)
private void save(BeatmapInfo beatmapInfo, IBeatmap beatmapContent)
{
// get realm from beatmapManager using reflection
- var realm = beatmapManager.GetType().GetProperty("Realm", BindingFlags.NonPublic | BindingFlags.Instance)?.GetValue(beatmapManager) as RealmAccess;
-
- if (realm == null)
+ if (beatmapManager.GetType().GetProperty("Realm", BindingFlags.NonPublic | BindingFlags.Instance)?.GetValue(beatmapManager) is not RealmAccess realm)
{
throw new InvalidOperationException();
}
diff --git a/osu.Game.Rulesets.Karaoke/Edit/Generator/Beatmaps/Pages/PageGenerator.cs b/osu.Game.Rulesets.Karaoke/Edit/Generator/Beatmaps/Pages/PageGenerator.cs
index 5d8739bb0..b9e6d7e4c 100644
--- a/osu.Game.Rulesets.Karaoke/Edit/Generator/Beatmaps/Pages/PageGenerator.cs
+++ b/osu.Game.Rulesets.Karaoke/Edit/Generator/Beatmaps/Pages/PageGenerator.cs
@@ -105,11 +105,11 @@ Page createReturnPage(double time)
}
}
- private struct LyricTimingInfo : IComparable
+ private readonly struct LyricTimingInfo : IComparable
{
- public double StartTime { get; set; }
+ public double StartTime { get; init; }
- public double EndTime { get; set; }
+ public double EndTime { get; init; }
public int CompareTo(LyricTimingInfo other)
{
diff --git a/osu.Game.Rulesets.Karaoke/Edit/Setup/Components/SingerDisplay.cs b/osu.Game.Rulesets.Karaoke/Edit/Setup/Components/SingerDisplay.cs
index 1f205ede5..629378b81 100644
--- a/osu.Game.Rulesets.Karaoke/Edit/Setup/Components/SingerDisplay.cs
+++ b/osu.Game.Rulesets.Karaoke/Edit/Setup/Components/SingerDisplay.cs
@@ -74,7 +74,7 @@ private partial class SingerCircle : OsuClickableContainer, IHasContextMenu, IHa
{
public Bindable Current { get; } = new();
- public Action? DeleteRequested { get; set; }
+ public Action? DeleteRequested { get; init; }
private readonly DrawableSingerAvatar singerAvatar;
diff --git a/osu.Game.Rulesets.Karaoke/Extensions/ListExtensions.cs b/osu.Game.Rulesets.Karaoke/Extensions/ListExtensions.cs
deleted file mode 100644
index 220ae0924..000000000
--- a/osu.Game.Rulesets.Karaoke/Extensions/ListExtensions.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) andy840119 . Licensed under the GPL Licence.
-// See the LICENCE file in the repository root for full licence text.
-
-using System.Collections.Generic;
-
-namespace osu.Game.Rulesets.Karaoke.Extensions;
-
-public static class ListExtensions
-{
- public static void AddRangeWithNullCheck(this List collection, IEnumerable? newValue)
- {
- if (newValue == null)
- return;
-
- collection.AddRange(newValue);
- }
-}
diff --git a/osu.Game.Rulesets.Karaoke/Mods/KaraokeModSnow.cs b/osu.Game.Rulesets.Karaoke/Mods/KaraokeModSnow.cs
index ad9c18c04..955a2ed73 100644
--- a/osu.Game.Rulesets.Karaoke/Mods/KaraokeModSnow.cs
+++ b/osu.Game.Rulesets.Karaoke/Mods/KaraokeModSnow.cs
@@ -126,9 +126,9 @@ protected override void Update()
///
private partial class SnowSprite : Circle
{
- public float HorizontalSpeed { get; set; }
+ public float HorizontalSpeed { get; init; }
- public double CreateTime { get; set; }
+ public double CreateTime { get; init; }
}
}
}
diff --git a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs
index b0783acf0..19ef1dcb9 100644
--- a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs
+++ b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs
@@ -6,6 +6,7 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
+using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
@@ -145,7 +146,7 @@ private void updateFontStyle()
if (CurrentSkin == null)
return;
- if (HitObject == null)
+ if (HitObject.IsNull())
return;
var lyricStyle = CurrentSkin.GetConfig(HitObject)?.Value;
@@ -157,7 +158,7 @@ private void updateLyricFontInfo()
if (CurrentSkin == null)
return;
- if (HitObject == null)
+ if (HitObject.IsNull())
return;
var lyricFontInfo = CurrentSkin.GetConfig(HitObject)?.Value;
@@ -216,8 +217,5 @@ public void ApplyToLyricPieces(Action action)
action?.Invoke(lyricPiece);
}
- public void ApplyToTranslationText(Action action)
- {
- action?.Invoke(translationText);
- }
+ public void ApplyToTranslationText(Action action) => action.Invoke(translationText);
}
diff --git a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs
index 4b3293827..f2e1c0ccd 100644
--- a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs
+++ b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs
@@ -5,6 +5,7 @@
using System.Diagnostics;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
+using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
@@ -117,7 +118,7 @@ protected override void ApplySkin(ISkinSource skin, bool allowFallback)
if (CurrentSkin == null)
return;
- if (HitObject == null)
+ if (HitObject.IsNull())
return;
var noteSkin = skin.GetConfig(HitObject)?.Value;
@@ -207,7 +208,7 @@ public void OnReleased(KeyBindingReleaseEvent e)
EndSing();
}
- public void ApplyToLyricText(Action action) => action?.Invoke(textPiece);
+ public void ApplyToLyricText(Action action) => action.Invoke(textPiece);
- public void ApplyToBackground(Action action) => action?.Invoke(background);
+ public void ApplyToBackground(Action action) => action.Invoke(background);
}
diff --git a/osu.Game.Rulesets.Karaoke/Objects/Utils/LyricsUtils.cs b/osu.Game.Rulesets.Karaoke/Objects/Utils/LyricsUtils.cs
index 26bd1e6f1..0727eedc2 100644
--- a/osu.Game.Rulesets.Karaoke/Objects/Utils/LyricsUtils.cs
+++ b/osu.Game.Rulesets.Karaoke/Objects/Utils/LyricsUtils.cs
@@ -7,7 +7,6 @@
using System.Linq;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Karaoke.Beatmaps;
-using osu.Game.Rulesets.Karaoke.Extensions;
namespace osu.Game.Rulesets.Karaoke.Objects.Utils;
@@ -83,19 +82,19 @@ public static Lyric CombineLyric(Lyric firstLyric, Lyric secondLyric)
string lyricText = firstLyric.Text + secondLyric.Text;
var timeTags = new List();
- timeTags.AddRangeWithNullCheck(firstLyric.TimeTags);
- timeTags.AddRangeWithNullCheck(shiftingTimeTag(secondLyric.TimeTags, offsetIndexForSecondLyric));
+ timeTags.AddRange(firstLyric.TimeTags);
+ timeTags.AddRange(shiftingTimeTag(secondLyric.TimeTags, offsetIndexForSecondLyric));
var rubyTags = new List();
- rubyTags.AddRangeWithNullCheck(firstLyric.RubyTags);
- rubyTags.AddRangeWithNullCheck(shiftingRubyTag(secondLyric.RubyTags, lyricText, offsetIndexForSecondLyric));
+ rubyTags.AddRange(firstLyric.RubyTags);
+ rubyTags.AddRange(shiftingRubyTag(secondLyric.RubyTags, lyricText, offsetIndexForSecondLyric));
double startTime = Math.Min(firstLyric.StartTime, secondLyric.StartTime);
double endTime = Math.Max(firstLyric.EndTime, secondLyric.EndTime);
var singers = new List();
- singers.AddRangeWithNullCheck(firstLyric.SingerIds);
- singers.AddRangeWithNullCheck(secondLyric.SingerIds);
+ singers.AddRange(firstLyric.SingerIds);
+ singers.AddRange(secondLyric.SingerIds);
bool sameLanguage = EqualityComparer.Default.Equals(firstLyric.Language, secondLyric.Language);
var language = sameLanguage ? firstLyric.Language : null;
diff --git a/osu.Game.Rulesets.Karaoke/Objects/Workings/LyricWorkingPropertyValidator.cs b/osu.Game.Rulesets.Karaoke/Objects/Workings/LyricWorkingPropertyValidator.cs
index 901f7ce30..115e1fd7a 100644
--- a/osu.Game.Rulesets.Karaoke/Objects/Workings/LyricWorkingPropertyValidator.cs
+++ b/osu.Game.Rulesets.Karaoke/Objects/Workings/LyricWorkingPropertyValidator.cs
@@ -31,13 +31,13 @@ protected override bool HasDataProperty(LyricWorkingProperty flags) =>
protected override bool IsWorkingPropertySynced(Lyric hitObject, LyricWorkingProperty flags) =>
flags switch
{
- LyricWorkingProperty.StartTime => true,
- LyricWorkingProperty.Duration => true,
- LyricWorkingProperty.Timing => true,
+ LyricWorkingProperty.StartTime => throw new InvalidOperationException(),
+ LyricWorkingProperty.Duration => throw new InvalidOperationException(),
+ LyricWorkingProperty.Timing => throw new InvalidOperationException(),
LyricWorkingProperty.Singers => isWorkingSingerSynced(hitObject),
- LyricWorkingProperty.Page => true,
+ LyricWorkingProperty.Page => throw new InvalidOperationException(),
LyricWorkingProperty.ReferenceLyric => isReferenceLyricSynced(hitObject),
- LyricWorkingProperty.EffectApplier => true,
+ LyricWorkingProperty.EffectApplier => throw new InvalidOperationException(),
_ => throw new ArgumentOutOfRangeException(nameof(flags), flags, null),
};
diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/FixedInfo/InvalidInfo.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/FixedInfo/InvalidInfo.cs
index bf06dcd50..4a42c0468 100644
--- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/FixedInfo/InvalidInfo.cs
+++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/FixedInfo/InvalidInfo.cs
@@ -56,31 +56,16 @@ private void load(OsuColour colours, ILyricEditorVerifier verifier)
var displayIssueType = issue.Template.Type;
var targetColour = issue.Template.Colour;
- switch (displayIssueType)
+ Icon = displayIssueType switch
{
- case IssueType.Problem:
- Icon = FontAwesome.Solid.TimesCircle;
- Colour = targetColour;
- break;
-
- case IssueType.Warning:
- Icon = FontAwesome.Solid.ExclamationCircle;
- Colour = targetColour;
- break;
-
- case IssueType.Error: // it's caused by internal error.
- Icon = FontAwesome.Solid.ExclamationTriangle;
- Colour = targetColour;
- break;
-
- case IssueType.Negligible:
- Icon = FontAwesome.Solid.InfoCircle;
- Colour = targetColour;
- break;
-
- default:
- throw new ArgumentOutOfRangeException();
- }
+ IssueType.Problem => FontAwesome.Solid.TimesCircle,
+ IssueType.Warning => FontAwesome.Solid.ExclamationCircle,
+ // it's caused by internal error.
+ IssueType.Error => FontAwesome.Solid.ExclamationTriangle,
+ IssueType.Negligible => FontAwesome.Solid.InfoCircle,
+ _ => throw new ArgumentOutOfRangeException(),
+ };
+ Colour = targetColour;
}, true);
}
diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/InteractableLyric.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/InteractableLyric.cs
index e8354ac92..484ae25fa 100644
--- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/InteractableLyric.cs
+++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Components/Lyrics/InteractableLyric.cs
@@ -25,7 +25,7 @@ public sealed partial class InteractableLyric : CompositeDrawable, IHasTooltip,
private readonly Lyric lyric;
private LocalisableString? lockReason;
- public Action? TextSizeChanged = null;
+ public Action? TextSizeChanged;
public InteractableLyric(Lyric lyric)
{
diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/LyricEditor.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/LyricEditor.cs
index c0a296640..061c2eda7 100644
--- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/LyricEditor.cs
+++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Content/Compose/LyricEditor.cs
@@ -254,7 +254,7 @@ protected override void OnHoverLost(HoverLostEvent e)
base.OnHoverLost(e);
}
- public Popover? GetPopover() => new DescriptionPopover();
+ public Popover GetPopover() => new DescriptionPopover();
private partial class DescriptionPopover : OsuPopover
{
diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Romanisation/Components/LabelledRomanisedTextBox.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Romanisation/Components/LabelledRomanisedTextBox.cs
index a7f2c40c0..e89ef7b41 100644
--- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Romanisation/Components/LabelledRomanisedTextBox.cs
+++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Romanisation/Components/LabelledRomanisedTextBox.cs
@@ -73,7 +73,7 @@ public LabelledRomanisedTextBox(Lyric lyric, TimeTag timeTag)
});
bindableRomanisationVersion.BindTo(lyric.TimeTagsRomanisationVersion);
- bindableRomanisationVersion.BindValueChanged((_) =>
+ bindableRomanisationVersion.BindValueChanged(_ =>
{
// change the label and the description.
updateLabel(lyric, timeTag);
diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/TapButton.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/TapButton.cs
index b7ea45a38..20032bc9b 100644
--- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/TapButton.cs
+++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/TapButton.cs
@@ -45,7 +45,7 @@ internal partial class TapButton : CircularContainer
private CircularContainer innerCircle = null!;
private Box innerCircleHighlight = null!;
- private int currentIndex = 0;
+ private int currentIndex;
private Container scaleContainer = null!;
private Container lights = null!;
@@ -389,7 +389,7 @@ private void load()
updateColour();
}
- private bool isTapped = false;
+ private bool isTapped;
public bool IsTapped
{
diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/States/LyricCaretState.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/States/LyricCaretState.cs
index f27c8457d..cefda0b74 100644
--- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/States/LyricCaretState.cs
+++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/States/LyricCaretState.cs
@@ -154,16 +154,14 @@ ICaretPositionAlgorithm getRubyTagModeAlgorithm() =>
_ => throw new InvalidOperationException(nameof(bindableRubyTagEditMode.Value)),
};
- ICaretPositionAlgorithm getTimeTagModeAlgorithm(TimeTagEditStep timeTagEditMode)
- {
- return timeTagEditMode switch
+ ICaretPositionAlgorithm getTimeTagModeAlgorithm(TimeTagEditStep timeTagEditMode) =>
+ timeTagEditMode switch
{
TimeTagEditStep.Create => new CreateRemoveTimeTagCaretPositionAlgorithm(lyrics),
TimeTagEditStep.Recording => new RecordingTimeTagCaretPositionAlgorithm(lyrics) { Mode = bindableRecordingMovingCaretMode.Value },
TimeTagEditStep.Adjust => new NavigateCaretPositionAlgorithm(lyrics),
_ => throw new InvalidOperationException(nameof(timeTagEditMode)),
};
- }
}
[BackgroundDependencyLoader]
diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/IssueSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/IssueSection.cs
index 8fed11b7d..6d8d212af 100644
--- a/osu.Game.Rulesets.Karaoke/Screens/Edit/IssueSection.cs
+++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/IssueSection.cs
@@ -316,7 +316,7 @@ public IssueCategory()
};
}
- public IssueType Type { get; set; }
+ public IssueType Type { get; init; }
public LocalisableString Text
{
diff --git a/osu.Game.Rulesets.Karaoke/Statistics/BeatmapMetadataGraph.cs b/osu.Game.Rulesets.Karaoke/Statistics/BeatmapMetadataGraph.cs
index 8bb311007..6b57c72bf 100644
--- a/osu.Game.Rulesets.Karaoke/Statistics/BeatmapMetadataGraph.cs
+++ b/osu.Game.Rulesets.Karaoke/Statistics/BeatmapMetadataGraph.cs
@@ -207,12 +207,12 @@ public SingerSpriteText()
};
}
- private Singer? singer;
+ private readonly Singer? singer;
public Singer? Singer
{
get => singer;
- set
+ init
{
singer = value;
osuSpriteText.Text = singer?.Name ?? "Known singer";
diff --git a/osu.Game.Rulesets.Karaoke/UI/PlayerSettings/ClickablePlayerSliderBar.cs b/osu.Game.Rulesets.Karaoke/UI/PlayerSettings/ClickablePlayerSliderBar.cs
index 83a8768ac..413d616b5 100644
--- a/osu.Game.Rulesets.Karaoke/UI/PlayerSettings/ClickablePlayerSliderBar.cs
+++ b/osu.Game.Rulesets.Karaoke/UI/PlayerSettings/ClickablePlayerSliderBar.cs
@@ -90,7 +90,7 @@ private void load(OsuColour colours)
private partial class ToolTipButton : OsuButton, IHasTooltip
{
- public LocalisableString TooltipText { get; set; }
+ public LocalisableString TooltipText { get; init; }
[BackgroundDependencyLoader]
private void load(OsuColour colours)