diff --git a/RecrownedAthenaeum/ContentReaders/NinePatchDataReader.cs b/RecrownedAthenaeum/ContentReaders/NinePatchDataReader.cs index b036afb..7b7c244 100644 --- a/RecrownedAthenaeum/ContentReaders/NinePatchDataReader.cs +++ b/RecrownedAthenaeum/ContentReaders/NinePatchDataReader.cs @@ -1,6 +1,5 @@ using Microsoft.Xna.Framework.Content; using Newtonsoft.Json; -using System.Text; namespace RecrownedAthenaeum.ContentReaders { @@ -8,10 +7,9 @@ namespace RecrownedAthenaeum.ContentReaders { protected override SpecialTypes.NinePatch Read(ContentReader input, SpecialTypes.NinePatch existingInstance) { - int length = input.ReadInt32(); - byte[] bytes = input.ReadBytes(length); + string serialized = input.ReadString(); - return JsonConvert.DeserializeObject(Encoding.UTF8.GetString(bytes)); + return JsonConvert.DeserializeObject(serialized); } } } diff --git a/RecrownedAthenaeum/ContentReaders/TextureAtlasDataReader.cs b/RecrownedAthenaeum/ContentReaders/TextureAtlasDataReader.cs index 76739d1..2f84b3d 100644 --- a/RecrownedAthenaeum/ContentReaders/TextureAtlasDataReader.cs +++ b/RecrownedAthenaeum/ContentReaders/TextureAtlasDataReader.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework.Graphics; using Newtonsoft.Json; using RecrownedAthenaeum.Data; using RecrownedAthenaeum.SpecialTypes; +using System.IO; namespace RecrownedAthenaeum.ContentReaders { @@ -12,12 +13,18 @@ namespace RecrownedAthenaeum.ContentReaders { string serialized = input.ReadString(); TextureAtlasData atlasData = JsonConvert.DeserializeObject(serialized); - Texture2D atlasTexture = input.ContentManager.Load(atlasData.textureName); + Texture2D atlasTexture = input.ContentManager.Load(Path.GetFileNameWithoutExtension(atlasData.textureName)); TextureAtlas atlas = new TextureAtlas(atlasTexture, GenerateAtlasRegionsFromData(atlasData, atlasTexture)); return atlas; } + /// + /// Generates region given . + /// + /// The data to generate the regions from. + /// The texture containing the atlas. + /// An array of regions. public TextureAtlas.Region[] GenerateAtlasRegionsFromData(TextureAtlasData textureAtlasData, Texture2D atlasTexture) { TextureAtlas.Region[] regions = new TextureAtlas.Region[textureAtlasData.regions.Length]; diff --git a/RecrownedAthenaeum/UI/Skin/Skin.cs b/RecrownedAthenaeum/UI/Skin/Skin.cs index 9d4f276..63b120e 100644 --- a/RecrownedAthenaeum/UI/Skin/Skin.cs +++ b/RecrownedAthenaeum/UI/Skin/Skin.cs @@ -4,7 +4,6 @@ using RecrownedAthenaeum.SpecialTypes; using RecrownedAthenaeum.UI.Skin.Definitions; using System; using System.Collections.Generic; -using System.IO; namespace RecrownedAthenaeum.UI.Skin {