diff --git a/osu.Game.Rulesets.Karaoke.Tests/IO/Stores/BaseGlyphStoreTest.cs b/osu.Game.Rulesets.Karaoke.Tests/IO/Stores/BaseGlyphStoreTest.cs index 0a0e776bd..1e151bcba 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/IO/Stores/BaseGlyphStoreTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/IO/Stores/BaseGlyphStoreTest.cs @@ -22,7 +22,7 @@ public abstract class BaseGlyphStoreTest where TGlyphStore : IGlyph protected void OneTimeSetUp() { // create and load glyph store. - var fontResourceStore = new NamespacedResourceStore(TestResources.GetStore(), $"Resources.Testing.Fonts.Fnt.OpenSans"); + var fontResourceStore = new NamespacedResourceStore(TestResources.GetStore(), "Resources.Testing.Fonts.Fnt.OpenSans"); GlyphStore = new GlyphStore(fontResourceStore, FontName); GlyphStore.LoadFontAsync().Wait(); diff --git a/osu.Game.Rulesets.Karaoke.Tests/Overlays/TestSceneOverlayColourProvider.cs b/osu.Game.Rulesets.Karaoke.Tests/Overlays/TestSceneOverlayColourProvider.cs index 9cb13ece1..5424b29e1 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Overlays/TestSceneOverlayColourProvider.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Overlays/TestSceneOverlayColourProvider.cs @@ -1,6 +1,7 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; @@ -64,6 +65,23 @@ public void ShowWithNoFetch() Schedule(() => { + var columns = colourName.Select(c => new TitleTableColumn(c)).OfType().ToArray(); + var content = providers.Select(provider => + { + if (provider == null) + throw new ArgumentNullException(nameof(provider)); + + return colourName.Select(c => + { + var value = provider.GetType().GetProperty(c)?.GetValue(provider); + if (value == null) + throw new ArgumentNullException(nameof(value)); + + var colour = (Color4)value; + return new PreviewColourDrawable(colour); + }).OfType(); + }).To2DArray(); + Child = new OsuScrollContainer(Direction.Horizontal) { RelativeSizeAxes = Axes.Both, @@ -71,15 +89,8 @@ public void ShowWithNoFetch() { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, - Columns = colourName.Select(c => new TitleTableColumn(c)).ToArray(), - Content = providers.Select(p => - { - return colourName.Select(c => - { - var colour = (Color4)p.GetType().GetProperty(c).GetValue(p); - return new PreviewColourDrawable(colour); - }); - }).To2DArray(), + Columns = columns, + Content = content, } }; }); diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcDecoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcDecoder.cs index 7a974ee18..7e09c8c5b 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcDecoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcDecoder.cs @@ -19,7 +19,7 @@ public class LrcDecoder : Decoder public static void Register() { // Lrc decoder looks like [mm:ss:__] - AddDecoder("[", m => new LrcDecoder()); + AddDecoder("[", _ => new LrcDecoder()); } protected override void ParseStreamInto(LineBufferedReader stream, Beatmap output) diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/NicoKaraDecoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/NicoKaraDecoder.cs index a3fc19870..df5159141 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/NicoKaraDecoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/NicoKaraDecoder.cs @@ -27,7 +27,7 @@ public class NicoKaraDecoder : Decoder { public static void Register() { - AddDecoder(" new NicoKaraDecoder()); + AddDecoder(" new NicoKaraDecoder()); } protected override void ParseStreamInto(LineBufferedReader stream, KaraokeSkin output) diff --git a/osu.Game.Rulesets.Karaoke/Difficulty/KaraokePerformanceCalculator.cs b/osu.Game.Rulesets.Karaoke/Difficulty/KaraokePerformanceCalculator.cs index 85f16a951..f18bba2c0 100644 --- a/osu.Game.Rulesets.Karaoke/Difficulty/KaraokePerformanceCalculator.cs +++ b/osu.Game.Rulesets.Karaoke/Difficulty/KaraokePerformanceCalculator.cs @@ -45,9 +45,8 @@ public override double Calculate(Dictionary categoryDifficulty = IEnumerable scoreIncreaseMods = Ruleset.GetModsFor(ModType.DifficultyIncrease); - double scoreMultiplier = 1.0; - foreach (var m in mods.Where(m => !scoreIncreaseMods.Contains(m))) - scoreMultiplier *= m.ScoreMultiplier; + double scoreMultiplier = mods.Where(m => !scoreIncreaseMods.Contains(m)) + .Aggregate(1.0, (current, m) => current * m.ScoreMultiplier); // Scale score up, so it's comparable to other keymods scaledScore *= 1.0 / scoreMultiplier; diff --git a/osu.Game.Rulesets.Karaoke/Edit/Components/ContextMenu/LyricLockContextMenu.cs b/osu.Game.Rulesets.Karaoke/Edit/Components/ContextMenu/LyricLockContextMenu.cs index fc124ea30..d1f52f1fd 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Components/ContextMenu/LyricLockContextMenu.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Components/ContextMenu/LyricLockContextMenu.cs @@ -24,7 +24,7 @@ public LyricLockContextMenu(LyricManager manager, List lyrics, string nam Items = EnumUtils.GetValues().Select(l => new OsuMenuItem(l.ToString(), anyLyricInLockState(l) ? MenuItemType.Highlighted : MenuItemType.Standard, () => { // change all selected lyric state. - lyrics.ForEach(lyric => manager.LockLyrics(lyrics, l)); + manager.LockLyrics(lyrics, l); })).ToList(); bool anyLyricInLockState(LockState lockState) => lyrics.Any(lyric => lyric.Lock == lockState); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Components/Menu/AutoFocusToEditLyricMenu.cs b/osu.Game.Rulesets.Karaoke/Edit/Components/Menu/AutoFocusToEditLyricMenu.cs index dde207008..3bf634f7a 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Components/Menu/AutoFocusToEditLyricMenu.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Components/Menu/AutoFocusToEditLyricMenu.cs @@ -32,13 +32,13 @@ public AutoFocusToEditLyricMenu(KaraokeRulesetLyricEditorConfigManager config, s config.BindWith(KaraokeRulesetLyricEditorSetting.AutoFocusToEditLyricSkipRows, bindableAutoFocusToEditLyricSkipRows); // mark disable as selected option. - bindableAutoFocusToEditLyric.BindValueChanged(e => + bindableAutoFocusToEditLyric.BindValueChanged(_ => { updateSelectionState(); }, true); // mark line as selected option. - bindableAutoFocusToEditLyricSkipRows.BindValueChanged(e => + bindableAutoFocusToEditLyricSkipRows.BindValueChanged(_ => { updateSelectionState(); }, true); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Generator/TimeTags/Ja/JaTimeTagGenerator.cs b/osu.Game.Rulesets.Karaoke/Edit/Generator/TimeTags/Ja/JaTimeTagGenerator.cs index 56ef04997..c9eac85c2 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Generator/TimeTags/Ja/JaTimeTagGenerator.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Generator/TimeTags/Ja/JaTimeTagGenerator.cs @@ -34,7 +34,7 @@ protected override void TimeTagLogic(Lyric lyric, List timeTags) // add new time tags created from ruby var rubyTags = generateTimeTagByText(ruby.Text); - var shiftingTimeTags = rubyTags.Select((x, v) => new TimeTag(new TextIndex(ruby.StartIndex, x.Index.State), x.Time)); + var shiftingTimeTags = rubyTags.Select((x, _) => new TimeTag(new TextIndex(ruby.StartIndex, x.Index.State), x.Time)); timeTags.AddRange(shiftingTimeTags); } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/AssignLanguage/AssignLanguageSubScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/AssignLanguage/AssignLanguageSubScreen.cs index 6f4fba8c2..7e938f150 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/AssignLanguage/AssignLanguageSubScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/AssignLanguage/AssignLanguageSubScreen.cs @@ -36,7 +36,7 @@ protected override TopNavigation CreateNavigation() => new AssignLanguageNavigation(this); protected override Drawable CreateContent() - => base.CreateContent().With(x => + => base.CreateContent().With(_ => { LyricEditor.Mode = LyricEditorMode.Language; }); diff --git a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/DragFile/DragFileSubScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/DragFile/DragFileSubScreen.cs index 10ae4fadc..e3bc3114d 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/DragFile/DragFileSubScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/DragFile/DragFileSubScreen.cs @@ -174,7 +174,7 @@ private PopupDialog createUnknownExceptionDialog() }; private PopupDialog createCompleteDialog() - => new OkPopupDialog(ok => { Complete(); }) + => new OkPopupDialog(_ => { Complete(); }) { Icon = FontAwesome.Regular.CheckCircle, HeaderText = @"Import success", diff --git a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/EditLyric/EditLyricSubScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/EditLyric/EditLyricSubScreen.cs index cc54979ec..42859e0cc 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/EditLyric/EditLyricSubScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/EditLyric/EditLyricSubScreen.cs @@ -22,7 +22,7 @@ protected override TopNavigation CreateNavigation() => new EditLyricNavigation(this); protected override Drawable CreateContent() - => base.CreateContent().With(x => + => base.CreateContent().With(_ => { LyricEditor.Mode = LyricEditorMode.Manage; }); diff --git a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/GenerateRubyRomaji/GenerateRubyRomajiSubScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/GenerateRubyRomaji/GenerateRubyRomajiSubScreen.cs index 2e3908eaa..02fa4811b 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/GenerateRubyRomaji/GenerateRubyRomajiSubScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/GenerateRubyRomaji/GenerateRubyRomajiSubScreen.cs @@ -32,7 +32,7 @@ protected override TopNavigation CreateNavigation() => new GenerateRubyNavigation(this); protected override Drawable CreateContent() - => base.CreateContent().With(x => + => base.CreateContent().With(_ => { LyricEditor.Mode = LyricEditorMode.EditRomaji; }); diff --git a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/GenerateTimeTag/GenerateTimeTagSubScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/GenerateTimeTag/GenerateTimeTagSubScreen.cs index d3b9864dc..6bf4b085a 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/GenerateTimeTag/GenerateTimeTagSubScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/GenerateTimeTag/GenerateTimeTagSubScreen.cs @@ -22,7 +22,7 @@ protected override TopNavigation CreateNavigation() => new GenerateTimeTagNavigation(this); protected override Drawable CreateContent() - => base.CreateContent().With(x => + => base.CreateContent().With(_ => { LyricEditor.Mode = LyricEditorMode.CreateTimeTag; }); diff --git a/osu.Game.Rulesets.Karaoke/Edit/KaraokeSelectionHandler.cs b/osu.Game.Rulesets.Karaoke/Edit/KaraokeSelectionHandler.cs index ebab16ee2..debd063cc 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/KaraokeSelectionHandler.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/KaraokeSelectionHandler.cs @@ -147,15 +147,15 @@ private void performColumnMovement(Tone lastTone, MoveSelectionEvent var delta = centerPosition.Y - lastCenterPosition; // get delta tone. - var deltaTone = new Tone(); const float trigger_height = ScrollingNotePlayfield.COLUMN_SPACING + DefaultColumnBackground.COLUMN_HEIGHT; + var deltaTone = delta switch + { + > trigger_height => -new Tone { Half = true }, + < 0 => new Tone { Half = true }, + _ => default + }; - if (delta > trigger_height) - deltaTone = -new Tone { Half = true }; - else if (delta < 0) - deltaTone = new Tone { Half = true }; - - if (deltaTone == 0) + if (deltaTone == default(Tone)) return; foreach (var note in EditorBeatmap.SelectedHitObjects.OfType()) diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/ApplySelectingArea.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/ApplySelectingArea.cs index bb43295f2..8567b5546 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/ApplySelectingArea.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/ApplySelectingArea.cs @@ -122,7 +122,7 @@ private void load(OsuColour colours, LyricSelectionState lyricSelectionState) // get bindable and update bindable if select or not select all. selectedLyrics = lyricSelectionState.SelectedLyrics.GetBoundCopy(); - selectedLyrics.BindCollectionChanged((a, b) => + selectedLyrics.BindCollectionChanged((_, _) => { var selectAny = selectedLyrics.Any(); applyButton.Enabled.Value = selectAny; @@ -172,14 +172,14 @@ private void load(ILyricEditorState state, LyricSelectionState lyricSelectionSta selectedLyrics = lyricSelectionState.SelectedLyrics.GetBoundCopy(); // should update background if mode changed. - mode.BindValueChanged(e => + mode.BindValueChanged(_ => { background.Colour = colourProvider.Dark2(state.Mode); allSelectedCheckbox.AccentColour = colourProvider.Colour2(state.Mode); }, true); // should disable selection if current lyric is disabled. - disableSelectingLyrics.BindCollectionChanged((a, b) => + disableSelectingLyrics.BindCollectionChanged((_, _) => { var disabledLyricNumber = lyricSelectionState.DisableSelectingLyric.Count; var totalLyrics = beatmap.HitObjects.OfType().Count(); @@ -190,7 +190,7 @@ private void load(ILyricEditorState state, LyricSelectionState lyricSelectionSta }); // get bindable and update bindable if select or not select all. - selectedLyrics.BindCollectionChanged((a, b) => + selectedLyrics.BindCollectionChanged((_, _) => { if (checkboxClicking) return; diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/DrawableLyricEditListItem.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/DrawableLyricEditListItem.cs index 83d0f7657..055007f48 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/DrawableLyricEditListItem.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/DrawableLyricEditListItem.cs @@ -45,7 +45,7 @@ public DrawableLyricEditListItem(Lyric item) removeExtend(); }, true); - bindableHoverCaretPosition.BindValueChanged(e => + bindableHoverCaretPosition.BindValueChanged(_ => { updateBackgroundColour(); }); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Languages/LanguageAutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Languages/LanguageAutoGenerateSection.cs index 9f52b03c4..3e22b7c9b 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Languages/LanguageAutoGenerateSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Languages/LanguageAutoGenerateSection.cs @@ -16,7 +16,7 @@ public class LanguageAutoGenerateSection : AutoGenerateSection protected override Dictionary GetDisableSelectingLyrics(Lyric[] lyrics) => lyrics.Where(x => string.IsNullOrEmpty(x.Text)) - .ToDictionary(k => k, i => "Should have text in lyric."); + .ToDictionary(k => k, _ => "Should have text in lyric."); protected override void Apply(Lyric[] lyrics) => lyricManager.AutoDetectLyricLanguage(lyrics); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Languages/LanguageMissingSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Languages/LanguageMissingSection.cs index 24292b939..27b25ffbb 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Languages/LanguageMissingSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Languages/LanguageMissingSection.cs @@ -38,7 +38,7 @@ private void load(LyricCheckerManager lyricCheckerManager) }; bindableReports = lyricCheckerManager.BindableReports.GetBoundCopy(); - bindableReports.BindCollectionChanged((a, b) => + bindableReports.BindCollectionChanged((_, _) => { var issues = bindableReports.Values.SelectMany(x => x); table.Issues = issues.Where(x => x.Template is CheckInvalidPropertyLyrics.IssueTemplateNotFillLanguage); @@ -60,13 +60,13 @@ public IEnumerable Issues if (value == null) return; - Content = value.Select((g, i) => + Content = value.Select((g, _) => { var lyric = g.HitObjects.FirstOrDefault() as Lyric; return createContent(lyric); }).ToArray().ToRectangular(); - BackgroundFlow.Children = value.Select((g, i) => + BackgroundFlow.Children = value.Select((g, _) => { var lyric = g.HitObjects.FirstOrDefault() as Lyric; return new LyricLanguageRowBackground(lyric); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Notes/NoteAutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Notes/NoteAutoGenerateSection.cs index bdce0b2a8..64a431f93 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Notes/NoteAutoGenerateSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Notes/NoteAutoGenerateSection.cs @@ -27,7 +27,7 @@ public class NoteAutoGenerateSection : AutoGenerateSection protected override Dictionary GetDisableSelectingLyrics(Lyric[] lyrics) => lyricCheckerManager.BindableReports.Where(x => x.Value.OfType().Any()) - .ToDictionary(k => k.Key, i => "Before generate time-tag, need to assign language first."); + .ToDictionary(k => k.Key, _ => "Before generate time-tag, need to assign language first."); protected override void Apply(Lyric[] lyrics) => noteManager.AutoGenerateNotes(lyrics); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/Components/LabelledTextTagTextBox.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/Components/LabelledTextTagTextBox.cs index 42d7d8619..bbe01ae2c 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/Components/LabelledTextTagTextBox.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/Components/LabelledTextTagTextBox.cs @@ -37,13 +37,13 @@ protected LabelledTextTagTextBox(T textTag) Component.Text = textTag.Text; // should change preview text box if selected ruby/romaji changed. - OnCommit += (sender, newText) => + OnCommit += (sender, _) => { textTag.Text = sender.Text; }; // change style if focus. - SelectedTextTag.BindCollectionChanged((e, a) => + SelectedTextTag.BindCollectionChanged((_, _) => { var highLight = SelectedTextTag.Contains(textTag); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RomajiTagAutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RomajiTagAutoGenerateSection.cs index 05cfc6663..78c1e4998 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RomajiTagAutoGenerateSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RomajiTagAutoGenerateSection.cs @@ -16,7 +16,7 @@ public class RomajiTagAutoGenerateSection : TextTagAutoGenerateSection protected override Dictionary GetDisableSelectingLyrics(Lyric[] lyrics) => lyrics.Where(x => x.Language == null) - .ToDictionary(k => k, i => "Before generate romaji-tag, need to assign language first."); + .ToDictionary(k => k, _ => "Before generate romaji-tag, need to assign language first."); protected override void Apply(Lyric[] lyrics) => rubyRomaji.AutoGenerateLyricRomaji(lyrics); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RomajiTagIssueSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RomajiTagIssueSection.cs index 068f610b8..2f271bed6 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RomajiTagIssueSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RomajiTagIssueSection.cs @@ -32,7 +32,7 @@ private void load(LyricCheckerManager lyricCheckerManager) }; bindableReports = lyricCheckerManager.BindableReports.GetBoundCopy(); - bindableReports.BindCollectionChanged((a, b) => + bindableReports.BindCollectionChanged((_, _) => { var issues = bindableReports.Values.SelectMany(x => x); table.Issues = issues.OfType(); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RubyTagAutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RubyTagAutoGenerateSection.cs index f8445dded..687d3330b 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RubyTagAutoGenerateSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RubyTagAutoGenerateSection.cs @@ -16,7 +16,7 @@ public class RubyTagAutoGenerateSection : TextTagAutoGenerateSection protected override Dictionary GetDisableSelectingLyrics(Lyric[] lyrics) => lyrics.Where(x => x.Language == null) - .ToDictionary(k => k, i => "Before generate ruby-tag, need to assign language first."); + .ToDictionary(k => k, _ => "Before generate ruby-tag, need to assign language first."); protected override void Apply(Lyric[] lyrics) => rubyRomaji.AutoGenerateLyricRuby(lyrics); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RubyTagIssueSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RubyTagIssueSection.cs index 8276911f3..075fe8207 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RubyTagIssueSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/RubyRomaji/RubyTagIssueSection.cs @@ -32,7 +32,7 @@ private void load(LyricCheckerManager lyricCheckerManager) }; bindableReports = lyricCheckerManager.BindableReports.GetBoundCopy(); - bindableReports.BindCollectionChanged((a, b) => + bindableReports.BindCollectionChanged((_, _) => { var issues = bindableReports.Values.SelectMany(x => x); table.Issues = issues.OfType(); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Singers/SingerEditSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Singers/SingerEditSection.cs index 18cf99444..7e312c2f8 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Singers/SingerEditSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/Singers/SingerEditSection.cs @@ -24,7 +24,7 @@ public class SingerEditSection : Section public SingerEditSection() { - singerIndexes.BindValueChanged(e => + singerIndexes.BindValueChanged(_ => { foreach (var singerLabel in Content.OfType()) { diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/TimeTags/TimeTagAutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/TimeTags/TimeTagAutoGenerateSection.cs index d5496b929..4d7d03a81 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/TimeTags/TimeTagAutoGenerateSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/TimeTags/TimeTagAutoGenerateSection.cs @@ -16,7 +16,7 @@ public class TimeTagAutoGenerateSection : AutoGenerateSection protected override Dictionary GetDisableSelectingLyrics(Lyric[] lyrics) => lyrics.Where(x => x.Language == null) - .ToDictionary(k => k, i => "Before generate time-tag, need to assign language first."); + .ToDictionary(k => k, _ => "Before generate time-tag, need to assign language first."); protected override void Apply(Lyric[] lyrics) => lyricManager.AutoGenerateTimeTags(lyrics); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/TimeTags/TimeTagIssueSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/TimeTags/TimeTagIssueSection.cs index 4ee5e4aa4..16eb96875 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/TimeTags/TimeTagIssueSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Extends/TimeTags/TimeTagIssueSection.cs @@ -45,7 +45,7 @@ private void load(LyricCheckerManager lyricCheckerManager) }; bindableReports = lyricCheckerManager.BindableReports.GetBoundCopy(); - bindableReports.BindCollectionChanged((a, b) => + bindableReports.BindCollectionChanged((_, _) => { // todo : might have filter in here. var issues = bindableReports.Values.SelectMany(x => x); @@ -68,7 +68,7 @@ public IEnumerable Issues if (value == null) return; - Content = value.Select((g, i) => + Content = value.Select((g, _) => { var lyric = g.HitObjects.FirstOrDefault() as Lyric; @@ -88,7 +88,7 @@ public IEnumerable Issues return rows; }).SelectMany(x => x).ToArray().ToRectangular(); - BackgroundFlow.Children = value.Select((g, i) => + BackgroundFlow.Children = value.Select((g, _) => { var lyric = g.HitObjects.FirstOrDefault() as Lyric; @@ -217,7 +217,7 @@ private void load(ILyricEditorState state, LyricCaretState lyricCaretState, Blue { // update selected state by bindable. selectedTimeTags = blueprintSelectionState.SelectedTimeTags.GetBoundCopy(); - selectedTimeTags.BindCollectionChanged((a, b) => + selectedTimeTags.BindCollectionChanged((_, _) => { var selected = selectedTimeTags.Contains(timeTag); UpdateState(selected); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditor.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditor.cs index adcbee53d..c8cef18c0 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditor.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditor.cs @@ -142,21 +142,21 @@ public LyricEditor() skin.FontSize = e.NewValue; }); - bindableCreateMovingCaretMode.BindValueChanged(e => + bindableCreateMovingCaretMode.BindValueChanged(_ => { initialCaretPositionAlgorithm(); lyricCaretState.ResetPosition(Mode); }); - bindableRecordingMovingCaretMode.BindValueChanged(e => + bindableRecordingMovingCaretMode.BindValueChanged(_ => { initialCaretPositionAlgorithm(); lyricCaretState.ResetPosition(Mode); }); - lyricSelectionState.Selecting.BindValueChanged(e => + lyricSelectionState.Selecting.BindValueChanged(_ => { initializeApplySelectingArea(); }, true); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Blueprints/RomajiTagSelectionBlueprint.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Blueprints/RomajiTagSelectionBlueprint.cs index a6e8e5a3b..541b766c1 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Blueprints/RomajiTagSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Blueprints/RomajiTagSelectionBlueprint.cs @@ -31,9 +31,9 @@ public RomajiTagSelectionBlueprint(RomajiTag item) private void load() { UpdatePositionAndSize(); - text.BindValueChanged(e => UpdatePositionAndSize()); - startIndex.BindValueChanged(e => UpdatePositionAndSize()); - endIndex.BindValueChanged(e => UpdatePositionAndSize()); + text.BindValueChanged(_ => UpdatePositionAndSize()); + startIndex.BindValueChanged(_ => UpdatePositionAndSize()); + endIndex.BindValueChanged(_ => UpdatePositionAndSize()); } } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Blueprints/RubyTagSelectionBlueprint.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Blueprints/RubyTagSelectionBlueprint.cs index 0d005d612..fde38c8f4 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Blueprints/RubyTagSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Blueprints/RubyTagSelectionBlueprint.cs @@ -31,9 +31,9 @@ public RubyTagSelectionBlueprint(RubyTag item) private void load() { UpdatePositionAndSize(); - text.BindValueChanged(e => UpdatePositionAndSize()); - startIndex.BindValueChanged(e => UpdatePositionAndSize()); - endIndex.BindValueChanged(e => UpdatePositionAndSize()); + text.BindValueChanged(_ => UpdatePositionAndSize()); + startIndex.BindValueChanged(_ => UpdatePositionAndSize()); + endIndex.BindValueChanged(_ => UpdatePositionAndSize()); } } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/EditorLyricPiece.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/EditorLyricPiece.cs index bcde89539..be8f2ab5d 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/EditorLyricPiece.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/EditorLyricPiece.cs @@ -192,7 +192,7 @@ public Vector2 GetTimeTagPosition(TextIndex index) } private int skinIndex(PositionText[] positionTexts, int endIndex) - => positionTexts.Where((x, i) => i < endIndex).Sum(x => x.Text.Length); + => positionTexts.Where((_, i) => i < endIndex).Sum(x => x.Text.Length); private bool propertyMatched(PositionText positionText, ITextTag textTag) => positionText.StartIndex == textTag.StartIndex && positionText.EndIndex == textTag.EndIndex && positionText.Text == textTag.Text; diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/FixedInfo/InvalidInfo.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/FixedInfo/InvalidInfo.cs index 4c6f6d28f..f90f7159d 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/FixedInfo/InvalidInfo.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/FixedInfo/InvalidInfo.cs @@ -36,7 +36,7 @@ public InvalidInfo(Lyric lyric) [BackgroundDependencyLoader] private void load(OsuColour colours, LyricCheckerManager lyricCheckerManager) { - lyricCheckerManager.BindableReports.BindCollectionChanged((i, args) => + lyricCheckerManager.BindableReports.BindCollectionChanged((_, args) => { // Ignore remove case if (args.NewItems == null) diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Parts/DrawableTimeTag.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Parts/DrawableTimeTag.cs index b4c9ad297..3a2ea3097 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Parts/DrawableTimeTag.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/Parts/DrawableTimeTag.cs @@ -57,13 +57,13 @@ private void load(OsuColour colours, ILyricEditorState state, KaraokeRulesetLyri bindableMode = state.BindableMode.GetBoundCopy(); bindableRecordingMovingCaretMode = lyricEditorConfigManager.GetBindable(KaraokeRulesetLyricEditorSetting.RecordingTimeTagMovingCaretMode).GetBoundCopy(); - bindableMode.BindValueChanged(x => + bindableMode.BindValueChanged(_ => { // should wait until caret position algorithm loaded. Schedule(updateStyle); }); - bindableRecordingMovingCaretMode.BindValueChanged(x => + bindableRecordingMovingCaretMode.BindValueChanged(_ => { // should wait until caret position algorithm loaded. Schedule(updateStyle); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/SubInfo/TimeTagInfo.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/SubInfo/TimeTagInfo.cs index f08243203..d017989f0 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/SubInfo/TimeTagInfo.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Components/SubInfo/TimeTagInfo.cs @@ -13,7 +13,7 @@ public class TimeTagInfo : SubInfo public TimeTagInfo(Lyric lyric) : base(lyric) { - lyric.TimeTagsBindable.BindValueChanged(value => + lyric.TimeTagsBindable.BindValueChanged(_ => { BadgeText = LyricUtils.TimeTagTimeFormattedString(Lyric); }, true); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/EditLyricRow.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/EditLyricRow.cs index b1139a4dc..2cb7d44b3 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/EditLyricRow.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/EditLyricRow.cs @@ -328,7 +328,7 @@ public SingleLyricEditor(Lyric lyric) } }; - lyricPiece.TimeTagsBindable.BindValueChanged(e => + lyricPiece.TimeTagsBindable.BindValueChanged(_ => { ScheduleAfterChildren(UpdateTimeTags); }, true); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Extends/Components/TimeTagZoomableScrollContainer.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Extends/Components/TimeTagZoomableScrollContainer.cs index 985e12f07..539889a49 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Extends/Components/TimeTagZoomableScrollContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Extends/Components/TimeTagZoomableScrollContainer.cs @@ -43,7 +43,7 @@ protected TimeTagZoomableScrollContainer(Lyric lyric) { foreach (var obj in addItems) { - obj.TimeBindable.BindValueChanged(e => + obj.TimeBindable.BindValueChanged(_ => { updateTimeRange(); }); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Extends/TimeTags/TimeTagEditorHitObjectBlueprint.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Extends/TimeTags/TimeTagEditorHitObjectBlueprint.cs index e0cb74958..a4e5d7a8b 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Extends/TimeTags/TimeTagEditorHitObjectBlueprint.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/Extends/TimeTags/TimeTagEditorHitObjectBlueprint.cs @@ -87,7 +87,7 @@ private void load(TimeTagEditor timeline, OsuColour colours) timeTagText.Text = LyricUtils.GetTimeTagDisplayRubyText(timeline.HitObject, Item); timeTagPiece.Colour = colours.BlueLight; timeTagWithNoTimePiece.Colour = colours.Red; - startTime.BindValueChanged(e => + startTime.BindValueChanged(_ => { var hasValue = hasTime(); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/LyricEditorRow.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/LyricEditorRow.cs index d7a4729f5..2e85adf9d 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/LyricEditorRow.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/LyricEditorRow.cs @@ -106,7 +106,7 @@ private void load(ILyricEditorState state, LyricSelectionState lyricSelectionSta selectedLyrics = lyricSelectionState.SelectedLyrics.GetBoundCopy(); // should update background if mode changed. - mode.BindValueChanged(e => + mode.BindValueChanged(_ => { background.Colour = colourProvider.Dark2(state.Mode); selectedCheckbox.AccentColour = colourProvider.Colour2(state.Mode); @@ -126,7 +126,7 @@ private void load(ILyricEditorState state, LyricSelectionState lyricSelectionSta }, true); // get bindable and update bindable if check / uncheck. - selectedLyrics.BindCollectionChanged((a, b) => + selectedLyrics.BindCollectionChanged((_, _) => { if (selectedCheckbox.Current.Disabled) return; @@ -136,7 +136,7 @@ private void load(ILyricEditorState state, LyricSelectionState lyricSelectionSta }, true); // should disable selection if current lyric is disabled. - disableSelectingLyrics.BindCollectionChanged((a, b) => + disableSelectingLyrics.BindCollectionChanged((_, _) => { var disabled = disableSelectingLyrics.Keys.Contains(lyric); selectedCheckbox.Current.Disabled = disabled; diff --git a/osu.Game.Rulesets.Karaoke/Edit/Singers/Rows/Components/Blueprints/SingerLyricEditorHitObjectBlueprint.cs b/osu.Game.Rulesets.Karaoke/Edit/Singers/Rows/Components/Blueprints/SingerLyricEditorHitObjectBlueprint.cs index bed4f84dd..f80c9a725 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Singers/Rows/Components/Blueprints/SingerLyricEditorHitObjectBlueprint.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Singers/Rows/Components/Blueprints/SingerLyricEditorHitObjectBlueprint.cs @@ -71,7 +71,7 @@ public LyricTimelineHitObjectBlueprint(Lyric item) [BackgroundDependencyLoader] private void load(LyricManager lyricManager, SingerLyricEditor editor) { - singersBindable.BindValueChanged(e => + singersBindable.BindValueChanged(_ => { // Check is lyric contains this singer, or default singer isSingerMatched = lyricInCurrentSinger(Item, editor.Singer); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Singers/Rows/SingerLyricPlacementRow.cs b/osu.Game.Rulesets.Karaoke/Edit/Singers/Rows/SingerLyricPlacementRow.cs index ba030377d..a053656c9 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Singers/Rows/SingerLyricPlacementRow.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Singers/Rows/SingerLyricPlacementRow.cs @@ -122,7 +122,7 @@ public DrawableSingerInfo(Singer singer) updateSingerInfo(e.NewValue); }, true); - singer.OrderBindable.BindValueChanged(x => + singer.OrderBindable.BindValueChanged(_ => { updateSingerName(singer); }); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerManager.cs b/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerManager.cs index 5ac20ad34..3779338f0 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerManager.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerManager.cs @@ -37,7 +37,7 @@ private void load() Singers.AddRange(karaokeBeatmap.Singers); // should write-back if singer changed. - Singers.BindCollectionChanged((a, b) => + Singers.BindCollectionChanged((_, _) => { karaokeBeatmap.Singers = Singers.ToArray(); }); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateEditSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateEditSection.cs index cdfde5976..0f920dd0c 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateEditSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateEditSection.cs @@ -215,7 +215,7 @@ private void load(TranslateManager translateManager, OsuColour colours) timeSectionBackground.Colour = colours.ContextMenuGray; lyricSectionBackground.Colour = colours.Gray9; - translateGrid.RowDimensions = translateManager.Lyrics.Select(x => new Dimension(GridSizeMode.Absolute, row_height)).ToArray(); + translateGrid.RowDimensions = translateManager.Lyrics.Select(_ => new Dimension(GridSizeMode.Absolute, row_height)).ToArray(); translateGrid.Content = createContent(languageDropdown.Current); } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateManager.cs b/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateManager.cs index 85ac6fc99..492e8645c 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateManager.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateManager.cs @@ -36,7 +36,7 @@ private void load() return; Languages.AddRange(karaokeBeatmap.AvailableTranslates); - Languages.BindCollectionChanged((a, b) => { karaokeBeatmap.AvailableTranslates = Languages.ToArray(); }); + Languages.BindCollectionChanged((_, _) => { karaokeBeatmap.AvailableTranslates = Languages.ToArray(); }); } public void AddLanguage(CultureInfo cultureInfo) diff --git a/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateScreen.cs index f9d34f855..395424558 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateScreen.cs @@ -65,7 +65,7 @@ private void load(OsuColour colours, DialogOverlay dialogOverlay, LanguageSelect // ask only once if contains no language after switch to translate editor. bool alreadyAsked; - TranslateManager.Languages.BindCollectionChanged((a, b) => + TranslateManager.Languages.BindCollectionChanged((_, _) => { alreadyAsked = true; diff --git a/osu.Game.Rulesets.Karaoke/Graphics/UserInterface/FontSelectionDialog.cs b/osu.Game.Rulesets.Karaoke/Graphics/UserInterface/FontSelectionDialog.cs index fdedc6a60..c47648c35 100644 --- a/osu.Game.Rulesets.Karaoke/Graphics/UserInterface/FontSelectionDialog.cs +++ b/osu.Game.Rulesets.Karaoke/Graphics/UserInterface/FontSelectionDialog.cs @@ -176,7 +176,7 @@ public FontSelectionDialog() } }; - fonts.BindCollectionChanged((a, b) => + fonts.BindCollectionChanged((_, b) => { // re-calculate if source changed. Schedule(() => @@ -217,9 +217,9 @@ public FontSelectionDialog() // set to first or empty if change new family. weightProperty.Current.Value = weight.FirstOrDefault(); }); - weightProperty.Current.BindValueChanged(x => previewChange()); - fontSizeProperty.Current.BindValueChanged(x => previewChange()); - fixedWidthCheckbox.Current.BindValueChanged(x => previewChange()); + weightProperty.Current.BindValueChanged(_ => previewChange()); + fontSizeProperty.Current.BindValueChanged(_ => previewChange()); + fixedWidthCheckbox.Current.BindValueChanged(_ => previewChange()); Current.BindValueChanged(e => { var newFont = e.NewValue; diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/FontUsageConvertor.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/FontUsageConvertor.cs index 28c6476b9..a65761eef 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/FontUsageConvertor.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/FontUsageConvertor.cs @@ -23,20 +23,15 @@ public override FontUsage ReadJson(JsonReader reader, Type objectType, FontUsage var font = new FontUsage(size: default_text_size); - foreach (var property in properties) + return properties.Aggregate(font, (current, property) => property.Name switch { - font = property.Name switch - { - "family" => font.With(property.Value.ToObject()), - "weight" => font.With(weight: property.Value.ToObject()), - "size" => font.With(size: property.Value.ToObject()), - "italics" => font.With(italics: property.Value.ToObject()), - "fixedWidth" => font.With(fixedWidth: property.Value.ToObject()), - _ => font - }; - } - - return font; + "family" => current.With(property.Value.ToObject()), + "weight" => current.With(weight: property.Value.ToObject()), + "size" => current.With(size: property.Value.ToObject()), + "italics" => current.With(italics: property.Value.ToObject()), + "fixedWidth" => current.With(fixedWidth: property.Value.ToObject()), + _ => current + }); } public override void WriteJson(JsonWriter writer, FontUsage value, JsonSerializer serializer) diff --git a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs index d865a8e53..7da49eb2c 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableLyric.cs @@ -80,8 +80,8 @@ private void load([CanBeNull] KaraokeSessionStatics session) Origin = Anchor.TopLeft, }); - useTranslateBindable.BindValueChanged(e => applyTranslate()); - preferLanguageBindable.BindValueChanged(e => applyTranslate()); + useTranslateBindable.BindValueChanged(_ => applyTranslate()); + preferLanguageBindable.BindValueChanged(_ => applyTranslate()); displayRubyBindable.BindValueChanged(e => lyricPieces.ForEach(x => x.DisplayRuby = e.NewValue)); displayRomajiBindable.BindValueChanged(e => lyricPieces.ForEach(x => x.DisplayRomaji = e.NewValue)); @@ -102,9 +102,9 @@ private void load([CanBeNull] KaraokeSessionStatics session) config.BindWith(KaraokeRulesetSetting.DisplayRomaji, displayRomajiBindable); } - singersBindable.BindValueChanged(index => { updateFontStyle(); }); - layoutIndexBindable.BindValueChanged(index => { updateLayout(); }); - translateTextBindable.BindCollectionChanged((_, args) => { applyTranslate(); }); + singersBindable.BindValueChanged(_ => { updateFontStyle(); }); + layoutIndexBindable.BindValueChanged(_ => { updateLayout(); }); + translateTextBindable.BindCollectionChanged((_, _) => { applyTranslate(); }); if (config != null) { @@ -114,10 +114,10 @@ private void load([CanBeNull] KaraokeSessionStatics session) config.BindWith(KaraokeRulesetSetting.TranslateFont, translateFontUsageBindable); } - mainFontUsageBindable.BindValueChanged(e => updateFontUsage()); - rubyFontUsageBindable.BindValueChanged(e => updateFontUsage()); - romajiFontUsageBindable.BindValueChanged(e => updateFontUsage()); - translateFontUsageBindable.BindValueChanged(e => updateFontUsage()); + mainFontUsageBindable.BindValueChanged(_ => updateFontUsage()); + rubyFontUsageBindable.BindValueChanged(_ => updateFontUsage()); + romajiFontUsageBindable.BindValueChanged(_ => updateFontUsage()); + translateFontUsageBindable.BindValueChanged(_ => updateFontUsage()); } protected override void OnApply() diff --git a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs index b05a49254..ea5d4956d 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Drawables/DrawableNote.cs @@ -71,12 +71,12 @@ private void load(INotePositionInfo notePositionInfo) { positionBindable.BindTo(notePositionInfo.Position); - positionBindable.BindValueChanged(e => updateNotePositionAndHeight()); + positionBindable.BindValueChanged(_ => updateNotePositionAndHeight()); TextBindable.BindValueChanged(_ => { changeText(HitObject); }); AlternativeTextBindable.BindValueChanged(_ => { changeText(HitObject); }); - SingersBindable.BindValueChanged(index => { ApplySkin(CurrentSkin, false); }); + SingersBindable.BindValueChanged(_ => { ApplySkin(CurrentSkin, false); }); DisplayBindable.BindValueChanged(e => { (Result.Judgement as KaraokeNoteJudgement).Saitenable = e.NewValue; }); - ToneBindable.BindValueChanged(e => updateNotePositionAndHeight()); + ToneBindable.BindValueChanged(_ => updateNotePositionAndHeight()); void updateNotePositionAndHeight() { diff --git a/osu.Game.Rulesets.Karaoke/Overlays/Changelog/Sidebar/ChangelogSection.cs b/osu.Game.Rulesets.Karaoke/Overlays/Changelog/Sidebar/ChangelogSection.cs index 1bc969282..6020446e8 100644 --- a/osu.Game.Rulesets.Karaoke/Overlays/Changelog/Sidebar/ChangelogSection.cs +++ b/osu.Game.Rulesets.Karaoke/Overlays/Changelog/Sidebar/ChangelogSection.cs @@ -1,6 +1,7 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -28,7 +29,13 @@ public class ChangelogSection : CompositeDrawable public ChangelogSection(int year, IEnumerable posts) { - Debug.Assert(posts.All(p => p.PublishedAt.Year == year)); + Debug.Assert(posts.All(p => + { + if (p == null) + throw new ArgumentNullException(nameof(p)); + + return p.PublishedAt.Year == year; + })); RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; diff --git a/osu.Game.Rulesets.Karaoke/Replays/KaraokeAutoGeneratorBySinger.cs b/osu.Game.Rulesets.Karaoke/Replays/KaraokeAutoGeneratorBySinger.cs index bda7182b8..e4624ca8e 100644 --- a/osu.Game.Rulesets.Karaoke/Replays/KaraokeAutoGeneratorBySinger.cs +++ b/osu.Game.Rulesets.Karaoke/Replays/KaraokeAutoGeneratorBySinger.cs @@ -62,7 +62,7 @@ public KaraokeAutoGeneratorBySinger(KaraokeBeatmap beatmap, Stream data) lengthSum += length; // usually sample 1 is vocal - var channel0Sample = sampleBuffer.Where((x, i) => i % 2 == 0).ToArray(); + var channel0Sample = sampleBuffer.Where((_, i) => i % 2 == 0).ToArray(); //var channel1Sample = sampleBuffer.Where((x, i) => i % 2 != 0).ToArray(); // Convert buffer to pitch data diff --git a/osu.Game.Rulesets.Karaoke/Screens/Config/KaraokeConfigScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Config/KaraokeConfigScreen.cs index 0741a4187..857d8358e 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Config/KaraokeConfigScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Config/KaraokeConfigScreen.cs @@ -103,13 +103,13 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl private void load(GameHost host) { // todo : not really sure how to clean-up cached manager - if (host.Dependencies.Get() == null) - { - // because not possible to remove cache from host, so only inject once. - var manager = new FontManager(); - AddInternal(manager); - host.Dependencies.Cache(manager); - } + if (host.Dependencies.Get() != null) + return; + + // because not possible to remove cache from host, so only inject once. + var manager = new FontManager(); + AddInternal(manager); + host.Dependencies.Cache(manager); } protected override void LoadComplete() diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Default/DefaultLyricPiece.cs b/osu.Game.Rulesets.Karaoke/Skinning/Default/DefaultLyricPiece.cs index 384733030..b16925bc3 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Default/DefaultLyricPiece.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Default/DefaultLyricPiece.cs @@ -53,9 +53,9 @@ protected DefaultLyricPiece(Lyric hitObject, int chunkIndex = whole_chunk_index) { foreach (var obj in addItems) { - obj.StartIndexBindable.BindValueChanged(x => applyRuby(RubyTagsBindable.Value)); - obj.EndIndexBindable.BindValueChanged(x => applyRuby(RubyTagsBindable.Value)); - obj.TextBindable.BindValueChanged(x => applyRuby(RubyTagsBindable.Value)); + obj.StartIndexBindable.BindValueChanged(_ => applyRuby(RubyTagsBindable.Value)); + obj.EndIndexBindable.BindValueChanged(_ => applyRuby(RubyTagsBindable.Value)); + obj.TextBindable.BindValueChanged(_ => applyRuby(RubyTagsBindable.Value)); } }, removedItems => { @@ -71,9 +71,9 @@ protected DefaultLyricPiece(Lyric hitObject, int chunkIndex = whole_chunk_index) { foreach (var obj in addItems) { - obj.StartIndexBindable.BindValueChanged(x => applyRomaji(RomajiTagsBindable.Value)); - obj.EndIndexBindable.BindValueChanged(x => applyRomaji(RomajiTagsBindable.Value)); - obj.TextBindable.BindValueChanged(x => applyRomaji(RomajiTagsBindable.Value)); + obj.StartIndexBindable.BindValueChanged(_ => applyRomaji(RomajiTagsBindable.Value)); + obj.EndIndexBindable.BindValueChanged(_ => applyRomaji(RomajiTagsBindable.Value)); + obj.TextBindable.BindValueChanged(_ => applyRomaji(RomajiTagsBindable.Value)); } }, removedItems => { diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Fonts/FontManager.cs b/osu.Game.Rulesets.Karaoke/Skinning/Fonts/FontManager.cs index f593a23aa..6dc740807 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Fonts/FontManager.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Fonts/FontManager.cs @@ -187,7 +187,7 @@ public IResourceStore GetGlyphStore(FontInfo fontInfo) { FontFormat.Fnt => getFntGlyphStore(storage, fontName), FontFormat.Ttf => getTtfGlyphStore(storage, fontName), - _ => throw new ArgumentOutOfRangeException(nameof(fontFormat)) + FontFormat.Internal or _ => throw new ArgumentOutOfRangeException(nameof(fontFormat)) }; } @@ -218,9 +218,9 @@ private TtfGlyphStore getTtfGlyphStore(Storage storage, string fontName) private static string getPathByFontType(FontFormat type) => type switch { - FontFormat.Fnt => $"fnt", - FontFormat.Ttf => $"ttf", - _ => throw new ArgumentOutOfRangeException(nameof(type)) + FontFormat.Fnt => "fnt", + FontFormat.Ttf => "ttf", + FontFormat.Internal or _ => throw new ArgumentOutOfRangeException(nameof(type)) }; private static string getExtensionByFontType(FontFormat type) => @@ -228,7 +228,7 @@ private static string getExtensionByFontType(FontFormat type) => { FontFormat.Fnt => "zipfnt", FontFormat.Ttf => "ttf", - _ => throw new ArgumentOutOfRangeException(nameof(type)) + FontFormat.Internal or _ => throw new ArgumentOutOfRangeException(nameof(type)) }; private static FontFormat getFontTypeByExtension(string extension) => diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyHitExplosion.cs b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyHitExplosion.cs index 18773d97f..b90453476 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyHitExplosion.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyHitExplosion.cs @@ -36,7 +36,7 @@ private void load(ISkinSource skin, IScrollingInfo scrollingInfo) // This animation is discarded and re-queried with the appropriate frame length afterwards. var tmp = skin.GetAnimation(imageName, true, false); double frameLength = 0; - if (tmp is IFramedAnimation tmpAnimation && tmpAnimation.FrameCount > 0) + if (tmp is IFramedAnimation { FrameCount: > 0 } tmpAnimation) frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount); explosion = skin.GetAnimation(imageName, true, false, frameLength: frameLength).With(d => diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyNotePiece.cs b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyNotePiece.cs index 8b9d6dae7..40f995368 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyNotePiece.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/LegacyNotePiece.cs @@ -127,11 +127,11 @@ protected virtual void OnDirectionChanged(ValueChangedEvent { if (direction.NewValue == ScrollingDirection.Left) { - InternalChildren.ForEach(x => Scale = Vector2.One); + InternalChildren.ForEach(x => x.Scale = Vector2.One); } else { - InternalChildren.ForEach(x => Scale = new Vector2(-1, 1)); + InternalChildren.ForEach(x => x.Scale = new Vector2(-1, 1)); } } diff --git a/osu.Game.Rulesets.Karaoke/UI/Position/NotePositionInfo.cs b/osu.Game.Rulesets.Karaoke/UI/Position/NotePositionInfo.cs index ca5159613..8ca41c7ea 100644 --- a/osu.Game.Rulesets.Karaoke/UI/Position/NotePositionInfo.cs +++ b/osu.Game.Rulesets.Karaoke/UI/Position/NotePositionInfo.cs @@ -44,8 +44,8 @@ protected override void SkinChanged(ISkinSource skin) bindableColumnHeight.BindTo(columnHeight); bindableColumnSpacing.BindTo(columnSpacing); - bindableColumnHeight.BindValueChanged(e => updatePositionCalculator()); - bindableColumnSpacing.BindValueChanged(e => updatePositionCalculator()); + bindableColumnHeight.BindValueChanged(_ => updatePositionCalculator()); + bindableColumnSpacing.BindValueChanged(_ => updatePositionCalculator()); } private void updatePositionCalculator()