Files renamed to RecrownedGTK.

This commit is contained in:
2020-02-16 21:44:21 -05:00
parent 2c62be1c6b
commit dee5f96ea7
69 changed files with 5891 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
using Microsoft.Xna.Framework.Content.Pipeline;
using Newtonsoft.Json;
using RecrownedGTK.Data;
using System.IO;
namespace RecrownedGTK.Pipeline.NinePatch
{
[ContentImporter(".9p", DisplayName = "Nine Patch Importer - RecrownedGTK", DefaultProcessor = "NinePatchProcessor")]
internal class NinePatchImporter : ContentImporter<NinePatchData>
{
public override NinePatchData Import(string filename, ContentImporterContext context)
{
return JsonConvert.DeserializeObject<NinePatchData>(File.ReadAllText(filename));
}
}
}

View File

@@ -0,0 +1,19 @@
using Microsoft.Xna.Framework.Content.Pipeline;
using Newtonsoft.Json;
using RecrownedGTK.Data;
using System.IO;
using System.Text;
namespace RecrownedGTK.Pipeline.NinePatch
{
[ContentImporter(DisplayName = "Nine Patch - RecrownedGTK")]
class NinePatchProcessor : ContentProcessor<NinePatchData, NinePatchData>
{
public override NinePatchData Process(NinePatchData input, ContentProcessorContext context)
{
if (Path.GetFileNameWithoutExtension(context.SourceIdentity.SourceFilename) == Path.GetFileNameWithoutExtension(input.textureName)) throw new InvalidContentException("Ninepatch data and texture for the data can't have the same name.");
context.AddDependency(input.textureName);
return input;
}
}
}

View File

@@ -0,0 +1,26 @@
using Microsoft.Xna.Framework.Content.Pipeline;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
using Newtonsoft.Json;
using RecrownedGTK.Data;
using System.IO;
namespace RecrownedGTK.Pipeline.NinePatch
{
[ContentTypeWriter]
class NinePatchWriter : ContentTypeWriter<NinePatchData>
{
public override string GetRuntimeReader(TargetPlatform targetPlatform)
{
return "RecrownedGTK.ContentReaders.NinePatchDataReader, RecrownedGTK";
}
protected override void Write(ContentWriter output, NinePatchData value)
{
output.Write(Path.GetFileNameWithoutExtension(value.textureName));
output.Write(value.left);
output.Write(value.right);
output.Write(value.bottom);
output.Write(value.top);
}
}
}