From dbfa23e7f85750a6ab7c94021ebe4f27e53b7583 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 6 Dec 2024 23:24:05 +0800 Subject: [PATCH 1/3] Remove the drawable layout preview because layout arrangement will be controlled by stage info, not skin. --- .../Editor/TestSceneLayoutToolTip.cs | 101 -------------- .../Edit/Components/Cursor/LayoutToolTip.cs | 47 ------- .../Sprites/DrawableLayoutPreview.cs | 127 ------------------ 3 files changed, 275 deletions(-) delete mode 100644 osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLayoutToolTip.cs delete mode 100644 osu.Game.Rulesets.Karaoke/Edit/Components/Cursor/LayoutToolTip.cs delete mode 100644 osu.Game.Rulesets.Karaoke/Edit/Components/Sprites/DrawableLayoutPreview.cs diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLayoutToolTip.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLayoutToolTip.cs deleted file mode 100644 index e3f04358d..000000000 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLayoutToolTip.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) andy840119 . Licensed under the GPL Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using JetBrains.Annotations; -using NUnit.Framework; -using osu.Framework.Graphics; -using osu.Game.IO; -using osu.Game.Rulesets.Karaoke.Edit.Components.Cursor; -using osu.Game.Rulesets.Karaoke.Extensions; -using osu.Game.Rulesets.Karaoke.Objects; -using osu.Game.Rulesets.Karaoke.Skinning; -using osu.Game.Rulesets.Karaoke.Skinning.Elements; -using osu.Game.Skinning; -using osu.Game.Tests.Visual; - -namespace osu.Game.Rulesets.Karaoke.Tests.Editor; - -[TestFixture] -public partial class TestSceneLayoutToolTip : OsuTestScene -{ - private readonly ISkin skin = new TestingSkin(null); - private LayoutToolTip toolTip = null!; - - [SetUp] - public void SetUp() => Schedule(() => - { - Child = new SkinProvidingContainer(skin) - { - RelativeSizeAxes = Axes.Both, - Child = toolTip = new LayoutToolTip - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - }; - toolTip.Show(); - }); - - [Test] - public void TestDisplayToolTip() - { - var layouts = skin.GetConfig>(KaraokeIndexLookup.Layout)?.Value; - if (layouts == null) - return; - - foreach ((int key, string value) in layouts) - { - setTooltip($"Test lyric with layout {value}", lyric => - { - // todo: should change mapping group id from the lyric. - }); - } - } - - private void setTooltip(string testName, Action callBack) - { - AddStep(testName, () => - { - var singer = new Lyric - { - Text = "karaoke!", - }; - callBack(singer); - toolTip.SetContent(singer); - }); - } - - /// - /// todo: it's a tricky way to create ruleset's own skin class. - /// should use generic skin like eventually. - /// - public class TestingSkin : KaraokeSkin - { - internal static readonly Guid DEFAULT_SKIN = new("FEC5A291-5709-11EC-9F10-0800200C9A66"); - - public static SkinInfo CreateInfo() => new() - { - ID = DEFAULT_SKIN, - Name = "karaoke! (default skin)", - Creator = "team karaoke!", - Protected = true, - InstantiationInfo = typeof(TestingSkin).GetInvariantInstantiationInfo(), - }; - - public TestingSkin(IStorageResourceProvider? resources) - : this(CreateInfo(), resources) - { - } - - [UsedImplicitly(ImplicitUseKindFlags.InstantiatedWithFixedConstructorSignature)] - public TestingSkin(SkinInfo skin, IStorageResourceProvider? resources) - : base(skin, resources) - { - DefaultElement[ElementType.LyricFontInfo] = LyricFontInfo.CreateDefault(); - DefaultElement[ElementType.LyricStyle] = LyricStyle.CreateDefault(); - DefaultElement[ElementType.NoteStyle] = NoteStyle.CreateDefault(); - } - } -} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Components/Cursor/LayoutToolTip.cs b/osu.Game.Rulesets.Karaoke/Edit/Components/Cursor/LayoutToolTip.cs deleted file mode 100644 index aa7dc007b..000000000 --- a/osu.Game.Rulesets.Karaoke/Edit/Components/Cursor/LayoutToolTip.cs +++ /dev/null @@ -1,47 +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.Allocation; -using osu.Game.Rulesets.Karaoke.Edit.Components.Sprites; -using osu.Game.Rulesets.Karaoke.Graphics.Cursor; -using osu.Game.Rulesets.Karaoke.Objects; -using osu.Game.Rulesets.Karaoke.Skinning.Elements; -using osu.Game.Skinning; -using osuTK; - -namespace osu.Game.Rulesets.Karaoke.Edit.Components.Cursor; - -public partial class LayoutToolTip : BackgroundToolTip -{ - private const float scale = 0.4f; - - private readonly DrawableLayoutPreview preview; - - [Resolved] - private ISkinSource? skinSource { get; set; } - - public LayoutToolTip() - { - Child = preview = new DrawableLayoutPreview - { - Size = new Vector2(512 * scale, 384 * scale), - }; - } - - private Lyric? lastLyric; - - public override void SetContent(Lyric lyric) - { - if (lyric == lastLyric) - return; - - lastLyric = lyric; - - // Get layout - var layout = skinSource?.GetConfig(lyric)?.Value; - - // Display in content - preview.Layout = layout; - preview.Lyric = lyric; - } -} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Components/Sprites/DrawableLayoutPreview.cs b/osu.Game.Rulesets.Karaoke/Edit/Components/Sprites/DrawableLayoutPreview.cs deleted file mode 100644 index 74662970c..000000000 --- a/osu.Game.Rulesets.Karaoke/Edit/Components/Sprites/DrawableLayoutPreview.cs +++ /dev/null @@ -1,127 +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.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Rulesets.Karaoke.Objects; -using osu.Game.Rulesets.Karaoke.Skinning.Elements; -using osu.Game.Skinning; - -namespace osu.Game.Rulesets.Karaoke.Edit.Components.Sprites; - -public partial class DrawableLayoutPreview : CompositeDrawable -{ - private const float scale = 0.4f; - - private readonly Box background; - private readonly Box previewLyric; - private readonly OsuSpriteText notSupportText; - - [Resolved] - private ISkinSource? skinSource { get; set; } - - public DrawableLayoutPreview() - { - InternalChildren = new Drawable[] - { - background = new Box - { - RelativeSizeAxes = Axes.Both, - }, - previewLyric = new Box - { - Height = 15, - }, - notSupportText = new OsuSpriteText - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - }, - }; - - previewLyric.Hide(); - notSupportText.Hide(); - } - - private LyricLayout? layout; - - public LyricLayout? Layout - { - get => layout; - set - { - if (layout == value) - return; - - layout = value; - updateLayout(); - } - } - - private Lyric? lyric; - - public Lyric? Lyric - { - get => lyric; - set - { - if (lyric == value) - return; - - lyric = value; - updateLayout(); - } - } - - private void updateLayout() - { - // Display in content - if (Layout == null) - { - // mark layout as not supported, or skin is not loaded - notSupportText.Show(); - - if (skinSource == null) - notSupportText.Text = "Sorry, skin is not exist."; - else - notSupportText.Text = "Sorry, layout is not exist."; - } - else - { - // Display box preview position - previewLyric.Show(); - - // Set preview width - const float text_size = 20; - previewLyric.Width = (Lyric?.Text.Length ?? 10) * text_size * scale; - previewLyric.Height = text_size * 1.5f * scale; - - // Set relative position - previewLyric.Anchor = Layout.Alignment; - previewLyric.Origin = Layout.Alignment; - - // Set margin - const float padding = 30 * scale; - float horizontalMargin = Layout.HorizontalMargin * scale + padding; - float verticalMargin = Layout.VerticalMargin * scale + padding; - previewLyric.Margin = new MarginPadding - { - Left = Layout.Alignment.HasFlag(Anchor.x0) ? horizontalMargin : 0, - Right = Layout.Alignment.HasFlag(Anchor.x2) ? horizontalMargin : 0, - Top = Layout.Alignment.HasFlag(Anchor.y0) ? verticalMargin : 0, - Bottom = Layout.Alignment.HasFlag(Anchor.y2) ? verticalMargin : 0, - }; - } - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - background.Colour = colours.Gray2; - previewLyric.Colour = colours.Yellow; - } -} From 9f147522dcd9772a2cf4416d4cde48ca4ef74aaf Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 6 Dec 2024 23:25:01 +0800 Subject: [PATCH 2/3] Remove the layout class and definition. --- .../KaraokeSkinElementConverterTest.cs | 34 --------- .../Resources/special-skin/lyric-layouts.json | 18 ----- .../KaraokeBeatmapSkinDecodingTest.cs | 18 ----- .../Converters/KaraokeSkinElementConverter.cs | 2 - .../Resources/Skin/Default/lyric-layouts.json | 72 ------------------- .../Skinning/Elements/ElementType.cs | 2 - .../Skinning/Elements/LyricLayout.cs | 51 ------------- .../Skinning/KaraokeBeatmapSkin.cs | 2 - .../Skinning/KaraokeSkin.cs | 2 - 9 files changed, 201 deletions(-) delete mode 100644 osu.Game.Rulesets.Karaoke.Tests/Resources/special-skin/lyric-layouts.json delete mode 100644 osu.Game.Rulesets.Karaoke/Resources/Skin/Default/lyric-layouts.json delete mode 100644 osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricLayout.cs 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)), }; From 314bd235ed3fba5a9c6f3e84d705a2ff3a3a81cf Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 7 Dec 2024 00:22:51 +0800 Subject: [PATCH 3/3] Fix the test case broken. --- .../Converters/KaraokeSkinElementConverterTest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 0ffb865f4..3a82134ba 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/KaraokeSkinElementConverterTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/IO/Serialization/Converters/KaraokeSkinElementConverterTest.cs @@ -50,7 +50,7 @@ public void TestLyricStyleSerializer() var lyricStyle = LyricStyle.CreateDefault(); const string expected = - "{\"$type\":2,\"left_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#CCA532\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#6B5B2D\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"right_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#5932CC\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#3D2D6B\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"name\":\"Default\"}"; + "{\"$type\":1,\"left_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#CCA532\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#6B5B2D\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"right_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#5932CC\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#3D2D6B\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"name\":\"Default\"}"; string actual = JsonConvert.SerializeObject(lyricStyle, CreateSettings()); Assert.AreEqual(expected, actual); } @@ -59,7 +59,7 @@ public void TestLyricStyleSerializer() public void TestLyricStyleDeserializer() { const string json = - "{\"$type\":2,\"left_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#CCA532\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#6B5B2D\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"right_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#5932CC\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#3D2D6B\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"name\":\"Default\"}"; + "{\"$type\":1,\"left_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#CCA532\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#6B5B2D\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"right_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#5932CC\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#3D2D6B\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"name\":\"Default\"}"; var expected = LyricStyle.CreateDefault(); var actual = (LyricStyle)JsonConvert.DeserializeObject(json, CreateSettings())!; @@ -71,7 +71,7 @@ public void TestNoteStyleSerializer() { var lyricConfig = NoteStyle.CreateDefault(); - const string expected = "{\"$type\":3,\"name\":\"Default\",\"note_color\":\"#44AADD\",\"blink_color\":\"#FF66AA\",\"text_color\":\"#FFFFFF\",\"bold_text\":true}"; + const string expected = "{\"$type\":2,\"name\":\"Default\",\"note_color\":\"#44AADD\",\"blink_color\":\"#FF66AA\",\"text_color\":\"#FFFFFF\",\"bold_text\":true}"; string actual = JsonConvert.SerializeObject(lyricConfig, CreateSettings()); Assert.AreEqual(expected, actual); } @@ -79,7 +79,7 @@ public void TestNoteStyleSerializer() [Test] public void TestNoteStyleDeserializer() { - const string json = "{\"$type\":3,\"name\":\"Default\",\"note_color\":\"#44AADD\",\"blink_color\":\"#FF66AA\",\"text_color\":\"#FFFFFF\",\"bold_text\":true}"; + const string json = "{\"$type\":2,\"name\":\"Default\",\"note_color\":\"#44AADD\",\"blink_color\":\"#FF66AA\",\"text_color\":\"#FFFFFF\",\"bold_text\":true}"; var expected = NoteStyle.CreateDefault(); var actual = (NoteStyle)JsonConvert.DeserializeObject(json, CreateSettings())!;