Skip to content

Commit

Permalink
Merge pull request #327 from andy840119/lyric-import/add-edit-lyric-step
Browse files Browse the repository at this point in the history
Add edit lyric in import step.
  • Loading branch information
andy840119 authored Dec 19, 2020
2 parents e0d9c29 + a7979a8 commit b3656f5
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected override Drawable CreateContent()
=> new LyricEditor
{
RelativeSizeAxes = Axes.Both,
Mode = Mode.EditMode,
Mode = Mode.ViewMode,
LyricFastEditMode = LyricFastEditMode.Language,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void ImportLyricFile(FileInfo fileInfo)

public override void Complete()
{
ScreenStack.Push(ImportLyricStep.AssignLanguage);
ScreenStack.Push(ImportLyricStep.EditLyric);
}

private PopupDialog createFileNotFoundDialog()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Timing;
using osu.Game.Rulesets.Karaoke.Edit.Lyrics;

namespace osu.Game.Rulesets.Karaoke.Edit.ImportLyric.EditLyric
{
public class EditLyricSubScreen : ImportLyricSubScreenWithTopNavigation
{
public override string Title => "Edit lyric";

public override string ShortTitle => "Edit";

public override ImportLyricStep Step => ImportLyricStep.EditLyric;

public override IconUsage Icon => FontAwesome.Solid.Globe;

[Cached]
protected readonly LyricManager LyricManager;

public EditLyricSubScreen()
{
AddInternal(LyricManager = new LyricManager());
}

protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
dependencies.CacheAs<IAdjustableClock>(clock);
dependencies.CacheAs<IFrameBasedClock>(clock);

return dependencies;
}

protected override TopNavigation CreateNavigation()
=> new EditLyricNavigation(this);

protected override Drawable CreateContent()
=> new LyricEditor
{
RelativeSizeAxes = Axes.Both,
Mode = Mode.EditMode,
LyricFastEditMode = LyricFastEditMode.None,
};

protected override void LoadComplete()
{
base.LoadComplete();
Navigation.State = NavigationState.Initial;
}

public override void Complete()
{
ScreenStack.Push(ImportLyricStep.AssignLanguage);
}

public class EditLyricNavigation : TopNavigation
{
public EditLyricNavigation(EditLyricSubScreen screen)
: base(screen)
{
}

protected override void UpdateState(NavigationState value)
{
base.UpdateState(value);

switch (value)
{
case NavigationState.Initial:
NavigationText = "Check and edit lyric if needed.";
break;

case NavigationState.Working:
case NavigationState.Done:
NavigationText = "Cool!";
break;

case NavigationState.Error:
NavigationText = "Oops, seems cause some error in here.";
break;
}
}
}
}
}
2 changes: 2 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/ImportLyric/ImportLyricStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public enum ImportLyricStep
{
ImportLyric,

EditLyric,

AssignLanguage,

GenerateRuby,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using osu.Game.Rulesets.Karaoke.Edit.ImportLyric.AssignLanguage;
using osu.Game.Rulesets.Karaoke.Edit.ImportLyric.DragFile;
using osu.Game.Rulesets.Karaoke.Edit.ImportLyric.EditLyric;
using osu.Game.Rulesets.Karaoke.Edit.ImportLyric.GenerateRuby;
using osu.Game.Rulesets.Karaoke.Edit.ImportLyric.GenerateTimeTag;
using osu.Game.Rulesets.Karaoke.Edit.ImportLyric.Success;
Expand Down Expand Up @@ -32,6 +33,10 @@ public void Push(ImportLyricStep step)
Push(new DragFileSubScreen());
return;

case ImportLyricStep.EditLyric:
Push(new EditLyricSubScreen());
return;

case ImportLyricStep.AssignLanguage:
Push(new AssignLanguageSubScreen());
return;
Expand Down

0 comments on commit b3656f5

Please sign in to comment.