Added setup system. Changed reader and writer for texture atlas and nine patch to have image and serialized data be in same file. Some refactors occurred as well.

This commit is contained in:
2019-01-21 19:56:51 -06:00
parent fbf6c5d1aa
commit ea6b3cf9e3
18 changed files with 145 additions and 111 deletions

View File

@@ -1,15 +1,25 @@
using Microsoft.Xna.Framework.Content.Pipeline;
using Newtonsoft.Json;
using RecrownedAthenaeum.Data;
using System.IO;
using TImport = System.String;
namespace RecrownedAthenaeum.Pipeline.TextureAtlas
{
[ContentImporter(".tatlas", DisplayName = "Texture Atlas Importer", DefaultProcessor = "TextureAtlasProcessor")]
internal class TextureAtlasImporter : ContentImporter<TImport>
internal class TextureAtlasImporter : ContentImporter<TextureAtlasImporter.Package>
{
public override TImport Import(string filename, ContentImporterContext context)
public override Package Import(string filename, ContentImporterContext context)
{
return File.ReadAllText(filename);
Package package;
package.textureAtlasData = JsonConvert.DeserializeObject<TextureAtlasData>(File.ReadAllText(filename));
package.textureBytes = File.ReadAllBytes(package.textureAtlasData.textureName);
return package;
}
internal struct Package
{
internal TextureAtlasData textureAtlasData;
internal byte[] textureBytes;
}
}
}