diff --git a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs index 80f6ce717..645536528 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/Formats/KaraokeLegacyBeatmapDecoderTest.cs @@ -107,7 +107,7 @@ public void TestDecodeTranslate() Assert.IsTrue(translates != null); // Check translate count - Assert.AreEqual(translates.Count(), 2); + Assert.AreEqual(translates.Length, 2); // All lyric should have two translates Assert.AreEqual(lyrics[0].Translates.Count, 2); diff --git a/osu.Game.Rulesets.Karaoke.Tests/Mods/KaraokeModPerfectTestScene.cs b/osu.Game.Rulesets.Karaoke.Tests/Mods/KaraokeModPerfectTestScene.cs index 71e105d2f..2f5b763b9 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Mods/KaraokeModPerfectTestScene.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Mods/KaraokeModPerfectTestScene.cs @@ -10,7 +10,7 @@ public abstract class KaraokeModPerfectTestScene : ModPerfectTestScene { protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset(); - public KaraokeModPerfectTestScene(ModPerfect mod) + protected KaraokeModPerfectTestScene(ModPerfect mod) : base(mod) { } diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs index ef530fcd5..77e835e5d 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/KaraokeLegacyBeatmapDecoder.cs @@ -255,7 +255,7 @@ private void processTranslate(Beatmap beatmap, IEnumerable translateLine value = translate.Split('=').LastOrDefault() }).GroupBy(x => x.key, y => y.value).ToList(); - for (int i = 0; i < translates.Count(); i++) + for (int i = 0; i < translates.Count; i++) { var id = i + 1; var singleLanguage = translates[i]; @@ -263,7 +263,7 @@ private void processTranslate(Beatmap beatmap, IEnumerable translateLine var key = singleLanguage.Key; var values = singleLanguage.ToList(); - var size = Math.Min(lyrics.Count(), singleLanguage.Count()); + var size = Math.Min(lyrics.Count, singleLanguage.Count()); for (int j = 0; j < size; j++) { diff --git a/osu.Game.Rulesets.Karaoke/Edit/Import/ImportLyricDialog.cs b/osu.Game.Rulesets.Karaoke/Edit/Import/ImportLyricDialog.cs index 9338f1d0f..e31b3c618 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Import/ImportLyricDialog.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Import/ImportLyricDialog.cs @@ -30,9 +30,10 @@ public ImportLyricDialog(FileInfo info, Action resetAction = null) new PopupDialogOkButton { Text = @"Yes. Go for it.", - Action = () => { + Action = () => + { var success = processImport(info); - resetAction?.Invoke(true); + resetAction?.Invoke(success); } }, new PopupDialogCancelButton @@ -67,6 +68,7 @@ private bool processImport(FileInfo info) BodyText = fileNotFoundException.Message, }); break; + case FileLoadException loadException: dialogOverlay.Push(new OkPopupDialog { @@ -76,6 +78,7 @@ private bool processImport(FileInfo info) }); break; } + return false; } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Import/ImportManager.cs b/osu.Game.Rulesets.Karaoke/Edit/Import/ImportManager.cs index a70a458bb..8361e7d8d 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Import/ImportManager.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Import/ImportManager.cs @@ -36,6 +36,7 @@ public void ImportLrcFile(FileInfo info) var set = beatmap.Value.BeatmapSetInfo; var oldFile = set.Files?.FirstOrDefault(f => f.Filename == backup_lrc_name); + using (var stream = info.OpenRead()) { // todo : make a backup if has new lyric file. diff --git a/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutManager.cs b/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutManager.cs index 56842c9b9..ee40d965a 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutManager.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutManager.cs @@ -37,6 +37,7 @@ public class LayoutManager : Component private void load() { var layoutLookups = source.GetConfig>(KaraokeIndexLookup.Layout)?.Value; + foreach (var layoutLookup in layoutLookups) { var lookup = new KaraokeSkinLookup(KaraokeSkinConfiguration.LyricLayout, layoutLookup.Key); @@ -49,6 +50,7 @@ private void load() EditLayout.Value = Layouts.FirstOrDefault(); var skinLookups = source.GetConfig>(KaraokeIndexLookup.Style)?.Value; + foreach (var skinLookup in skinLookups) { PreviewFontSelections.Add(skinLookup.Key, skinLookup.Value); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutPreview.cs b/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutPreview.cs index 0458f2b8a..40f29ad5f 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutPreview.cs @@ -72,7 +72,7 @@ private void load(LayoutManager manager) { manager.PreviewLyric.BindValueChanged(e => { - if(e.NewValue != null) + if (e.NewValue != null) Child = new PreviewDrawableLyric(e.NewValue); }, true); @@ -94,7 +94,7 @@ public class PreviewDrawableLyric : DrawableLyric private KaraokeLayout layout; public PreviewDrawableLyric(Lyric hitObject) - : base(hitObject) + : base(hitObject) { } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutScreen.cs index 89ecf394a..b6240726b 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutScreen.cs @@ -23,7 +23,7 @@ public class LayoutScreen : EditorScreen protected readonly LayoutManager LayoutManager; public LayoutScreen() - : base(EditorScreenMode.SongSetup) + : base(EditorScreenMode.SongSetup) { ColourProvider = new OverlayColourProvider(OverlayColourScheme.Green); Content.Add(LayoutManager = new LayoutManager()); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutSection.cs index 2b71a9a73..2c2611965 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Layout/LayoutSection.cs @@ -26,7 +26,7 @@ internal abstract class LayoutSection : Container protected abstract string Title { get; } - public LayoutSection() + protected LayoutSection() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; diff --git a/osu.Game.Rulesets.Karaoke/Edit/Layout/PreviewSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Layout/PreviewSection.cs index 314714241..50eb8c14a 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Layout/PreviewSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Layout/PreviewSection.cs @@ -5,8 +5,6 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; -using osu.Game.Graphics.UserInterface; using osu.Game.IO; using osu.Game.Overlays.Settings; using osu.Game.Rulesets.Karaoke.Beatmaps.Formats; @@ -64,6 +62,7 @@ private void load(LayoutManager manager) Height = 9 }; break; + case PreviewRatio.LegacyScreen: manager.PreviewScreenRatio.Value = new DisplayRatio { @@ -91,44 +90,46 @@ private Lyric getLyricSampleBySelection(PreviewSample previewSample) { case PreviewSample.SampeSmall: return createDefaultLyric("@カラオケ", - new[] - { - "@Ruby1=カ,か", - "@Ruby2=ラ,ら", - "@Ruby3=オ,お", - "@Ruby4=ケ,け" - }, - new[] - { - "@Romaji1=カ,ka", - "@Romaji2=ラ,ra", - "@Romaji3=オ,o", - "@Romaji4=ケ,ke" - } - , "karaoke"); + new[] + { + "@Ruby1=カ,か", + "@Ruby2=ラ,ら", + "@Ruby3=オ,お", + "@Ruby4=ケ,け" + }, + new[] + { + "@Romaji1=カ,ka", + "@Romaji2=ラ,ra", + "@Romaji3=オ,o", + "@Romaji4=ケ,ke" + } + , "karaoke"); case PreviewSample.SampleMedium: return createDefaultLyric("@[00:18:58]た[00:18:81]だ[00:19:36]風[00:20:09]に[00:20:29]揺[00:20:49]ら[00:20:68]れ[00:20:89]て[00:20:93]", - new[] - { - "@Ruby1=風,かぜ", - "@Ruby2=揺,ゆ" - }, - new[] - { - "@Romaji1=た,ta", - "@Romaji2=だ,da", - "@Romaji3=風,kaze", - "@Romaji4=に,ni", - "@Romaji5=揺,yu", - "@Romaji6=ら,ra", - "@Romaji7=れ,re", - "@Romaji8=て,te" - } - , "karaoke"); + new[] + { + "@Ruby1=風,かぜ", + "@Ruby2=揺,ゆ" + }, + new[] + { + "@Romaji1=た,ta", + "@Romaji2=だ,da", + "@Romaji3=風,kaze", + "@Romaji4=に,ni", + "@Romaji5=揺,yu", + "@Romaji6=ら,ra", + "@Romaji7=れ,re", + "@Romaji8=て,te" + } + , "karaoke"); + case PreviewSample.SampleLarge: return createDefaultLyric("@灰色(いろ)(いろ)の景色(いろ)(いろ)さえ色づき始める", - Array.Empty(), Array.Empty(), "karaoke"); + Array.Empty(), Array.Empty(), "karaoke"); + default: return null; } @@ -209,7 +210,7 @@ private class StyleDropdown : SettingsDropdown> private class StyleDropdownControl : DropdownControl { protected override string GenerateItemText(KeyValuePair item) - => item.Value ?? $"Style{item.Key}"; + => item.Value ?? $"Style{item.Key}"; } } } diff --git a/osu.Game.Rulesets.Karaoke/Edit/LyricEditor/LyricEditorScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/LyricEditor/LyricEditorScreen.cs index 3896c7934..be151ca91 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/LyricEditor/LyricEditorScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/LyricEditor/LyricEditorScreen.cs @@ -9,7 +9,6 @@ using osu.Game.Database; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; -using osu.Game.Rulesets.Karaoke.Beatmaps.Formats; using osu.Game.Rulesets.Karaoke.Edit.Import; using osu.Game.Rulesets.Karaoke.Edit.Timelines; using osu.Game.Rulesets.Karaoke.Objects; diff --git a/osu.Game.Rulesets.Karaoke/Edit/RubyRomaji/Components/LyricList.cs b/osu.Game.Rulesets.Karaoke/Edit/RubyRomaji/Components/LyricList.cs index 1b3e7a990..dcf7e5599 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/RubyRomaji/Components/LyricList.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/RubyRomaji/Components/LyricList.cs @@ -109,10 +109,10 @@ public Lyric[] Lyrics private TableColumn[] createHeaders() { var columns = new List - { - new TableColumn("Number", Anchor.Centre, new Dimension(GridSizeMode.Absolute, 50)), - new TableColumn("Lyric", Anchor.Centre), - }; + { + new TableColumn("Number", Anchor.Centre, new Dimension(GridSizeMode.Absolute, 50)), + new TableColumn("Lyric", Anchor.Centre), + }; return columns.ToArray(); } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Style/StyleScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/Style/StyleScreen.cs index eab15de1b..a667415c2 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Style/StyleScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Style/StyleScreen.cs @@ -23,7 +23,7 @@ public class StyleScreen : EditorScreen protected readonly StyleManager StyleManager; public StyleScreen() - : base(EditorScreenMode.SongSetup) + : base(EditorScreenMode.SongSetup) { ColourProvider = new OverlayColourProvider(OverlayColourScheme.Pink); Content.Add(StyleManager = new StyleManager()); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Translate/Components/DrawableLanguageListItem.cs b/osu.Game.Rulesets.Karaoke/Edit/Translate/Components/DrawableLanguageListItem.cs index 26c250e31..1836386c3 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Translate/Components/DrawableLanguageListItem.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Translate/Components/DrawableLanguageListItem.cs @@ -109,11 +109,12 @@ protected override void LoadComplete() base.LoadComplete(); textBox.Current.Value = language.Name; - textBox.Current.BindValueChanged(x => { + textBox.Current.BindValueChanged(x => + { // Update name languageManager.UpdateLanguagename(language, x.NewValue); - // Create new + // Create new createNewLanguage(); }, true); IsCreated.BindValueChanged(created => textBoxPaddingContainer.Padding = new MarginPadding { Right = created.NewValue ? button_width : 0 }, true); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateEditSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateEditSection.cs index 47e399512..3cd4cbfe0 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateEditSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateEditSection.cs @@ -36,13 +36,13 @@ public TranslateEditSection(EditorBeatmap editorBeatmap) { Padding = new MarginPadding(10); - var columnDimensions = new Dimension[] + var columnDimensions = new[] { new Dimension(GridSizeMode.Absolute, 200), new Dimension(GridSizeMode.Absolute, column_spacing), new Dimension(GridSizeMode.Absolute, 400), new Dimension(GridSizeMode.Absolute, column_spacing), - new Dimension(GridSizeMode.Distributed) + new Dimension() }; Child = new FillFlowContainer @@ -54,7 +54,7 @@ public TranslateEditSection(EditorBeatmap editorBeatmap) new GridContainer { Name = "LanguageSelection", - RowDimensions = new [] + RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, @@ -63,7 +63,7 @@ public TranslateEditSection(EditorBeatmap editorBeatmap) AutoSizeAxes = Axes.Y, Content = new Drawable[][] { - new [] + new[] { null, null, @@ -80,20 +80,20 @@ public TranslateEditSection(EditorBeatmap editorBeatmap) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Children = new [] + Children = new[] { new GridContainer { Name = "Background", - RowDimensions = new [] + RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, ColumnDimensions = columnDimensions, RelativeSizeAxes = Axes.Both, - Content = new [] + Content = new[] { - new [] + new[] { new CornerBackground { @@ -104,7 +104,7 @@ public TranslateEditSection(EditorBeatmap editorBeatmap) null, null, }, - new [] + new[] { timeSectionBackground = new CornerBackground { @@ -135,8 +135,8 @@ public TranslateEditSection(EditorBeatmap editorBeatmap) }; Dimension[] createRowDimension() => editorBeatmap.HitObjects.OfType() - .Select(x => new Dimension(GridSizeMode.Absolute, row_height)) - .ToArray(); + .Select(x => new Dimension(GridSizeMode.Absolute, row_height)) + .ToArray(); } [BackgroundDependencyLoader] @@ -154,7 +154,7 @@ private Drawable[][] createContent(EditorBeatmap editorBeatmap, Bindable { - return new Drawable[] + return new[] { createTimeDrawable(x), null, diff --git a/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateScreen.cs index 5ed687a20..bfe5761ad 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Translate/TranslateScreen.cs @@ -8,7 +8,6 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Overlays; -using osu.Game.Rulesets.Karaoke.Edit.Translate.Components; using osu.Game.Screens.Edit; namespace osu.Game.Rulesets.Karaoke.Edit.Translate diff --git a/osu.Game.Rulesets.Karaoke/Graphics/Containers/TitleFocusedOverlayContainer.cs b/osu.Game.Rulesets.Karaoke/Graphics/Containers/TitleFocusedOverlayContainer.cs index e5d2bd114..cc84ab4b2 100644 --- a/osu.Game.Rulesets.Karaoke/Graphics/Containers/TitleFocusedOverlayContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Graphics/Containers/TitleFocusedOverlayContainer.cs @@ -74,7 +74,7 @@ public TitleFocusedOverlayContainer() { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Icon = FontAwesome.Solid.Times, + Icon = FontAwesome.Solid.Times, Scale = new Vector2(0.8f), X = -10, Action = () => State.Value = Visibility.Hidden diff --git a/osu.Game.Rulesets.Karaoke/Graphics/Cursor/BackgroundToolTip.cs b/osu.Game.Rulesets.Karaoke/Graphics/Cursor/BackgroundToolTip.cs index eb9da42e4..d116b502a 100644 --- a/osu.Game.Rulesets.Karaoke/Graphics/Cursor/BackgroundToolTip.cs +++ b/osu.Game.Rulesets.Karaoke/Graphics/Cursor/BackgroundToolTip.cs @@ -18,7 +18,7 @@ public abstract class BackgroundToolTip : VisibilityContainer, ITooltip protected override Container Content => content; - public BackgroundToolTip() + protected BackgroundToolTip() { AutoSizeAxes = Axes.Both; Masking = true; diff --git a/osu.Game.Rulesets.Karaoke/Graphics/LyricPreview.cs b/osu.Game.Rulesets.Karaoke/Graphics/LyricPreview.cs index d313f2ecc..0b5f9fc13 100644 --- a/osu.Game.Rulesets.Karaoke/Graphics/LyricPreview.cs +++ b/osu.Game.Rulesets.Karaoke/Graphics/LyricPreview.cs @@ -87,7 +87,7 @@ public ClickableLyric(Lyric lyric) RelativeSizeAxes = Axes.X; Masking = true; CornerRadius = 5; - Children = new Drawable[] + Children = new[] { background = new Box { diff --git a/osu.Game.Rulesets.Karaoke/Statistics/BeatmapMetadataGraph.cs b/osu.Game.Rulesets.Karaoke/Statistics/BeatmapMetadataGraph.cs index dcff388f1..5d4c28e2d 100644 --- a/osu.Game.Rulesets.Karaoke/Statistics/BeatmapMetadataGraph.cs +++ b/osu.Game.Rulesets.Karaoke/Statistics/BeatmapMetadataGraph.cs @@ -79,7 +79,7 @@ private abstract class MetadataSection : Container { protected FillFlowContainer TextContainer { get; } - public MetadataSection(string title) + protected MetadataSection(string title) { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y;