diff --git a/PckStudio.Core/Extensions/PckAssetExtensions.cs b/PckStudio.Core/Extensions/PckAssetExtensions.cs index 405aed68..3550ac65 100644 --- a/PckStudio.Core/Extensions/PckAssetExtensions.cs +++ b/PckStudio.Core/Extensions/PckAssetExtensions.cs @@ -68,11 +68,12 @@ namespace PckStudio.Core.Extensions int skinId = asset.GetId(); string name = asset.GetProperty("DISPLAYNAME"); + string theme = asset.GetProperty("THEMENAME"); Image texture = asset.GetTexture(); SkinANIM anim = asset.GetProperty("ANIM", SkinANIM.FromString); - IEnumerable boxes = asset.GetMultipleProperties("BOX").Select(kv => SkinBOX.FromString(kv.Value)); - IEnumerable offsets = asset.GetMultipleProperties("OFFSET").Select(kv => SkinPartOffset.FromString(kv.Value)); - return new Skin.Skin(name, skinId, texture, anim, boxes, offsets); + IEnumerable boxes = asset.GetPropertyValues("BOX").Select(SkinBOX.FromString); + IEnumerable offsets = asset.GetPropertyValues("OFFSET").Select(SkinPartOffset.FromString); + return new Skin.Skin(name, theme, skinId, texture, anim, boxes, offsets); } public static void SetSkin(this PckAsset asset, Skin.Skin skin, LOCFile localisation) diff --git a/PckStudio.Core/Skin/Skin.cs b/PckStudio.Core/Skin/Skin.cs index 62e21169..c5ff58d2 100644 --- a/PckStudio.Core/Skin/Skin.cs +++ b/PckStudio.Core/Skin/Skin.cs @@ -23,29 +23,34 @@ namespace PckStudio.Core.Skin public bool HasCape => CapeId != -1; - public Skin(string name, Image texture) + public Skin(string name, Image texture) : this(name, "", texture) { } + + public Skin(string name, string theme, Image texture, SkinANIM anim = default) { - MetaData = new SkinMetaData(name, string.Empty); + MetaData = new SkinMetaData(name, theme); Texture = texture; Model = new SkinModel(); + Anim = anim ?? new SkinANIM(0); } - public Skin(string name, Image texture, int capeId) - : this(name, texture) + public Skin(string name, Image texture, int capeId) : this(name, "", texture, capeId) { } + public Skin(string name, string theme, Image texture, int capeId) : this(name, theme, texture) { CapeId = capeId; } public Skin(string name, SkinANIM anim, Image texture, IEnumerable additionalBoxes, IEnumerable partOffsets) - : this(name, texture) + : this(name, "", anim, texture, additionalBoxes, partOffsets) { } + + public Skin(string name, string theme, SkinANIM anim, Image texture, IEnumerable additionalBoxes, IEnumerable partOffsets) + : this(name, theme, texture, anim) { Model.AdditionalBoxes.AddRange(additionalBoxes); Model.PartOffsets.AddRange(partOffsets); - Anim = anim; } - public Skin(string name, int id, Image texture, SkinANIM anim, IEnumerable additionalBoxes, IEnumerable partOffsets) - : this(name, anim, texture, additionalBoxes, partOffsets) + public Skin(string name, string theme, int id, Image texture, SkinANIM anim, IEnumerable additionalBoxes, IEnumerable partOffsets) + : this(name, theme, anim, texture, additionalBoxes, partOffsets) { Identifier = new(id); }