2018-12-05 01:19:31 +00:00
|
|
|
|
using Microsoft.Xna.Framework.Content.Pipeline;
|
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
2018-12-05 08:28:09 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2018-12-05 01:19:31 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace RecrownedAthenaeum.Pipeline.TextureAtlas
|
|
|
|
|
{
|
2018-12-05 08:28:09 +00:00
|
|
|
|
[ContentImporter(".atlas", DisplayName = "Texture Atlas Importer")]
|
|
|
|
|
internal class TextureAtlasImporter : ContentImporter<TextureAtlasData>
|
2018-12-05 01:19:31 +00:00
|
|
|
|
{
|
2018-12-05 08:28:09 +00:00
|
|
|
|
public override TextureAtlasData Import(string filename, ContentImporterContext context)
|
2018-12-05 01:19:31 +00:00
|
|
|
|
{
|
2018-12-05 08:28:09 +00:00
|
|
|
|
TextureAtlasData atlas;
|
|
|
|
|
using (StreamReader stream = new StreamReader(filename))
|
|
|
|
|
{
|
|
|
|
|
atlas = JsonConvert.DeserializeObject<TextureAtlasData>(stream.ReadToEnd());
|
|
|
|
|
}
|
2018-12-05 21:18:22 +00:00
|
|
|
|
context.AddDependency(atlas.textureName);
|
2018-12-05 01:19:31 +00:00
|
|
|
|
return atlas;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|