From 4dcce910884fcb89eca87730c3b04511d6a4a51d Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 27 Sep 2023 22:37:31 +0800 Subject: [PATCH 1/3] Use new generator in the lyric editor. --- .../Lyrics/Settings/Romaji/RomajiAutoGenerateSection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Romaji/RomajiAutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Romaji/RomajiAutoGenerateSection.cs index 325b3229e..698937f8f 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Romaji/RomajiAutoGenerateSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Romaji/RomajiAutoGenerateSection.cs @@ -21,7 +21,7 @@ private partial class RomajiTagAutoGenerateSubsection : LyricEditorAutoGenerateS private const string time_tag_mode = "TIME_TAG_MODE"; public RomajiTagAutoGenerateSubsection() - : base(AutoGenerateType.AutoGenerateRomajiTags) + : base(AutoGenerateType.AutoGenerateTimeTagRomaji) { } From fd4591d1dbc06c11b2f0ba16f678f86a1e1b5b04 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 27 Sep 2023 22:36:49 +0800 Subject: [PATCH 2/3] Adjust the step in the lyric importer. --- .../AssignLanguageStepScreen.cs | 16 ++++------ .../GenerateRubyRomajiNavigation.cs | 8 ++--- .../GenerateRubyRomajiStepScreen.cs | 17 +---------- .../GenerateTimeTagStepScreen.cs | 30 ++++++++++++++++++- 4 files changed, 39 insertions(+), 32 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/AssignLanguage/AssignLanguageStepScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/AssignLanguage/AssignLanguageStepScreen.cs index 7583293a9..591f6ddc2 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/AssignLanguage/AssignLanguageStepScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/AssignLanguage/AssignLanguageStepScreen.cs @@ -48,16 +48,12 @@ protected override void LoadComplete() public override void Complete() { - // Check is need to go to generate ruby/romaji step or just skip. - if (lyricPropertyAutoGenerateChangeHandler.CanGenerate(AutoGenerateType.AutoGenerateRubyTags) - || lyricPropertyAutoGenerateChangeHandler.CanGenerate(AutoGenerateType.AutoGenerateRomajiTags)) - { - ScreenStack.Push(LyricImporterStep.GenerateRuby); - } - else - { - ScreenStack.Push(LyricImporterStep.GenerateTimeTag); - } + // Check is need to go to generate ruby step or just skip. + var nextStep = lyricPropertyAutoGenerateChangeHandler.CanGenerate(AutoGenerateType.AutoGenerateRubyTags) + ? LyricImporterStep.GenerateRuby + : LyricImporterStep.GenerateTimeTag; + + ScreenStack.Push(nextStep); } internal void AskForAutoAssignLanguage() diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiNavigation.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiNavigation.cs index 3b43e1001..ee2dea719 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiNavigation.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiNavigation.cs @@ -11,7 +11,6 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRubyRomaj public partial class GenerateRubyRomajiNavigation : TopNavigation { private const string auto_generate_ruby = "AUTO_GENERATE_RUBY"; - private const string auto_generate_romaji = "AUTO_GENERATE_ROMAJI"; public GenerateRubyRomajiNavigation(GenerateRubyRomajiStepScreen screen) : base(screen) @@ -43,9 +42,9 @@ static bool hasRomaji(Lyric lyric) protected override LocalisableString GetNavigationText(NavigationState value) => value switch { - NavigationState.Initial => $"Lazy to typing ruby? Press [{auto_generate_ruby}] or [{auto_generate_romaji}] to auto-generate ruby and romaji. It's very easy.", - NavigationState.Working => $"Go to next step to generate time-tag. Messing around? Press [{auto_generate_ruby}] or [{auto_generate_romaji}] again.", - NavigationState.Done => $"Go to next step to generate time-tag. Messing around? Press [{auto_generate_ruby}] or [{auto_generate_romaji}] again.", + NavigationState.Initial => $"Lazy to typing ruby? Press [{auto_generate_ruby}].", + NavigationState.Working => $"Go to next step to generate time-tag.", + NavigationState.Done => $"Go to next step to generate time-tag.", NavigationState.Error => "Oops, seems cause some error in here.", _ => throw new ArgumentOutOfRangeException(nameof(value)), }; @@ -58,7 +57,6 @@ private partial class GenerateRubyTextFlowContainer : NavigationTextContainer public GenerateRubyTextFlowContainer(GenerateRubyRomajiStepScreen screen) { AddLinkFactory(auto_generate_ruby, "auto generate ruby", screen.AskForAutoGenerateRuby); - AddLinkFactory(auto_generate_romaji, "auto generate romaji", screen.AskForAutoGenerateRomaji); } } } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiStepScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiStepScreen.cs index e400ce8a6..ca22a325c 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiStepScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiStepScreen.cs @@ -40,11 +40,9 @@ protected override void LoadComplete() { base.LoadComplete(); - // Asking auto-generate ruby or romaji. + // Asking auto-generate ruby. if (lyricPropertyAutoGenerateChangeHandler.CanGenerate(AutoGenerateType.AutoGenerateRubyTags)) AskForAutoGenerateRuby(); - else if (lyricPropertyAutoGenerateChangeHandler.CanGenerate(AutoGenerateType.AutoGenerateRomajiTags)) - AskForAutoGenerateRomaji(); } public override void Complete() @@ -64,17 +62,4 @@ internal void AskForAutoGenerateRuby() PrepareAutoGenerate(); })); } - - internal void AskForAutoGenerateRomaji() - { - SwitchLyricEditorMode(LyricEditorMode.EditRomaji); - - DialogOverlay.Push(new UseAutoGenerateRomajiPopupDialog(ok => - { - if (!ok) - return; - - PrepareAutoGenerate(); - })); - } } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateTimeTag/GenerateTimeTagStepScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateTimeTag/GenerateTimeTagStepScreen.cs index 56ab427e8..2949937f2 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateTimeTag/GenerateTimeTagStepScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateTimeTag/GenerateTimeTagStepScreen.cs @@ -9,6 +9,7 @@ using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Objects.Utils; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics; +using osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRubyRomaji; namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateTimeTag; @@ -22,11 +23,15 @@ public partial class GenerateTimeTagStepScreen : LyricImporterStepScreenWithLyri public override IconUsage Icon => FontAwesome.Solid.Tag; + [Cached(typeof(ILyricPropertyAutoGenerateChangeHandler))] + private readonly LyricPropertyAutoGenerateChangeHandler lyricPropertyAutoGenerateChangeHandler; + [Cached(typeof(ILyricTimeTagsChangeHandler))] private readonly LyricTimeTagsChangeHandler lyricTimeTagsChangeHandler; public GenerateTimeTagStepScreen() { + AddInternal(lyricPropertyAutoGenerateChangeHandler = new LyricPropertyAutoGenerateChangeHandler()); AddInternal(lyricTimeTagsChangeHandler = new LyricTimeTagsChangeHandler()); } @@ -42,7 +47,17 @@ protected override Drawable CreateContent() protected override void LoadComplete() { base.LoadComplete(); - AskForAutoGenerateTimeTag(); + + // todo: we should better way to switch between time-tag mode or romaji mode. + // or even create new step for it. + if (lyricPropertyAutoGenerateChangeHandler.CanGenerate(AutoGenerateType.AutoGenerateTimeTagRomaji)) + { + AskForAutoGenerateRomaji(); + } + else + { + AskForAutoGenerateTimeTag(); + } } public override void Complete() @@ -73,4 +88,17 @@ internal void AskForAutoGenerateTimeTag() })); } } + + internal void AskForAutoGenerateRomaji() + { + SwitchLyricEditorMode(LyricEditorMode.EditRomaji); + + DialogOverlay.Push(new UseAutoGenerateRomajiPopupDialog(ok => + { + if (!ok) + return; + + PrepareAutoGenerate(); + })); + } } From 894effaea1a9ef6fa6c0e22f0afcdb3580d509fb Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 27 Sep 2023 22:39:33 +0800 Subject: [PATCH 3/3] Adjust the namespace. --- .../GenerateRubyNavigation.cs} | 8 ++++---- .../GenerateRubyStepScreen.cs} | 8 ++++---- .../UseAutoGenerateRubyPopupDialog.cs | 2 +- .../Lyrics/GenerateTimeTag/GenerateTimeTagStepScreen.cs | 1 - .../UseAutoGenerateRomajiPopupDialog.cs | 2 +- .../Edit/Import/Lyrics/LyricImporterSubScreenStack.cs | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/{GenerateRubyRomaji/GenerateRubyRomajiNavigation.cs => GenerateRuby/GenerateRubyNavigation.cs} (88%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/{GenerateRubyRomaji/GenerateRubyRomajiStepScreen.cs => GenerateRuby/GenerateRubyStepScreen.cs} (90%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/{GenerateRubyRomaji => GenerateRuby}/UseAutoGenerateRubyPopupDialog.cs (98%) rename osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/{GenerateRubyRomaji => GenerateTimeTag}/UseAutoGenerateRomajiPopupDialog.cs (98%) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiNavigation.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRuby/GenerateRubyNavigation.cs similarity index 88% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiNavigation.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRuby/GenerateRubyNavigation.cs index ee2dea719..12042430d 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiNavigation.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRuby/GenerateRubyNavigation.cs @@ -6,13 +6,13 @@ using osu.Framework.Localisation; using osu.Game.Rulesets.Karaoke.Objects; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRubyRomaji; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRuby; -public partial class GenerateRubyRomajiNavigation : TopNavigation +public partial class GenerateRubyNavigation : TopNavigation { private const string auto_generate_ruby = "AUTO_GENERATE_RUBY"; - public GenerateRubyRomajiNavigation(GenerateRubyRomajiStepScreen screen) + public GenerateRubyNavigation(GenerateRubyStepScreen screen) : base(screen) { } @@ -54,7 +54,7 @@ protected override bool AbleToNextStep(NavigationState value) private partial class GenerateRubyTextFlowContainer : NavigationTextContainer { - public GenerateRubyTextFlowContainer(GenerateRubyRomajiStepScreen screen) + public GenerateRubyTextFlowContainer(GenerateRubyStepScreen screen) { AddLinkFactory(auto_generate_ruby, "auto generate ruby", screen.AskForAutoGenerateRuby); } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiStepScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRuby/GenerateRubyStepScreen.cs similarity index 90% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiStepScreen.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRuby/GenerateRubyStepScreen.cs index ca22a325c..c7122fb22 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/GenerateRubyRomajiStepScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRuby/GenerateRubyStepScreen.cs @@ -7,9 +7,9 @@ using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRubyRomaji; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRuby; -public partial class GenerateRubyRomajiStepScreen : LyricImporterStepScreenWithLyricEditor +public partial class GenerateRubyStepScreen : LyricImporterStepScreenWithLyricEditor { public override string Title => "Generate ruby"; @@ -22,13 +22,13 @@ public partial class GenerateRubyRomajiStepScreen : LyricImporterStepScreenWithL [Cached(typeof(ILyricPropertyAutoGenerateChangeHandler))] private readonly LyricPropertyAutoGenerateChangeHandler lyricPropertyAutoGenerateChangeHandler; - public GenerateRubyRomajiStepScreen() + public GenerateRubyStepScreen() { AddInternal(lyricPropertyAutoGenerateChangeHandler = new LyricPropertyAutoGenerateChangeHandler()); } protected override TopNavigation CreateNavigation() - => new GenerateRubyRomajiNavigation(this); + => new GenerateRubyNavigation(this); protected override Drawable CreateContent() => base.CreateContent().With(_ => diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/UseAutoGenerateRubyPopupDialog.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRuby/UseAutoGenerateRubyPopupDialog.cs similarity index 98% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/UseAutoGenerateRubyPopupDialog.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRuby/UseAutoGenerateRubyPopupDialog.cs index 5e4c5acb6..04acbddf8 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/UseAutoGenerateRubyPopupDialog.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRuby/UseAutoGenerateRubyPopupDialog.cs @@ -5,7 +5,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRubyRomaji; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRuby; public partial class UseAutoGenerateRubyPopupDialog : PopupDialog { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateTimeTag/GenerateTimeTagStepScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateTimeTag/GenerateTimeTagStepScreen.cs index 2949937f2..539c65085 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateTimeTag/GenerateTimeTagStepScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateTimeTag/GenerateTimeTagStepScreen.cs @@ -9,7 +9,6 @@ using osu.Game.Rulesets.Karaoke.Objects; using osu.Game.Rulesets.Karaoke.Objects.Utils; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics; -using osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRubyRomaji; namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateTimeTag; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/UseAutoGenerateRomajiPopupDialog.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateTimeTag/UseAutoGenerateRomajiPopupDialog.cs similarity index 98% rename from osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/UseAutoGenerateRomajiPopupDialog.cs rename to osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateTimeTag/UseAutoGenerateRomajiPopupDialog.cs index 388cfdbee..e3d9dc28e 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateRubyRomaji/UseAutoGenerateRomajiPopupDialog.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/GenerateTimeTag/UseAutoGenerateRomajiPopupDialog.cs @@ -5,7 +5,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Overlays.Dialog; -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRubyRomaji; +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateTimeTag; public partial class UseAutoGenerateRomajiPopupDialog : PopupDialog { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/LyricImporterSubScreenStack.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/LyricImporterSubScreenStack.cs index ef7834157..7be6f57f6 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/LyricImporterSubScreenStack.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Import/Lyrics/LyricImporterSubScreenStack.cs @@ -7,7 +7,7 @@ using osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.AssignLanguage; using osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.DragFile; using osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.EditLyric; -using osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRubyRomaji; +using osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateRuby; using osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.GenerateTimeTag; using osu.Game.Rulesets.Karaoke.Screens.Edit.Import.Lyrics.Success; using osu.Game.Screens; @@ -47,7 +47,7 @@ public void Push(LyricImporterStep step) return; case LyricImporterStep.GenerateRuby: - Push(new GenerateRubyRomajiStepScreen()); + Push(new GenerateRubyStepScreen()); return; case LyricImporterStep.GenerateTimeTag: