From a370b0988cf673aa5539a072a0a11596174e656b Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sun, 23 Jun 2024 17:33:19 +0800 Subject: [PATCH] Rename the property. --- .../Edit/Beatmap/Lyrics/LyricEditorTest.cs | 12 +++++----- .../KaraokeRulesetLyricEditorConfigManager.cs | 2 +- .../Edit/Beatmaps/Lyrics/LyricEditor.cs | 24 +++++++++---------- .../Edit/Beatmaps/Lyrics/LyricEditorLayout.cs | 11 +++++++-- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/LyricEditorTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/LyricEditorTest.cs index 0b6d47bc3..bbcbe2cbf 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/LyricEditorTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/LyricEditorTest.cs @@ -8,12 +8,12 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Screens.Edit.Beatmap.Lyrics; public class LyricEditorTest { - [TestCase(LyricEditorLayout.Preview, LyricEditorLayout.Preview, LyricEditorLayout.Preview)] - [TestCase(LyricEditorLayout.Detail, LyricEditorLayout.Detail, LyricEditorLayout.Detail)] - [TestCase(LyricEditorLayout.Preview | LyricEditorLayout.Detail, LyricEditorLayout.Preview, LyricEditorLayout.Preview)] - [TestCase(LyricEditorLayout.Preview | LyricEditorLayout.Detail, LyricEditorLayout.Detail, LyricEditorLayout.Detail)] - [TestCase(LyricEditorLayout.Preview, LyricEditorLayout.Detail, LyricEditorLayout.Preview)] // should use the support layout if prefer layout is not matched. - [TestCase(LyricEditorLayout.Detail, LyricEditorLayout.Preview, LyricEditorLayout.Detail)] + [TestCase(LyricEditorLayout.List, LyricEditorLayout.List, LyricEditorLayout.List)] + [TestCase(LyricEditorLayout.Compose, LyricEditorLayout.Compose, LyricEditorLayout.Compose)] + [TestCase(LyricEditorLayout.List | LyricEditorLayout.Compose, LyricEditorLayout.List, LyricEditorLayout.List)] + [TestCase(LyricEditorLayout.List | LyricEditorLayout.Compose, LyricEditorLayout.Compose, LyricEditorLayout.Compose)] + [TestCase(LyricEditorLayout.List, LyricEditorLayout.Compose, LyricEditorLayout.List)] // should use the support layout if prefer layout is not matched. + [TestCase(LyricEditorLayout.Compose, LyricEditorLayout.List, LyricEditorLayout.Compose)] public void TestGetSuitableLayout(LyricEditorLayout supportedLayout, LyricEditorLayout preferLayout, LyricEditorLayout actualLayout) { var expectedLayout = LyricEditor.GetSuitableLayout(supportedLayout, preferLayout); diff --git a/osu.Game.Rulesets.Karaoke/Configuration/KaraokeRulesetLyricEditorConfigManager.cs b/osu.Game.Rulesets.Karaoke/Configuration/KaraokeRulesetLyricEditorConfigManager.cs index 4925c647c..89d32e788 100644 --- a/osu.Game.Rulesets.Karaoke/Configuration/KaraokeRulesetLyricEditorConfigManager.cs +++ b/osu.Game.Rulesets.Karaoke/Configuration/KaraokeRulesetLyricEditorConfigManager.cs @@ -17,7 +17,7 @@ protected override void InitialiseDefaults() base.InitialiseDefaults(); // General - SetDefault(KaraokeRulesetLyricEditorSetting.LyricEditorPreferLayout, LyricEditorLayout.Preview); + SetDefault(KaraokeRulesetLyricEditorSetting.LyricEditorPreferLayout, LyricEditorLayout.List); SetDefault(KaraokeRulesetLyricEditorSetting.LyricEditorFontSize, FontUtils.DEFAULT_FONT_SIZE); SetDefault(KaraokeRulesetLyricEditorSetting.AutoFocusToEditLyric, true); SetDefault(KaraokeRulesetLyricEditorSetting.AutoFocusToEditLyricSkipRows, 1, 0, 4); diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditor.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditor.cs index da8209966..61740a30a 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditor.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditor.cs @@ -79,7 +79,7 @@ public partial class LyricEditor : Container, ILyricEditorState, IKeyBindingHand private readonly Bindable bindableMode = new(); private readonly Bindable bindableModeWithEditStep = new(); - private readonly IBindable bindablePreferLayout = new Bindable(LyricEditorLayout.Preview); + private readonly IBindable bindablePreferLayout = new Bindable(LyricEditorLayout.List); private readonly Bindable bindableCurrentLayout = new(); public IBindable BindableMode => bindableMode; @@ -288,15 +288,15 @@ private void reCalculateLayout() static LyricEditorLayout getSupportedLayout(LyricEditorMode mode) => mode switch { - LyricEditorMode.View => LyricEditorLayout.Preview, - LyricEditorMode.EditText => LyricEditorLayout.Preview | LyricEditorLayout.Detail, - LyricEditorMode.EditReferenceLyric => LyricEditorLayout.Preview | LyricEditorLayout.Detail, - LyricEditorMode.EditLanguage => LyricEditorLayout.Preview | LyricEditorLayout.Detail, - LyricEditorMode.EditRuby => LyricEditorLayout.Preview | LyricEditorLayout.Detail, - LyricEditorMode.EditTimeTag => LyricEditorLayout.Detail, - LyricEditorMode.EditRomanisation => LyricEditorLayout.Preview | LyricEditorLayout.Detail, - LyricEditorMode.EditNote => LyricEditorLayout.Detail, - LyricEditorMode.EditSinger => LyricEditorLayout.Preview, + LyricEditorMode.View => LyricEditorLayout.List, + LyricEditorMode.EditText => LyricEditorLayout.List | LyricEditorLayout.Compose, + LyricEditorMode.EditReferenceLyric => LyricEditorLayout.List | LyricEditorLayout.Compose, + LyricEditorMode.EditLanguage => LyricEditorLayout.List | LyricEditorLayout.Compose, + LyricEditorMode.EditRuby => LyricEditorLayout.List | LyricEditorLayout.Compose, + LyricEditorMode.EditTimeTag => LyricEditorLayout.Compose, + LyricEditorMode.EditRomanisation => LyricEditorLayout.List | LyricEditorLayout.Compose, + LyricEditorMode.EditNote => LyricEditorLayout.Compose, + LyricEditorMode.EditSinger => LyricEditorLayout.List, _ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null), }; } @@ -345,7 +345,7 @@ private void switchLayout(LyricEditorLayout layout) static Container getContent(LyricEditorLayout layout) => layout switch { - LyricEditorLayout.Preview => new Container + LyricEditorLayout.List => new Container { Children = new[] { @@ -355,7 +355,7 @@ static Container getContent(LyricEditorLayout layout) => }, }, }, - LyricEditorLayout.Detail => new Container + LyricEditorLayout.Compose => new Container { Children = new Drawable[] { diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorLayout.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorLayout.cs index 9449d9071..fcc7d3fb2 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorLayout.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Lyrics/LyricEditorLayout.cs @@ -8,7 +8,14 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Lyrics; [Flags] public enum LyricEditorLayout { - Preview = 1, + /// + /// Show the list of lyrics in the main content area. + /// + List = 1, - Detail = 1 << 1, + /// + /// Show the compose area at the top of the main content area. + /// User can select the edit lyric at the bottom of the compose area. + /// + Compose = 1 << 1, }