-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #262 from andy840119/andy840119/step-two
Add lyric editor's step two.
- Loading branch information
Showing
22 changed files
with
410 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
// 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.AssignLanguage | ||
{ | ||
public class AssignLanguageSubScreen : ImportLyricSubScreen | ||
public class AssignLanguageSubScreen : ImportLyricSubScreenWithTopNavigation | ||
{ | ||
public override string Title => "Language"; | ||
|
||
|
@@ -15,9 +19,77 @@ public class AssignLanguageSubScreen : ImportLyricSubScreen | |
|
||
public override IconUsage Icon => FontAwesome.Solid.Globe; | ||
|
||
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 AssignLanguageNavigation(this); | ||
|
||
protected override Drawable CreateContent() | ||
{ | ||
return new LyricEditor | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Mode = Mode.EditMode, | ||
LyricFastEditMode = LyricFastEditMode.Language, | ||
FontSize = 26 | ||
}; | ||
} | ||
|
||
protected override void LoadComplete() | ||
{ | ||
base.LoadComplete(); | ||
Navigation.State = NavigationState.Initial; | ||
AskForAutoAssignLanguage(); | ||
} | ||
|
||
public override void Complete() | ||
{ | ||
ScreenStack.Push(ImportLyricStep.GenerateRuby); | ||
} | ||
|
||
protected void AskForAutoAssignLanguage() | ||
{ | ||
DialogOverlay.Push(new UseLanguageDetectorPopupDialog(ok => | ||
{ | ||
// todo : call manager to do that. | ||
})); | ||
} | ||
|
||
public class AssignLanguageNavigation : TopNavigation | ||
{ | ||
public AssignLanguageNavigation(ImportLyricSubScreen screen) | ||
: base(screen) | ||
{ | ||
} | ||
|
||
protected override void UpdateState(NavigationState value) | ||
{ | ||
base.UpdateState(value); | ||
|
||
switch (value) | ||
{ | ||
case NavigationState.Initial: | ||
NavigationText = "Try to select left side to mark lyric's language."; | ||
break; | ||
case NavigationState.Working: | ||
NavigationText = "Almost there/"; | ||
break; | ||
case NavigationState.Done: | ||
NavigationText = "Cool! Seems all lyric has it's own language. Go to next step to generate ruby."; | ||
break; | ||
case NavigationState.Error: | ||
NavigationText = "Oops, seems cause some error in here."; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
osu.Game.Rulesets.Karaoke/Edit/ImportLyric/AssignLanguage/UseLanguageDetectorPopupDialog.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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.Graphics.Sprites; | ||
using osu.Game.Overlays.Dialog; | ||
using System; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.ImportLyric.AssignLanguage | ||
{ | ||
public class UseLanguageDetectorPopupDialog : PopupDialog | ||
{ | ||
public UseLanguageDetectorPopupDialog(Action<bool> okAction = null) | ||
{ | ||
Icon = FontAwesome.Solid.Globe; | ||
HeaderText = "LanguageDetector"; | ||
BodyText = $"Would you like to use language detector to auto assign each lyric's language?"; | ||
Buttons = new PopupDialogButton[] | ||
{ | ||
new PopupDialogOkButton | ||
{ | ||
Text = @"OK", | ||
Action = () => okAction?.Invoke(true), | ||
}, | ||
new PopupDialogCancelButton | ||
{ | ||
Text = @"Cancel", | ||
Action = () => okAction?.Invoke(false), | ||
}, | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
// 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.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Sprites; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.ImportLyric.GenerateRuby | ||
{ | ||
public class GenerateRubySubScreen : ImportLyricSubScreen | ||
public class GenerateRubySubScreen : ImportLyricSubScreenWithTopNavigation | ||
{ | ||
public override string Title => "Generate ruby"; | ||
|
||
|
@@ -15,9 +17,30 @@ public class GenerateRubySubScreen : ImportLyricSubScreen | |
|
||
public override IconUsage Icon => FontAwesome.Solid.Gem; | ||
|
||
protected override TopNavigation CreateNavigation() | ||
=> new GenerateRubyNavigation(this); | ||
|
||
protected override Drawable CreateContent() | ||
=> new Container(); | ||
|
||
public override void Complete() | ||
{ | ||
ScreenStack.Push(ImportLyricStep.GenerateTimeTag); | ||
} | ||
|
||
public class GenerateRubyNavigation : TopNavigation | ||
{ | ||
public GenerateRubyNavigation(ImportLyricSubScreen screen) | ||
: base(screen) | ||
{ | ||
} | ||
|
||
protected override void UpdateState(NavigationState value) | ||
{ | ||
base.UpdateState(value); | ||
|
||
// todo : update text | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
// 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.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics.Sprites; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.ImportLyric.GenerateTimeTag | ||
{ | ||
public class GenerateTimeTagSubScreen : ImportLyricSubScreen | ||
public class GenerateTimeTagSubScreen : ImportLyricSubScreenWithTopNavigation | ||
{ | ||
public override string Title => "Generate time tag"; | ||
|
||
|
@@ -15,9 +17,30 @@ public class GenerateTimeTagSubScreen : ImportLyricSubScreen | |
|
||
public override IconUsage Icon => FontAwesome.Solid.Tag; | ||
|
||
protected override TopNavigation CreateNavigation() | ||
=> new GenerateTimeTagNavigation(this); | ||
|
||
protected override Drawable CreateContent() | ||
=> new Container(); | ||
|
||
public override void Complete() | ||
{ | ||
ScreenStack.Push(ImportLyricStep.Success); | ||
} | ||
|
||
public class GenerateTimeTagNavigation : TopNavigation | ||
{ | ||
public GenerateTimeTagNavigation(ImportLyricSubScreen screen) | ||
: base(screen) | ||
{ | ||
} | ||
|
||
protected override void UpdateState(NavigationState value) | ||
{ | ||
base.UpdateState(value); | ||
|
||
// todo : update text | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.