Skip to content

Commit

Permalink
Remove the layout class and definition.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Dec 6, 2024
1 parent dbfa23e commit 9f14752
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<IKaraokeSkinElement>(json, CreateSettings())!;
ObjectAssert.ArePropertyEqual(expected, actual);
}

[Test]
public void TestLyricStyleSerializer()
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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<Lyric, LyricLayout>(firstLyric)!.Value;
var secondLyricLayout = skin.GetConfig<Lyric, LyricLayout>(secondLyric)!.Value;

// There's no default layout in the skin.
Assert.IsNull(firstLyricLayout);
Assert.IsNull(secondLyricLayout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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(),
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions osu.Game.Rulesets.Karaoke/Skinning/Elements/ElementType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ public enum ElementType
{
LyricFontInfo,

LyricLayout,

LyricStyle,

NoteStyle,
Expand Down
51 changes: 0 additions & 51 deletions osu.Game.Rulesets.Karaoke/Skinning/Elements/LyricLayout.cs

This file was deleted.

2 changes: 0 additions & 2 deletions osu.Game.Rulesets.Karaoke/Skinning/KaraokeBeatmapSkin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -98,7 +97,6 @@ static string getFileNameByType(ElementType elementType)
case KaraokeIndexLookup indexLookup:
return indexLookup switch
{
KaraokeIndexLookup.Layout => SkinUtils.As<TValue>(getSelectionFromElementType(ElementType.LyricLayout)),
KaraokeIndexLookup.Style => SkinUtils.As<TValue>(getSelectionFromElementType(ElementType.LyricStyle)),
KaraokeIndexLookup.Note => SkinUtils.As<TValue>(getSelectionFromElementType(ElementType.NoteStyle)),
_ => throw new InvalidEnumArgumentException(nameof(indexLookup)),
Expand Down
2 changes: 0 additions & 2 deletions osu.Game.Rulesets.Karaoke/Skinning/KaraokeSkin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ public KaraokeSkin(SkinInfo skin, IStorageResourceProvider? resources, IResource
return type switch
{
ElementType.LyricStyle or ElementType.LyricFontInfo or ElementType.NoteStyle => SkinUtils.As<TValue>(new Bindable<TValue>((TValue)DefaultElement[type])),
ElementType.LyricLayout => null,
_ => throw new InvalidEnumArgumentException(nameof(type)),
};
}
Expand Down Expand Up @@ -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)),
};

Expand Down

0 comments on commit 9f14752

Please sign in to comment.