diff --git a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/KaraokeSkinElementConverterTest.cs b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/KaraokeSkinElementConverterTest.cs index 446f086f7..0ffb865f4 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/KaraokeSkinElementConverterTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/KaraokeSkinElementConverterTest.cs @@ -44,40 +44,6 @@ public void TestLyricConfigDeserialize() ObjectAssert.ArePropertyEqual(expected, actual); } - [Test] - public void TestLyricLayoutSerializer() - { - var lyricLayout = new LyricLayout - { - ID = 1, - Name = "Testing layout", - Alignment = Anchor.TopLeft, - HorizontalMargin = 10, - VerticalMargin = 20, - }; - - const string expected = "{\"$type\":1,\"id\":1,\"name\":\"Testing layout\",\"alignment\":9,\"horizontal_margin\":10,\"vertical_margin\":20}"; - string actual = JsonConvert.SerializeObject(lyricLayout, CreateSettings()); - Assert.AreEqual(expected, actual); - } - - [Test] - public void TestLyricLayoutDeserialize() - { - const string json = "{\"$type\":1,\"id\":1,\"name\":\"Testing layout\",\"alignment\":9,\"horizontal_margin\":10,\"vertical_margin\":20}"; - - var expected = new LyricLayout - { - ID = 1, - Name = "Testing layout", - Alignment = Anchor.TopLeft, - HorizontalMargin = 10, - VerticalMargin = 20, - }; - var actual = (LyricLayout)JsonConvert.DeserializeObject(json, CreateSettings())!; - ObjectAssert.ArePropertyEqual(expected, actual); - } - [Test] public void TestLyricStyleSerializer() { diff --git a/osu.Game.Rulesets.Karaoke.Tests/Resources/special-skin/lyric-layouts.json b/osu.Game.Rulesets.Karaoke.Tests/Resources/special-skin/lyric-layouts.json deleted file mode 100644 index 6a3ad801a..000000000 --- a/osu.Game.Rulesets.Karaoke.Tests/Resources/special-skin/lyric-layouts.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "$type": 1, - "id": 1, - "name": "下-1", - "alignment": 36, - "horizontal_margin": 30, - "vertical_margin": 45 - }, - { - "$type": 1, - "name": "下-2", - "id": 2, - "alignment": 36, - "horizontal_margin": 30, - "vertical_margin": 45 - } -] diff --git a/osu.Game.Rulesets.Karaoke.Tests/Skinning/KaraokeBeatmapSkinDecodingTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Skinning/KaraokeBeatmapSkinDecodingTest.cs index 6c9bceb55..24347d1ec 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Skinning/KaraokeBeatmapSkinDecodingTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Skinning/KaraokeBeatmapSkinDecodingTest.cs @@ -40,22 +40,4 @@ public void TestKaraokeBeatmapSkinDefaultValue() Assert.IsNotNull(defaultLyricStyle.Name, "Default lyric style"); Assert.IsNotNull(defaultNoteStyle.Name, "Default note style"); } - - [Test] - public void TestKaraokeBeatmapSkinLayout() - { - var storage = TestResources.CreateSkinStorageResourceProvider(); - var skin = new KaraokeBeatmapSkin(new SkinInfo { Name = "special-skin" }, storage); - - var firstLyric = new Lyric(); - var secondLyric = new Lyric(); - - // try to get customized value from the skin. - var firstLyricLayout = skin.GetConfig(firstLyric)!.Value; - var secondLyricLayout = skin.GetConfig(secondLyric)!.Value; - - // There's no default layout in the skin. - Assert.IsNull(firstLyricLayout); - Assert.IsNull(secondLyricLayout); - } } diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinElementConverter.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinElementConverter.cs index 8d3af92ab..2f63c2e87 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinElementConverter.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/KaraokeSkinElementConverter.cs @@ -19,7 +19,6 @@ public static ElementType GetElementType(MemberInfo elementType) => elementType switch { _ when elementType == typeof(LyricFontInfo) => ElementType.LyricFontInfo, - _ when elementType == typeof(LyricLayout) => ElementType.LyricLayout, _ when elementType == typeof(LyricStyle) => ElementType.LyricStyle, _ when elementType == typeof(NoteStyle) => ElementType.NoteStyle, _ => throw new NotSupportedException(), @@ -29,7 +28,6 @@ public static Type GetObjectType(ElementType elementType) => elementType switch { ElementType.LyricFontInfo => typeof(LyricFontInfo), - ElementType.LyricLayout => typeof(LyricLayout), ElementType.LyricStyle => typeof(LyricStyle), ElementType.NoteStyle => typeof(NoteStyle), _ => throw new NotSupportedException(), diff --git a/osu.Game.Rulesets.Karaoke/Resources/Skin/Default/lyric-layouts.json b/osu.Game.Rulesets.Karaoke/Resources/Skin/Default/lyric-layouts.json deleted file mode 100644 index c7dea9a02..000000000 --- a/osu.Game.Rulesets.Karaoke/Resources/Skin/Default/lyric-layouts.json +++ /dev/null @@ -1,72 +0,0 @@ -[ - { - "$type": 1, - "id": 1, - "name": "下-1", - "alignment": 36, - "horizontal_margin": 30, - "vertical_margin": 45 - }, - { - "$type": 1, - "name": "下-2", - "id": 2, - "alignment": 12, - "horizontal_margin": 30, - "vertical_margin": 130 - }, - { - "$type": 1, - "name": "下-3", - "id": 3, - "alignment": 12, - "horizontal_margin": 30, - "vertical_margin": 215 - }, - { - "$type": 1, - "name": "下-4", - "id": 4, - "alignment": 12, - "horizontal_margin": 30, - "vertical_margin": 300 - }, - { - "$type": 1, - "name": "上-1", - "id": 5, - "alignment": 9, - "horizontal_margin": 30, - "vertical_margin": 115 - }, - { - "$type": 1, - "name": "上-2", - "id": 6, - "alignment": 33, - "horizontal_margin": 30, - "vertical_margin": 200 - }, - { - "$type": 1, - "name": "上-3", - "id": 7, - "alignment": 33, - "horizontal_margin": 30, - "vertical_margin": 285 - }, - { - "$type": 1, - "name": "上-4", - "id": 8, - "alignment": 33, - "horizontal_margin": 30, - "vertical_margin": 370 - }, - { - "$type": 1, - "name": "中", - "id": 9, - "alignment": 18 - } -] diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Elements/ElementType.cs b/osu.Game.Rulesets.Karaoke/Skinning/Elements/ElementType.cs index 8728c001c..60bd832d0 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Elements/ElementType.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Elements/ElementType.cs @@ -7,8 +7,6 @@ public enum ElementType { LyricFontInfo, - LyricLayout, - LyricStyle, NoteStyle, diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricLayout.cs b/osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricLayout.cs deleted file mode 100644 index 99bdc4b75..000000000 --- a/osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricLayout.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) andy840119 . Licensed under the GPL Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Graphics; -using osu.Game.Rulesets.Karaoke.Objects.Drawables; - -namespace osu.Game.Rulesets.Karaoke.Skinning.Elements; - -public class LyricLayout : IKaraokeSkinElement -{ - public int ID { get; set; } - - public string Name { get; set; } = string.Empty; - - /// - /// Group - /// - public int Group { get; set; } - - /// - /// Lyric alignment - /// - public Anchor Alignment { get; set; } = Anchor.Centre; - - /// - /// Horizontal margin - /// - public int HorizontalMargin { get; set; } - - /// - /// Vertical margin - /// - public int VerticalMargin { get; set; } - - public void ApplyTo(Drawable d) - { - if (d is not DrawableLyric drawableLyric) - throw new InvalidDrawableTypeException(nameof(d)); - - // Layout relative to parent - drawableLyric.Anchor = Alignment; - drawableLyric.Origin = Alignment; - drawableLyric.Margin = new MarginPadding - { - Left = Alignment.HasFlag(Anchor.x0) ? HorizontalMargin : 0, - Right = Alignment.HasFlag(Anchor.x2) ? HorizontalMargin : 0, - Top = Alignment.HasFlag(Anchor.y0) ? VerticalMargin : 0, - Bottom = Alignment.HasFlag(Anchor.y2) ? VerticalMargin : 0, - }; - } -} diff --git a/osu.Game.Rulesets.Karaoke/Skinning/KaraokeBeatmapSkin.cs b/osu.Game.Rulesets.Karaoke/Skinning/KaraokeBeatmapSkin.cs index d15bca7ae..b623be191 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/KaraokeBeatmapSkin.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/KaraokeBeatmapSkin.cs @@ -61,7 +61,6 @@ static string getFileNameByType(ElementType elementType) => elementType switch { ElementType.LyricFontInfo => "lyric-font-infos", - ElementType.LyricLayout => "lyric-layouts", ElementType.LyricStyle => "lyric-styles", ElementType.NoteStyle => "note-styles", _ => throw new InvalidEnumArgumentException(nameof(elementType)), @@ -98,7 +97,6 @@ static string getFileNameByType(ElementType elementType) case KaraokeIndexLookup indexLookup: return indexLookup switch { - KaraokeIndexLookup.Layout => SkinUtils.As(getSelectionFromElementType(ElementType.LyricLayout)), KaraokeIndexLookup.Style => SkinUtils.As(getSelectionFromElementType(ElementType.LyricStyle)), KaraokeIndexLookup.Note => SkinUtils.As(getSelectionFromElementType(ElementType.NoteStyle)), _ => throw new InvalidEnumArgumentException(nameof(indexLookup)), diff --git a/osu.Game.Rulesets.Karaoke/Skinning/KaraokeSkin.cs b/osu.Game.Rulesets.Karaoke/Skinning/KaraokeSkin.cs index 7f1b147c2..3f2d44d1e 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/KaraokeSkin.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/KaraokeSkin.cs @@ -130,7 +130,6 @@ public KaraokeSkin(SkinInfo skin, IStorageResourceProvider? resources, IResource return type switch { ElementType.LyricStyle or ElementType.LyricFontInfo or ElementType.NoteStyle => SkinUtils.As(new Bindable((TValue)DefaultElement[type])), - ElementType.LyricLayout => null, _ => throw new InvalidEnumArgumentException(nameof(type)), }; } @@ -164,7 +163,6 @@ public KaraokeSkin(SkinInfo skin, IStorageResourceProvider? resources, IResource => type switch { ElementType.LyricStyle or ElementType.LyricFontInfo or ElementType.NoteStyle => DefaultElement[type], - ElementType.LyricLayout => null, _ => throw new InvalidEnumArgumentException(nameof(type)), };