From 7f0448c293985c9de7c5f78ed79489edb8cea17c Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 16 Oct 2022 16:28:29 +0800 Subject: [PATCH 1/3] Run the chean-up code script. --- .../Lyrics/States/LyricCaretStateTest.cs | 2 +- .../Editor/TestSceneInvalidLyricToolTip.cs | 3 ++- .../Converters/LyricConvertorTest.cs | 12 +++++++---- .../KaraokeJsonSerializableExtensionsTest.cs | 20 +++++++++++-------- .../Beatmaps/Formats/LrcDecoder.cs | 11 +++++----- .../Beatmaps/Formats/LrcEncoder.cs | 6 +++--- .../Difficulty/KaraokeDifficultyCalculator.cs | 2 +- .../Notes/NoteSelectionBlueprint.cs | 3 ++- .../Lyrics/ILyricAutoGenerateChangeHandler.cs | 1 - .../Edit/Export/ExportLyricManager.cs | 2 +- .../AssignLanguageStepScreen.cs | 3 ++- .../Edit/Lyrics/Compose/LyricComposer.cs | 2 +- .../Toolbar/Playback/PlaybackSwitchButton.cs | 2 +- .../Markdown/DescriptionTextFlowContainer.cs | 4 ++-- .../TimeTags/TimeTagCreateConfigSubsection.cs | 3 ++- .../TimeTags/TimeTagEditModeSection.cs | 3 ++- .../Edit/Lyrics/States/LyricSelectionState.cs | 2 +- .../Converters/GenericTypeConvertor.cs | 2 +- .../KaraokeSettingsSubsectionStrings.cs | 3 ++- .../Objects/Lyric_Binding.cs | 6 ++++-- 20 files changed, 53 insertions(+), 39 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Lyrics/States/LyricCaretStateTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Lyrics/States/LyricCaretStateTest.cs index 528ad2e5f..d005ee607 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Lyrics/States/LyricCaretStateTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Lyrics/States/LyricCaretStateTest.cs @@ -65,7 +65,7 @@ private void load() Dependencies.CacheAs(new TimeTagModeState()); Dependencies.Cache(new KaraokeRulesetLyricEditorConfigManager()); - LyricsProvider lyricsProvider = new LyricsProvider(); + var lyricsProvider = new LyricsProvider(); Dependencies.CacheAs(lyricsProvider); Children = new Drawable[] diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneInvalidLyricToolTip.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneInvalidLyricToolTip.cs index 8cf788c49..01393dd64 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneInvalidLyricToolTip.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneInvalidLyricToolTip.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 NUnit.Framework; using osu.Framework.Graphics; @@ -284,7 +285,7 @@ internal class Check : ICheck { public IEnumerable Run(BeatmapVerifierContext context) { - throw new System.NotImplementedException(); + throw new NotImplementedException(); } public CheckMetadata Metadata { get; } = null!; diff --git a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/LyricConvertorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/LyricConvertorTest.cs index caed0211f..6c3d1c077 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/LyricConvertorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/LyricConvertorTest.cs @@ -23,7 +23,8 @@ public void TestLyricConvertorWithNoConfig() { var lyric = new Lyric(); - const string expected = "{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100},\"difficulty_control_point\":{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0},\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singers\":[],\"translates\":{},\"samples\":[],\"auxiliary_samples\":[]}"; + const string expected = + "{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100},\"difficulty_control_point\":{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0},\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singers\":[],\"translates\":{},\"samples\":[],\"auxiliary_samples\":[]}"; string actual = JsonConvert.SerializeObject(lyric, CreateSettings()); Assert.AreEqual(expected, actual); } @@ -31,7 +32,8 @@ public void TestLyricConvertorWithNoConfig() [Test] public void TestDeserializeWithNoConfig() { - const string json = "{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100},\"difficulty_control_point\":{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0},\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singers\":[],\"translates\":{},\"samples\":[],\"auxiliary_samples\":[]}"; + const string json = + "{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100},\"difficulty_control_point\":{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0},\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singers\":[],\"translates\":{},\"samples\":[],\"auxiliary_samples\":[]}"; var expected = new Lyric(); var actual = JsonConvert.DeserializeObject(json, CreateSettings())!; @@ -63,7 +65,8 @@ public void TestLyricConvertorWithSyncConfig() const string reference_lyric_json = "{\"$id\":\"1\",\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100},\"difficulty_control_point\":{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0},\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singers\":[],\"translates\":{},\"samples\":[],\"auxiliary_samples\":[]}"; - const string expected = $"{{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100}},\"difficulty_control_point\":{{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0}},\"reference_lyric\":{reference_lyric_json},\"reference_lyric_config\":{{\"$type\":\"SyncLyricConfig\"}},\"samples\":[],\"auxiliary_samples\":[]}}"; + const string expected = + $"{{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100}},\"difficulty_control_point\":{{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0}},\"reference_lyric\":{reference_lyric_json},\"reference_lyric_config\":{{\"$type\":\"SyncLyricConfig\"}},\"samples\":[],\"auxiliary_samples\":[]}}"; string actual = JsonConvert.SerializeObject(lyric, CreateSettings()); Assert.AreEqual(expected, actual); } @@ -79,7 +82,8 @@ public void TestLyricConvertorWithReferenceConfig() const string reference_lyric_json = "{\"$id\":\"1\",\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100},\"difficulty_control_point\":{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0},\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singers\":[],\"translates\":{},\"samples\":[],\"auxiliary_samples\":[]}"; - const string expected = $"{{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100}},\"difficulty_control_point\":{{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0}},\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singers\":[],\"translates\":{{}},\"reference_lyric\":{reference_lyric_json},\"reference_lyric_config\":{{\"$type\":\"ReferenceLyricConfig\"}},\"samples\":[],\"auxiliary_samples\":[]}}"; + const string expected = + $"{{\"time_preempt\":600.0,\"time_fade_in\":400.0,\"start_time_bindable\":0.0,\"samples_bindable\":[],\"sample_control_point\":{{\"sample_bank_bindable\":\"normal\",\"sample_volume_bindable\":100,\"sample_bank\":\"normal\",\"sample_volume\":100}},\"difficulty_control_point\":{{\"slider_velocity_bindable\":1.0,\"slider_velocity\":1.0}},\"text\":\"\",\"time_tags\":[],\"ruby_tags\":[],\"romaji_tags\":[],\"singers\":[],\"translates\":{{}},\"reference_lyric\":{reference_lyric_json},\"reference_lyric_config\":{{\"$type\":\"ReferenceLyricConfig\"}},\"samples\":[],\"auxiliary_samples\":[]}}"; string actual = JsonConvert.SerializeObject(lyric, CreateSettings()); Assert.AreEqual(expected, actual); } diff --git a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/KaraokeJsonSerializableExtensionsTest.cs b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/KaraokeJsonSerializableExtensionsTest.cs index 59f8e18a5..443c00c4f 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/KaraokeJsonSerializableExtensionsTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/KaraokeJsonSerializableExtensionsTest.cs @@ -16,7 +16,8 @@ public void TestSerializeLyric() { var lyric = new Lyric(); - const string expected = @"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""text"":"""",""time_tags"":[],""ruby_tags"":[],""romaji_tags"":[],""singers"":[],""translates"":[],""samples"":[],""auxiliary_samples"":[]}"; + const string expected = + @"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""text"":"""",""time_tags"":[],""ruby_tags"":[],""romaji_tags"":[],""singers"":[],""translates"":[],""samples"":[],""auxiliary_samples"":[]}"; string actual = JsonConvert.SerializeObject(lyric, createSettings()); Assert.AreEqual(expected, actual); @@ -25,10 +26,11 @@ public void TestSerializeLyric() [Test] public void TestDeserializeLyric() { - const string json = @"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""text"":"""",""time_tags"":[],""ruby_tags"":[],""romaji_tags"":[],""singers"":[],""translates"":[],""samples"":[],""auxiliary_samples"":[]}"; + const string json = + @"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""text"":"""",""time_tags"":[],""ruby_tags"":[],""romaji_tags"":[],""singers"":[],""translates"":[],""samples"":[],""auxiliary_samples"":[]}"; - Lyric expected = new Lyric(); - Lyric actual = JsonConvert.DeserializeObject(json, createSettings())!; + var expected = new Lyric(); + var actual = JsonConvert.DeserializeObject(json, createSettings())!; ObjectAssert.ArePropertyEqual(expected, actual); } @@ -37,7 +39,8 @@ public void TestSerializeNote() { var note = new Note(); - const string expected = @"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""samples"":[],""auxiliary_samples"":[]}"; + const string expected = + @"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""samples"":[],""auxiliary_samples"":[]}"; string actual = JsonConvert.SerializeObject(note, createSettings()); Assert.AreEqual(expected, actual); @@ -46,10 +49,11 @@ public void TestSerializeNote() [Test] public void TestDeserializeNote() { - const string json = @"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""samples"":[],""auxiliary_samples"":[]}"; + const string json = + @"{""time_preempt"":600.0,""time_fade_in"":400.0,""start_time_bindable"":0.0,""samples_bindable"":[],""sample_control_point"":{""sample_bank_bindable"":""normal"",""sample_volume_bindable"":100,""sample_bank"":""normal"",""sample_volume"":100},""difficulty_control_point"":{""slider_velocity_bindable"":1.0,""slider_velocity"":1.0},""samples"":[],""auxiliary_samples"":[]}"; - Note expected = new Note(); - Note actual = JsonConvert.DeserializeObject(json, createSettings())!; + var expected = new Note(); + var actual = JsonConvert.DeserializeObject(json, createSettings())!; ObjectAssert.ArePropertyEqual(expected, actual); } diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcDecoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcDecoder.cs index 5818eb7d5..f45d88cc4 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcDecoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcDecoder.cs @@ -11,7 +11,6 @@ using osu.Game.Rulesets.Karaoke.Utils; using Lyric = osu.Game.Rulesets.Karaoke.Objects.Lyric; using RubyTag = osu.Game.Rulesets.Karaoke.Objects.RubyTag; -using TextIndex = osu.Framework.Graphics.Sprites.TextIndex; namespace osu.Game.Rulesets.Karaoke.Beatmaps.Formats { @@ -56,15 +55,15 @@ protected override void ParseStreamInto(LineBufferedReader stream, Beatmap outpu output.HitObjects.Add(lyric); } - static TimeTag convertTimeTag(KeyValuePair timeTag) + static TimeTag convertTimeTag(KeyValuePair timeTag) => new(convertTextIndex(timeTag.Key), timeTag.Value); - static TextIndex convertTextIndex(LrcParser.Model.TextIndex textIndex) + static Framework.Graphics.Sprites.TextIndex convertTextIndex(TextIndex textIndex) { int index = textIndex.Index; - var state = textIndex.State == IndexState.Start ? TextIndex.IndexState.Start : TextIndex.IndexState.End; + var state = textIndex.State == IndexState.Start ? Framework.Graphics.Sprites.TextIndex.IndexState.Start : Framework.Graphics.Sprites.TextIndex.IndexState.End; - return new TextIndex(index, state); + return new Framework.Graphics.Sprites.TextIndex(index, state); } static RubyTag convertRubyTag(LrcParser.Model.RubyTag rubyTag) @@ -78,7 +77,7 @@ static RubyTag convertRubyTag(LrcParser.Model.RubyTag rubyTag) static TimeTag[] convertTimeTagsFromRubyTags(LrcParser.Model.RubyTag rubyTag) { int startIndex = rubyTag.StartIndex; - return rubyTag.TimeTags.Select(x => convertTimeTag(new KeyValuePair(new LrcParser.Model.TextIndex(startIndex), x.Value))).ToArray(); + return rubyTag.TimeTags.Select(x => convertTimeTag(new KeyValuePair(new TextIndex(startIndex), x.Value))).ToArray(); } } } diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcEncoder.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcEncoder.cs index e2ab637ee..ed2fc9a5b 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcEncoder.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Formats/LrcEncoder.cs @@ -9,7 +9,7 @@ using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Utils; using Lyric = osu.Game.Rulesets.Karaoke.Objects.Lyric; -using RubyTag = osu.Game.Rulesets.Karaoke.Objects.RubyTag; +using RubyTag = LrcParser.Model.RubyTag; using TextIndex = osu.Framework.Graphics.Sprites.TextIndex; namespace osu.Game.Rulesets.Karaoke.Beatmaps.Formats @@ -49,8 +49,8 @@ static LrcParser.Model.TextIndex convertTextIndex(TextIndex textIndex) return new LrcParser.Model.TextIndex(index, state); } - static List convertRubyTag(IEnumerable rubyTags) - => rubyTags.Select(x => new LrcParser.Model.RubyTag + static List convertRubyTag(IEnumerable rubyTags) + => rubyTags.Select(x => new RubyTag { Text = x.Text, StartIndex = x.StartIndex, diff --git a/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyCalculator.cs b/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyCalculator.cs index fb4fe9635..8dc1c9512 100644 --- a/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Karaoke/Difficulty/KaraokeDifficultyCalculator.cs @@ -54,7 +54,7 @@ protected override IEnumerable CreateDifficultyHitObjects(I // todo : might have a sort. // LegacySortHelper.Sort(sortedObjects, Comparer.Create((a, b) => (int)Math.Round(a.StartTime) - (int)Math.Round(b.StartTime))); - List objects = new List(); + var objects = new List(); for (int i = 1; i < sortedObjects.Length; i++) objects.Add(new KaraokeDifficultyHitObject(sortedObjects[i], sortedObjects[i - 1], clockRate, objects, objects.Count)); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Blueprints/Notes/NoteSelectionBlueprint.cs b/osu.Game.Rulesets.Karaoke/Edit/Blueprints/Notes/NoteSelectionBlueprint.cs index 4791affcf..524788179 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Blueprints/Notes/NoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Blueprints/Notes/NoteSelectionBlueprint.cs @@ -69,7 +69,8 @@ protected override void Update() public override MenuItem[] ContextMenuItems => new MenuItem[] { - new OsuMenuItem(HitObject.Display ? "Hide" : "Show", HitObject.Display ? MenuItemType.Destructive : MenuItemType.Standard, () => notePropertyChangeHandler.ChangeDisplayState(!HitObject.Display)), + new OsuMenuItem(HitObject.Display ? "Hide" : "Show", HitObject.Display ? MenuItemType.Destructive : MenuItemType.Standard, + () => notePropertyChangeHandler.ChangeDisplayState(!HitObject.Display)), new OsuMenuItem("Split", MenuItemType.Destructive, () => notesChangeHandler.Split()), }; diff --git a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/ILyricAutoGenerateChangeHandler.cs b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/ILyricAutoGenerateChangeHandler.cs index 746724064..cf15a9a90 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/ILyricAutoGenerateChangeHandler.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ChangeHandlers/Lyrics/ILyricAutoGenerateChangeHandler.cs @@ -31,4 +31,3 @@ public enum LyricAutoGenerateProperty AutoGenerateNotes, } } - diff --git a/osu.Game.Rulesets.Karaoke/Edit/Export/ExportLyricManager.cs b/osu.Game.Rulesets.Karaoke/Edit/Export/ExportLyricManager.cs index 3d19e4ab0..5a08bc7fd 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Export/ExportLyricManager.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Export/ExportLyricManager.cs @@ -133,7 +133,7 @@ public KaraokeLegacyBeatmapExporter(Storage storage, string filename, string con public override void ExportModelTo(BeatmapSetInfo model, Stream outputStream) { // base.ExportModelTo(model, outputStream); - using (ZipArchive zipArchive = ZipArchive.Create()) + using (var zipArchive = ZipArchive.Create()) { foreach (INamedFileUsage file in model.Files) { diff --git a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/AssignLanguage/AssignLanguageStepScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/AssignLanguage/AssignLanguageStepScreen.cs index 607494a0c..d655c4f6a 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/AssignLanguage/AssignLanguageStepScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/ImportLyric/AssignLanguage/AssignLanguageStepScreen.cs @@ -59,7 +59,8 @@ protected override void LoadComplete() public override void Complete() { // Check is need to go to generate ruby/romaji step or just skip. - if (lyricAutoGenerateChangeHandler.CanGenerate(LyricAutoGenerateProperty.AutoGenerateRubyTags) || lyricAutoGenerateChangeHandler.CanGenerate(LyricAutoGenerateProperty.AutoGenerateRomajiTags)) + if (lyricAutoGenerateChangeHandler.CanGenerate(LyricAutoGenerateProperty.AutoGenerateRubyTags) + || lyricAutoGenerateChangeHandler.CanGenerate(LyricAutoGenerateProperty.AutoGenerateRomajiTags)) { ScreenStack.Push(LyricImporterStep.GenerateRuby); } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/LyricComposer.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/LyricComposer.cs index f1a1179c0..ad4225cd2 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/LyricComposer.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/LyricComposer.cs @@ -229,7 +229,7 @@ private void assignPanelPosition(PanelLayout panelLayout) foreach (var (direction, panelTypes) in panelDirections) { - foreach (Panel instance in panelTypes.Select(panelType => panelInstance[panelType])) + foreach (var instance in panelTypes.Select(panelType => panelInstance[panelType])) { instance.Direction = direction; } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/Toolbar/Playback/PlaybackSwitchButton.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/Toolbar/Playback/PlaybackSwitchButton.cs index 8eff315ff..fe0c195e9 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/Toolbar/Playback/PlaybackSwitchButton.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/Toolbar/Playback/PlaybackSwitchButton.cs @@ -1,7 +1,6 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -using osuTK; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; @@ -14,6 +13,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Edit; +using osuTK; namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Compose.Toolbar.Playback { diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/Components/Markdown/DescriptionTextFlowContainer.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/Components/Markdown/DescriptionTextFlowContainer.cs index ffdc94b54..b21a181b1 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/Components/Markdown/DescriptionTextFlowContainer.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/Components/Markdown/DescriptionTextFlowContainer.cs @@ -69,7 +69,7 @@ protected override void AddLinkText(string text, LinkInline linkInline) { var keys = descriptionTextFlowContainer.Description.Keys; string key = linkInline.Url; - if (keys == null || !keys.TryGetValue(key, out InputKey inputKey)) + if (keys == null || !keys.TryGetValue(key, out var inputKey)) throw new ArgumentNullException(nameof(keys)); AddDrawable(new InputKeyText(inputKey)); @@ -80,7 +80,7 @@ protected override void AddLinkText(string text, LinkInline linkInline) { var editModes = descriptionTextFlowContainer.Description.EditModes; string key = linkInline.Url; - if (editModes == null || !editModes.TryGetValue(key, out SwitchMode mode)) + if (editModes == null || !editModes.TryGetValue(key, out var mode)) throw new ArgumentNullException(nameof(editModes)); AddDrawable(new SwitchMoteText(mode)); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/TimeTags/TimeTagCreateConfigSubsection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/TimeTags/TimeTagCreateConfigSubsection.cs index 849df9c81..f39fb32d3 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/TimeTags/TimeTagCreateConfigSubsection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/TimeTags/TimeTagCreateConfigSubsection.cs @@ -144,7 +144,8 @@ private DescriptionFormat getDescription(CreateTimeTagEditMode mode) => { CreateTimeTagEditMode.Create => new DescriptionFormat { - Text = $"Use keyboard to control caret position, press [{DescriptionFormat.LINK_KEY_INPUT}](create_time_tag) to create new time-tag and press [{DescriptionFormat.LINK_KEY_INPUT}](remove_time_tag) to delete exist time-tag.", + Text = + $"Use keyboard to control caret position, press [{DescriptionFormat.LINK_KEY_INPUT}](create_time_tag) to create new time-tag and press [{DescriptionFormat.LINK_KEY_INPUT}](remove_time_tag) to delete exist time-tag.", Keys = new Dictionary { { "create_time_tag", new InputKey { AdjustableActions = new List { KaraokeEditAction.CreateTimeTag } } }, diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/TimeTags/TimeTagEditModeSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/TimeTags/TimeTagEditModeSection.cs index 53f4fb759..96472d561 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/TimeTags/TimeTagEditModeSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Settings/TimeTags/TimeTagEditModeSection.cs @@ -22,7 +22,8 @@ protected override EditModeSelectionItem CreateSelectionItem(TimeTagEditMode edi TimeTagEditMode.Create => new EditModeSelectionItem("Create", "Create the time-tag or adjust the position."), TimeTagEditMode.Recording => new EditModeSelectionItem("Recording", new DescriptionFormat { - Text = $"Press [{DescriptionFormat.LINK_KEY_INPUT}](set_time_tag_time) at the right time to set current time to time-tag. Press [{DescriptionFormat.LINK_KEY_INPUT}](clear_time_tag_time) to clear the time-tag time.", + Text = + $"Press [{DescriptionFormat.LINK_KEY_INPUT}](set_time_tag_time) at the right time to set current time to time-tag. Press [{DescriptionFormat.LINK_KEY_INPUT}](clear_time_tag_time) to clear the time-tag time.", Keys = new Dictionary { { diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/States/LyricSelectionState.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/States/LyricSelectionState.cs index 524908673..48b618d26 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/States/LyricSelectionState.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/States/LyricSelectionState.cs @@ -118,7 +118,7 @@ public void UpdateDisableLyricList(IDictionary disable bindableDisableSelectingLyric.Clear(); - foreach ((var lyric, LocalisableString reason) in disableLyrics) + foreach ((var lyric, var reason) in disableLyrics) bindableDisableSelectingLyric.Add(lyric, reason); } } diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/GenericTypeConvertor.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/GenericTypeConvertor.cs index ccf90c71b..35f4b2388 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/GenericTypeConvertor.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/GenericTypeConvertor.cs @@ -37,7 +37,7 @@ Type getTypeByProperties(IEnumerable properties) if (value == null) throw new ArgumentNullException(nameof(value)); - TTypeName? elementType = value.ToObject(); + var elementType = value.ToObject(); if (elementType == null) throw new InvalidCastException(nameof(elementType)); diff --git a/osu.Game.Rulesets.Karaoke/Localisation/KaraokeSettingsSubsectionStrings.cs b/osu.Game.Rulesets.Karaoke/Localisation/KaraokeSettingsSubsectionStrings.cs index 409c68e97..dda26e7c3 100644 --- a/osu.Game.Rulesets.Karaoke/Localisation/KaraokeSettingsSubsectionStrings.cs +++ b/osu.Game.Rulesets.Karaoke/Localisation/KaraokeSettingsSubsectionStrings.cs @@ -35,7 +35,8 @@ public static class KaraokeSettingsSubsectionStrings /// /// "Will not showing the cursor while gameplay if not select this option." /// - public static LocalisableString ShowCursorWhilePlayingTooltip => new TranslatableString(getKey(@"show_cursor_while_playing_tooltip"), @"Will not showing the cursor while gameplay if not select this option."); + public static LocalisableString ShowCursorWhilePlayingTooltip => + new TranslatableString(getKey(@"show_cursor_while_playing_tooltip"), @"Will not showing the cursor while gameplay if not select this option."); /// /// "Translate" diff --git a/osu.Game.Rulesets.Karaoke/Objects/Lyric_Binding.cs b/osu.Game.Rulesets.Karaoke/Objects/Lyric_Binding.cs index f98362c69..43786caa0 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Lyric_Binding.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Lyric_Binding.cs @@ -247,7 +247,8 @@ void triggerPropertyChanged() } } - private void bindListValueChange(ValueChangedEvent e, Func> getProperty, Action syncAction, bool triggerChangeOnBind = true) + private void bindListValueChange(ValueChangedEvent e, Func> getProperty, Action syncAction, + bool triggerChangeOnBind = true) { if (e.OldValue != null) { @@ -274,7 +275,8 @@ void triggerPropertyChanged() } } - private void bindDictionaryValueChange(ValueChangedEvent e, Func> getProperty, Action syncAction, bool triggerChangeOnBind = true) + private void bindDictionaryValueChange(ValueChangedEvent e, Func> getProperty, + Action syncAction, bool triggerChangeOnBind = true) where TKey : notnull { if (e.OldValue != null) From 9a8457ae770e52188df7bb4c573c47419e0a3555 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 16 Oct 2022 16:07:25 +0800 Subject: [PATCH 2/3] Remove un-need spacing. --- .../UI/KaraokePlayfieldAdjustmentContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke/UI/KaraokePlayfieldAdjustmentContainer.cs b/osu.Game.Rulesets.Karaoke/UI/KaraokePlayfieldAdjustmentContainer.cs index 07baaf163..5e311f506 100644 --- a/osu.Game.Rulesets.Karaoke/UI/KaraokePlayfieldAdjustmentContainer.cs +++ b/osu.Game.Rulesets.Karaoke/UI/KaraokePlayfieldAdjustmentContainer.cs @@ -27,7 +27,7 @@ public class KaraokePlayfieldAdjustmentContainer : PlayfieldAdjustmentContainer private KaraokeLocalFontStore localFontStore; [BackgroundDependencyLoader] - private void load( FontManager fontManager, IRenderer renderer, KaraokeRulesetConfigManager manager) + private void load(FontManager fontManager, IRenderer renderer, KaraokeRulesetConfigManager manager) { // get all font usage which wants to import. var targetImportFonts = new[] From cf6170ec61e49523744f8ede20cf34d93cd41d1a Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 16 Oct 2022 16:10:21 +0800 Subject: [PATCH 3/3] Adjust some code. --- .../Editor/Lyrics/Edit/SingleLyricEditorTest.cs | 2 +- .../Editor/TestSceneLayoutToolTip.cs | 2 +- osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/LyricComposer.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/Lyrics/Edit/SingleLyricEditorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/Lyrics/Edit/SingleLyricEditorTest.cs index f8b90264a..bd957613e 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/Lyrics/Edit/SingleLyricEditorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/Lyrics/Edit/SingleLyricEditorTest.cs @@ -14,7 +14,7 @@ public class SingleLyricEditorTest public void TestLockMessage() { var lyric = new Lyric(); - Assert.IsNull(EditableLyric.GetLyricPropertyLockedReason(lyric, LyricEditorMode.View)); + Assert.IsNull(InteractableLyric.GetLyricPropertyLockedReason(lyric, LyricEditorMode.View)); } } } diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLayoutToolTip.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLayoutToolTip.cs index 269c45339..7c98c1185 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLayoutToolTip.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLayoutToolTip.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor [TestFixture] public class TestSceneLayoutToolTip : OsuTestScene { - private ISkin skin = new TestingSkin(null); + private readonly ISkin skin = new TestingSkin(null); private LayoutToolTip toolTip = null!; [SetUp] diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/LyricComposer.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/LyricComposer.cs index ad4225cd2..30315901a 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/LyricComposer.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Compose/LyricComposer.cs @@ -336,7 +336,7 @@ private void assignBottomEditor(BottomEditorType? bottomEditorType) return; bottomEditorContainer.Add(newButtonEditor); - newButtonEditor.Delay(hasOldButtonEditor ? remove_old_editor_time : 0).FadeIn(0).MoveToY(0, new_animation_time); + newButtonEditor.Delay(hasOldButtonEditor ? remove_old_editor_time : 0).FadeIn().MoveToY(0, new_animation_time); static BaseBottomEditor? createBottomEditor(BottomEditorType? bottomEditorType) => bottomEditorType switch