diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/AutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/AutoGenerateSection.cs new file mode 100644 index 000000000..cc298a0f3 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/AutoGenerateSection.cs @@ -0,0 +1,21 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Localisation; + +namespace osu.Game.Rulesets.Karaoke.Screens.Edit; + +public abstract partial class AutoGenerateSection : EditorSection +{ + protected sealed override LocalisableString Title => "Auto generate"; + + protected AutoGenerateSection() + { + Children = new[] + { + CreateAutoGenerateSubsection() + }; + } + + protected abstract AutoGenerateSubsection CreateAutoGenerateSubsection(); +} diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/AutoGenerateSubsection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/AutoGenerateSubsection.cs new file mode 100644 index 000000000..89e2b77b2 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/AutoGenerateSubsection.cs @@ -0,0 +1,152 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics.UserInterface; +using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Rulesets.Karaoke.Configuration; +using osu.Game.Rulesets.Karaoke.Screens.Edit.Components.Markdown; +using osuTK; + +namespace osu.Game.Rulesets.Karaoke.Screens.Edit; + +public abstract partial class AutoGenerateSubsection : FillFlowContainer +{ + private const int horizontal_padding = 20; + + protected AutoGenerateSubsection() + { + RelativeSizeAxes = Axes.X; + AutoSizeAxes = Axes.Y; + } + + [BackgroundDependencyLoader] + private void load() + { + // should wait until BDL in the parent class has been loaded. + Schedule(() => + { + Children = new Drawable[] + { + new GridContainer + { + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + ColumnDimensions = new[] + { + new Dimension(), + new Dimension(GridSizeMode.Absolute, 5), + new Dimension(GridSizeMode.Absolute, 36) + }, + RowDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize) + }, + Content = new[] + { + new Drawable?[] + { + CreateGenerateButton(), + null, + CreateConfigButton().With(x => + { + x.Anchor = Anchor.Centre; + x.Origin = Anchor.Centre; + x.Size = new Vector2(36); + }) + } + }, + }, + CreateDescriptionTextFlowContainer().With(x => + { + x.RelativeSizeAxes = Axes.X; + x.AutoSizeAxes = Axes.Y; + x.Padding = new MarginPadding { Horizontal = horizontal_padding }; + x.Description = CreateInvalidLyricDescriptionFormat(); + }) + }; + }); + } + + protected abstract OsuButton CreateGenerateButton(); + + protected virtual DescriptionTextFlowContainer CreateDescriptionTextFlowContainer() => new(); + + protected abstract DescriptionFormat CreateInvalidLyricDescriptionFormat(); + + protected abstract ConfigButton CreateConfigButton(); + + protected abstract partial class ConfigButton : IconButton, IHasPopover + { + protected ConfigButton() + { + Icon = FontAwesome.Solid.Cog; + Action = openConfigSetting; + + void openConfigSetting() + => this.ShowPopover(); + } + + public abstract Popover GetPopover(); + } + + protected abstract partial class MultiConfigButton : ConfigButton + { + private KaraokeRulesetEditGeneratorSetting? selectedSetting; + + protected MultiConfigButton() + { + Action = this.ShowPopover; + } + + public override Popover GetPopover() + { + if (selectedSetting == null) + return createSelectionPopover(); + + return GetPopoverBySettingType(selectedSetting.Value); + } + + protected abstract IEnumerable AvailableSettings { get; } + + protected abstract string GetDisplayName(KaraokeRulesetEditGeneratorSetting setting); + + protected abstract Popover GetPopoverBySettingType(KaraokeRulesetEditGeneratorSetting setting); + + private Popover createSelectionPopover() + => new OsuPopover + { + Child = new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(10), + Children = AvailableSettings.Select(x => + { + string name = GetDisplayName(x); + return new OsuButton + { + Text = name, + Width = 150, + Action = () => + { + selectedSetting = x; + this.ShowPopover(); + + // after show config pop-over, should make the state back for able to show this dialog next time. + selectedSetting = null; + }, + }; + }).ToList() + } + }; + } +} diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/AutoGenerateSubsection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/AutoGenerateSubsection.cs deleted file mode 100644 index 15a8495af..000000000 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/AutoGenerateSubsection.cs +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) andy840119 . Licensed under the GPL Licence. -// See the LICENCE file in the repository root for full licence text. - -#nullable disable - -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Extensions; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.UserInterface; -using osu.Framework.Localisation; -using osu.Game.Graphics; -using osu.Game.Graphics.UserInterface; -using osu.Game.Graphics.UserInterfaceV2; -using osu.Game.Rulesets.Karaoke.Configuration; -using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; -using osu.Game.Rulesets.Karaoke.Objects; -using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings.Components.Markdown; -using osu.Game.Rulesets.Karaoke.Screens.Edit.Components.Markdown; -using osuTK; - -namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings -{ - public abstract partial class AutoGenerateSubsection : FillFlowContainer - { - private const int horizontal_padding = 20; - - private readonly LyricAutoGenerateProperty autoGenerateProperty; - - protected AutoGenerateSubsection(LyricAutoGenerateProperty autoGenerateProperty) - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - - this.autoGenerateProperty = autoGenerateProperty; - } - - [BackgroundDependencyLoader] - private void load(ILyricAutoGenerateChangeHandler lyricAutoGenerateChangeHandler, OsuColour colours) - { - // should wait until BDL in the parent class has been loaded. - Schedule(() => - { - Children = new Drawable[] - { - new GridContainer - { - AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, - ColumnDimensions = new[] - { - new Dimension(), - new Dimension(GridSizeMode.Absolute, 5), - new Dimension(GridSizeMode.Absolute, 36) - }, - RowDimensions = new[] - { - new Dimension(GridSizeMode.AutoSize) - }, - Content = new[] - { - new Drawable[] - { - new AutoGenerateButton(autoGenerateProperty), - null, - CreateConfigButton().With(x => - { - x.Anchor = Anchor.Centre; - x.Origin = Anchor.Centre; - x.Size = new Vector2(36); - }) - } - }, - }, - new LyricEditorDescriptionTextFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Padding = new MarginPadding { Horizontal = horizontal_padding }, - Description = CreateInvalidLyricDescriptionFormat() - } - }; - }); - } - - protected abstract DescriptionFormat CreateInvalidLyricDescriptionFormat(); - - protected abstract ConfigButton CreateConfigButton(); - - private partial class AutoGenerateButton : SelectLyricButton - { - [Resolved] - private ILyricAutoGenerateChangeHandler lyricAutoGenerateChangeHandler { get; set; } - - private readonly LyricAutoGenerateProperty autoGenerateProperty; - - public AutoGenerateButton(LyricAutoGenerateProperty autoGenerateProperty) - { - this.autoGenerateProperty = autoGenerateProperty; - } - - protected override LocalisableString StandardText => "Generate"; - - protected override LocalisableString SelectingText => "Cancel generate"; - - protected override IDictionary GetDisableSelectingLyrics() - { - return lyricAutoGenerateChangeHandler.GetNotGeneratableLyrics(autoGenerateProperty); - } - - protected override void Apply() - { - lyricAutoGenerateChangeHandler.AutoGenerate(autoGenerateProperty); - } - } - - protected abstract partial class ConfigButton : IconButton, IHasPopover - { - protected ConfigButton() - { - Icon = FontAwesome.Solid.Cog; - Action = openConfigSetting; - - void openConfigSetting() - => this.ShowPopover(); - } - - public abstract Popover GetPopover(); - } - - protected abstract partial class MultiConfigButton : ConfigButton - { - private KaraokeRulesetEditGeneratorSetting? selectedSetting; - - protected MultiConfigButton() - { - Action = this.ShowPopover; - } - - public override Popover GetPopover() - { - if (selectedSetting == null) - return createSelectionPopover(); - - return GetPopoverBySettingType(selectedSetting.Value); - } - - protected abstract IEnumerable AvailableSettings { get; } - - protected abstract string GetDisplayName(KaraokeRulesetEditGeneratorSetting setting); - - protected abstract Popover GetPopoverBySettingType(KaraokeRulesetEditGeneratorSetting setting); - - private Popover createSelectionPopover() - => new OsuPopover - { - Child = new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Direction = FillDirection.Vertical, - Spacing = new Vector2(10), - Children = AvailableSettings.Select(x => - { - string name = GetDisplayName(x); - return new OsuButton - { - Text = name, - Width = 150, - Action = () => - { - selectedSetting = x; - this.ShowPopover(); - - // after show config pop-over, should make the state back for able to show this dialog next time. - selectedSetting = null; - }, - }; - }).ToList() - } - }; - } - } -} diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Language/LanguageAutoGenerateSubsection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Language/LanguageAutoGenerateSubsection.cs index 678ae88f9..97b60308c 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Language/LanguageAutoGenerateSubsection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Language/LanguageAutoGenerateSubsection.cs @@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings.Language { - public partial class LanguageAutoGenerateSubsection : AutoGenerateSubsection + public partial class LanguageAutoGenerateSubsection : LyricEditorAutoGenerateSubsection { private const string typing_mode = "TYPING_MODE"; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LyricEditorAutoGenerateSubsection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LyricEditorAutoGenerateSubsection.cs new file mode 100644 index 000000000..ff7f00944 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LyricEditorAutoGenerateSubsection.cs @@ -0,0 +1,58 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using osu.Framework.Allocation; +using osu.Framework.Localisation; +using osu.Game.Graphics.UserInterface; +using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; +using osu.Game.Rulesets.Karaoke.Objects; +using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings.Components.Markdown; +using osu.Game.Rulesets.Karaoke.Screens.Edit.Components.Markdown; + +namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings +{ + public abstract partial class LyricEditorAutoGenerateSubsection : AutoGenerateSubsection + { + private readonly LyricAutoGenerateProperty autoGenerateProperty; + + protected LyricEditorAutoGenerateSubsection(LyricAutoGenerateProperty autoGenerateProperty) + { + this.autoGenerateProperty = autoGenerateProperty; + } + + protected override OsuButton CreateGenerateButton() + => new AutoGenerateButton(autoGenerateProperty); + + protected sealed override DescriptionTextFlowContainer CreateDescriptionTextFlowContainer() + => new LyricEditorDescriptionTextFlowContainer(); + + private partial class AutoGenerateButton : SelectLyricButton + { + [Resolved, AllowNull] + private ILyricAutoGenerateChangeHandler lyricAutoGenerateChangeHandler { get; set; } + + private readonly LyricAutoGenerateProperty autoGenerateProperty; + + public AutoGenerateButton(LyricAutoGenerateProperty autoGenerateProperty) + { + this.autoGenerateProperty = autoGenerateProperty; + } + + protected override LocalisableString StandardText => "Generate"; + + protected override LocalisableString SelectingText => "Cancel generate"; + + protected override IDictionary GetDisableSelectingLyrics() + { + return lyricAutoGenerateChangeHandler.GetNotGeneratableLyrics(autoGenerateProperty); + } + + protected override void Apply() + { + lyricAutoGenerateChangeHandler.AutoGenerate(autoGenerateProperty); + } + } + } +} diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LyricEditorEditModeSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LyricEditorEditModeSection.cs index 81c8164b7..aca804e8a 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LyricEditorEditModeSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/LyricEditorEditModeSection.cs @@ -32,8 +32,6 @@ internal sealed override void UpdateEditMode(TEditMode mode) public abstract partial class LyricEditorEditModeSection : EditModeSection where TEditMode : Enum { - protected sealed override LocalisableString Title => "Edit mode"; - [Resolved] private ILyricSelectionState lyricSelectionState { get; set; } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Notes/NoteAutoGenerateSubsection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Notes/NoteAutoGenerateSubsection.cs index 14429f728..3dfb606df 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Notes/NoteAutoGenerateSubsection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Notes/NoteAutoGenerateSubsection.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings.Notes /// But need to make sure that lyric should not have any /// If found any issue, will navigate to target lyric. /// - public partial class NoteAutoGenerateSubsection : AutoGenerateSubsection + public partial class NoteAutoGenerateSubsection : LyricEditorAutoGenerateSubsection { private const string create_time_tag_mode = "CREATE_TIME_TAG_MODE"; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/ReferenceLyricAutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/ReferenceLyricAutoGenerateSection.cs index 327ae250c..ba9cf567b 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/ReferenceLyricAutoGenerateSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/Reference/ReferenceLyricAutoGenerateSection.cs @@ -2,26 +2,18 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics.UserInterface; -using osu.Framework.Localisation; using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Configs.Generator.Lyrics.ReferenceLyric; using osu.Game.Rulesets.Karaoke.Screens.Edit.Components.Markdown; namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings.Reference { - public partial class ReferenceLyricAutoGenerateSection : EditorSection + public partial class ReferenceLyricAutoGenerateSection : AutoGenerateSection { - protected override LocalisableString Title => "Auto generate"; + protected override AutoGenerateSubsection CreateAutoGenerateSubsection() + => new ReferenceLyricAutoGenerateSubsection(); - public ReferenceLyricAutoGenerateSection() - { - Children = new[] - { - new ReferenceLyricAutoGenerateSubsection() - }; - } - - private partial class ReferenceLyricAutoGenerateSubsection : AutoGenerateSubsection + private partial class ReferenceLyricAutoGenerateSubsection : LyricEditorAutoGenerateSubsection { public ReferenceLyricAutoGenerateSubsection() : base(LyricAutoGenerateProperty.DetectReferenceLyric) diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/RomajiTagAutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/RomajiTagAutoGenerateSection.cs index 8f93c4168..892e8e133 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/RomajiTagAutoGenerateSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/RomajiTagAutoGenerateSection.cs @@ -1,8 +1,6 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using osu.Framework.Graphics.UserInterface; @@ -14,13 +12,8 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings.RubyRo { public partial class RomajiTagAutoGenerateSection : TextTagAutoGenerateSection { - public RomajiTagAutoGenerateSection() - { - Children = new[] - { - new RomajiTagAutoGenerateSubsection() - }; - } + protected override AutoGenerateSubsection CreateAutoGenerateSubsection() + => new RomajiTagAutoGenerateSubsection(); private partial class RomajiTagAutoGenerateSubsection : TextTagAutoGenerateSubsection { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/RubyTagAutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/RubyTagAutoGenerateSection.cs index 080b5a431..96b6bf58e 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/RubyTagAutoGenerateSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/RubyTagAutoGenerateSection.cs @@ -1,8 +1,6 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using osu.Framework.Graphics.UserInterface; @@ -14,13 +12,8 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings.RubyRo { public partial class RubyTagAutoGenerateSection : TextTagAutoGenerateSection { - public RubyTagAutoGenerateSection() - { - Children = new[] - { - new RubyTagAutoGenerateSubsection() - }; - } + protected override AutoGenerateSubsection CreateAutoGenerateSubsection() + => new RubyTagAutoGenerateSubsection(); private partial class RubyTagAutoGenerateSubsection : TextTagAutoGenerateSubsection { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/TextTagAutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/TextTagAutoGenerateSection.cs index 888d87739..c7c1ca8cf 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/TextTagAutoGenerateSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/RubyRomaji/TextTagAutoGenerateSection.cs @@ -1,21 +1,16 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using J2N.Collections.Generic; -using osu.Framework.Localisation; using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings.Components.Markdown; using osu.Game.Rulesets.Karaoke.Screens.Edit.Components.Markdown; namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings.RubyRomaji { - public abstract partial class TextTagAutoGenerateSection : EditorSection + public abstract partial class TextTagAutoGenerateSection : AutoGenerateSection { - protected sealed override LocalisableString Title => "Auto generate"; - - protected abstract partial class TextTagAutoGenerateSubsection : AutoGenerateSubsection + protected abstract partial class TextTagAutoGenerateSubsection : LyricEditorAutoGenerateSubsection { private const string language_mode = "LANGUAGE_MODE"; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/TimeTagAutoGenerateSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/TimeTagAutoGenerateSection.cs index 231070ff3..64919e74c 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/TimeTagAutoGenerateSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/Settings/TimeTags/TimeTagAutoGenerateSection.cs @@ -1,12 +1,9 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -#nullable disable - using System; using System.Collections.Generic; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Localisation; using osu.Game.Rulesets.Karaoke.Configuration; using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; using osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Configs.Generator.Lyrics.TimeTags.Ja; @@ -16,19 +13,12 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics.Settings.TimeTags { - public partial class TimeTagAutoGenerateSection : EditorSection + public partial class TimeTagAutoGenerateSection : AutoGenerateSection { - protected override LocalisableString Title => "Auto generate"; - - public TimeTagAutoGenerateSection() - { - Children = new[] - { - new TimeTageAutoGenerateSubsection() - }; - } + protected override AutoGenerateSubsection CreateAutoGenerateSubsection() + => new TimeTageAutoGenerateSubsection(); - private partial class TimeTageAutoGenerateSubsection : AutoGenerateSubsection + private partial class TimeTageAutoGenerateSubsection : LyricEditorAutoGenerateSubsection { private const string language_mode = "LANGUAGE_MODE"; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/PageEditorEditModeSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/PageEditorEditModeSection.cs index 7d7eb7975..d4c552ad6 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/PageEditorEditModeSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/PageEditorEditModeSection.cs @@ -17,8 +17,6 @@ public partial class PageEditorEditModeSection : EditModeSection "Edit mode"; - protected override PageEditorEditMode DefaultMode() => pageStateProvider.EditMode; diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/EditModeSection.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/EditModeSection.cs index 67c22f837..1c01391b5 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/EditModeSection.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/EditModeSection.cs @@ -28,6 +28,8 @@ public abstract partial class EditModeSection : EditorSection where T { private const int horizontal_padding = 20; + protected sealed override LocalisableString Title => "Edit mode"; + [Cached] private readonly OverlayColourProvider overlayColourProvider;