From 339b6e0daa5cad257fdb77280f7c5f4ce995c0d6 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Tue, 26 Jul 2022 00:51:52 +0800 Subject: [PATCH 1/3] Add the reference lyric mode. --- .../Edit/Components/Menus/LyricEditorModeMenu.cs | 1 + .../Edit/Lyrics/LyricEditorColourProvider.cs | 1 + osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorMode.cs | 6 ++++++ osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/EditLyricRow.cs | 4 ++++ .../Edit/Lyrics/States/LyricCaretState.cs | 1 + 5 files changed, 13 insertions(+) diff --git a/osu.Game.Rulesets.Karaoke/Edit/Components/Menus/LyricEditorModeMenu.cs b/osu.Game.Rulesets.Karaoke/Edit/Components/Menus/LyricEditorModeMenu.cs index 2101bb696..94bf4ff02 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Components/Menus/LyricEditorModeMenu.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Components/Menus/LyricEditorModeMenu.cs @@ -20,6 +20,7 @@ public LyricEditorModeMenu(Bindable config, string text) { LyricEditorMode.View, LyricEditorMode.Texting, + LyricEditorMode.Reference, LyricEditorMode.Language, LyricEditorMode.EditRuby, LyricEditorMode.EditRomaji, diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorColourProvider.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorColourProvider.cs index 6f2e280ac..7ec73569a 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorColourProvider.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorColourProvider.cs @@ -47,6 +47,7 @@ private static float getBaseHue(LyricEditorMode mode) return 200 / 360f; // blue case LyricEditorMode.Texting: + case LyricEditorMode.Reference: return 0 / 360f; // red case LyricEditorMode.Language: diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorMode.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorMode.cs index 93eabddd2..8bc5c8d7c 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorMode.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorMode.cs @@ -22,6 +22,12 @@ public enum LyricEditorMode [Description("Texting")] Texting, + /// + /// Mark the lyric is "similar" to another lyric. + /// + [Description("Reference")] + Reference, + /// /// Can edit each lyric's language. /// diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/EditLyricRow.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/EditLyricRow.cs index 2cfe2c943..517bd2d6f 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/EditLyricRow.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/Rows/EditLyricRow.cs @@ -217,6 +217,10 @@ Drawable createSubInfo() case LyricEditorMode.Texting: return null; + case LyricEditorMode.Reference: + // todo: add the reference info. + return null; + case LyricEditorMode.Language: return new LanguageInfo(Lyric); diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/States/LyricCaretState.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/States/LyricCaretState.cs index e5f4a5101..4b56588de 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/States/LyricCaretState.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/States/LyricCaretState.cs @@ -134,6 +134,7 @@ private void refreshAlgorithmAndCaretPosition() { LyricEditorMode.View => null, LyricEditorMode.Texting => getTextingmodeAlgorithm(), + LyricEditorMode.Reference => new NavigateCaretPositionAlgorithm(lyrics), LyricEditorMode.Language => new ClickingCaretPositionAlgorithm(lyrics), LyricEditorMode.EditRuby => new NavigateCaretPositionAlgorithm(lyrics), LyricEditorMode.EditRomaji => new NavigateCaretPositionAlgorithm(lyrics), From 463cce0dca5b65c96e6f254d630d8dd26f73eac2 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Tue, 26 Jul 2022 00:52:19 +0800 Subject: [PATCH 2/3] Implement the clipboard. There's no need to implement the copy/paste behavior. --- .../Edit/Lyrics/LyricEditorClipboard.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorClipboard.cs b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorClipboard.cs index e1ca41f7a..1ec66ae42 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorClipboard.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Lyrics/LyricEditorClipboard.cs @@ -162,6 +162,9 @@ private bool performCut() throw new ArgumentOutOfRangeException(); } + case LyricEditorMode.Reference: + return false; + case LyricEditorMode.Language: languageChangeHandler.SetLanguage(null); return true; @@ -227,6 +230,9 @@ private bool performCopy(Lyric lyric) throw new ArgumentOutOfRangeException(); } + case LyricEditorMode.Reference: + return false; + case LyricEditorMode.Language: saveObjectToTheClipboardContent(lyric.Language); copyObjectToClipboard(lyric.Language); @@ -299,6 +305,9 @@ private bool performPaste(Lyric lyric) throw new ArgumentOutOfRangeException(); } + case LyricEditorMode.Reference: + return false; + case LyricEditorMode.Language: var pasteLanguage = getObjectFromClipboardContent(); if (pasteLanguage == null) From 45092bd5fa523d9bf228269e03b97ce57aacbded Mon Sep 17 00:00:00 2001 From: andy840119 Date: Tue, 26 Jul 2022 00:52:39 +0800 Subject: [PATCH 3/3] Add the fucking test case. --- .../Editor/TestSceneLyricEditorScreen.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLyricEditorScreen.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLyricEditorScreen.cs index ef2b807cb..c9cf24f90 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLyricEditorScreen.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLyricEditorScreen.cs @@ -64,6 +64,12 @@ public void TestTextingMode() clickEditModeButtons(); } + [Test] + public void TestReferenceMode() + { + switchToMode(LyricEditorMode.Reference); + } + [Test] public void TestLanguageMode() {