Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust lyric import step. #2137

Merged
merged 3 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<GenerateRubyRomajiStepScreen>
public partial class GenerateRubyNavigation : TopNavigation<GenerateRubyStepScreen>
{
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)
{
}
Expand Down Expand Up @@ -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)),
};
Expand All @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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(_ =>
Expand All @@ -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()
Expand All @@ -64,17 +62,4 @@ internal void AskForAutoGenerateRuby()
PrepareAutoGenerate();
}));
}

internal void AskForAutoGenerateRomaji()
{
SwitchLyricEditorMode(LyricEditorMode.EditRomaji);

DialogOverlay.Push(new UseAutoGenerateRomajiPopupDialog(ok =>
{
if (!ok)
return;

PrepareAutoGenerate();
}));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand All @@ -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()
Expand Down Expand Up @@ -73,4 +87,17 @@ internal void AskForAutoGenerateTimeTag()
}));
}
}

internal void AskForAutoGenerateRomaji()
{
SwitchLyricEditorMode(LyricEditorMode.EditRomaji);

DialogOverlay.Push(new UseAutoGenerateRomajiPopupDialog(ok =>
{
if (!ok)
return;

PrepareAutoGenerate();
}));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -47,7 +47,7 @@ public void Push(LyricImporterStep step)
return;

case LyricImporterStep.GenerateRuby:
Push(new GenerateRubyRomajiStepScreen());
Push(new GenerateRubyStepScreen());
return;

case LyricImporterStep.GenerateTimeTag:
Expand Down