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) { } 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/GenerateRuby/GenerateRubyNavigation.cs similarity index 72% 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 3b43e1001..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,14 +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"; - private const string auto_generate_romaji = "AUTO_GENERATE_ROMAJI"; - public GenerateRubyRomajiNavigation(GenerateRubyRomajiStepScreen screen) + public GenerateRubyNavigation(GenerateRubyStepScreen 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)), }; @@ -55,10 +54,9 @@ 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); - 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/GenerateRuby/GenerateRubyStepScreen.cs similarity index 72% 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 e400ce8a6..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(_ => @@ -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/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 56ab427e8..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 @@ -22,11 +22,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 +46,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 +87,17 @@ internal void AskForAutoGenerateTimeTag() })); } } + + 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/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: