Files renamed to RecrownedGTK.
This commit is contained in:
16
RecrownedGTK.Pipeline/NinePatch/NinePatchImporter.cs
Normal file
16
RecrownedGTK.Pipeline/NinePatch/NinePatchImporter.cs
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
19
RecrownedGTK.Pipeline/NinePatch/NinePatchProcessor.cs
Normal file
19
RecrownedGTK.Pipeline/NinePatch/NinePatchProcessor.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
26
RecrownedGTK.Pipeline/NinePatch/NinePatchWriter.cs
Normal file
26
RecrownedGTK.Pipeline/NinePatch/NinePatchWriter.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user