diff --git a/RecrownedAthenaeum.Pipeline/NinePatch/NinePatchTemplate.cs b/RecrownedAthenaeum.Pipeline/NinePatch/NinePatchTemplate.cs index 7faefae..8188c55 100644 --- a/RecrownedAthenaeum.Pipeline/NinePatch/NinePatchTemplate.cs +++ b/RecrownedAthenaeum.Pipeline/NinePatch/NinePatchTemplate.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace RecrownedAthenaeum.Pipeline.NinePatch { - class NinePatchTemplate + class NinePatchFile { public string name; public string bounds; diff --git a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasImporter.cs b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasImporter.cs index c4c03e4..8ccd0eb 100644 --- a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasImporter.cs +++ b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasImporter.cs @@ -11,13 +11,13 @@ using System.Xml.Serialization; namespace RecrownedAthenaeum.Pipeline.TextureAtlas { - internal class TextureAtlasImporter : ContentImporter + internal class TextureAtlasImporter : ContentImporter { - public override TextureAtlasTemplate Import(string filename, ContentImporterContext context) + public override TextureAtlasFile Import(string filename, ContentImporterContext context) { StreamReader stream = new StreamReader(filename); - XmlSerializer serializer = new XmlSerializer(typeof(TextureAtlasTemplate)); - TextureAtlasTemplate atlas = (TextureAtlasTemplate)serializer.Deserialize(stream); + XmlSerializer serializer = new XmlSerializer(typeof(TextureAtlasFile)); + TextureAtlasFile atlas = (TextureAtlasFile)serializer.Deserialize(stream); context.AddDependency(atlas.textureName); stream.Dispose(); return atlas; diff --git a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasProcessor.cs b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasProcessor.cs index 1850ced..840776d 100644 --- a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasProcessor.cs +++ b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasProcessor.cs @@ -10,10 +10,10 @@ using System.Threading.Tasks; namespace RecrownedAthenaeum.Pipeline.TextureAtlas { - class TextureAtlasProcessor : ContentProcessor + class TextureAtlasProcessor : ContentProcessor { - public override TextureAtlasTemplate Process(TextureAtlasTemplate input, ContentProcessorContext context) + public override TextureAtlasFile Process(TextureAtlasFile input, ContentProcessorContext context) { return input; } diff --git a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasTemplate.cs b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasTemplate.cs index ddfb238..42cd62d 100644 --- a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasTemplate.cs +++ b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasTemplate.cs @@ -8,7 +8,7 @@ using System.Xml.Serialization; namespace RecrownedAthenaeum.Pipeline.TextureAtlas { - public class TextureAtlasTemplate + public class TextureAtlasFile { public string textureName; public TextureAtlasRegion[] regions; diff --git a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasWriter.cs b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasWriter.cs index 51f6ed9..e807e09 100644 --- a/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasWriter.cs +++ b/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasWriter.cs @@ -8,14 +8,14 @@ using System.Threading.Tasks; namespace RecrownedAthenaeum.Pipeline.TextureAtlas { - class TextureAtlasWriter : ContentTypeWriter + class TextureAtlasWriter : ContentTypeWriter { public override string GetRuntimeReader(TargetPlatform targetPlatform) { throw new NotImplementedException(); } - protected override void Write(ContentWriter output, TextureAtlasTemplate value) + protected override void Write(ContentWriter output, TextureAtlasFile value) { throw new NotImplementedException(); } diff --git a/RecrownedAthenaeum/DataTypes/TextureAtlas.cs b/RecrownedAthenaeum/DataTypes/TextureAtlas.cs index f26afc9..1caf261 100644 --- a/RecrownedAthenaeum/DataTypes/TextureAtlas.cs +++ b/RecrownedAthenaeum/DataTypes/TextureAtlas.cs @@ -35,13 +35,20 @@ namespace RecrownedAthenaeum.DataTypes return dictionaryOfRegions[name].AsTexture2D(graphicsDevice, texture); } - public struct TextureAtlasRegion : IComparable, IDisposable + public class TextureAtlasRegion : IComparable, IDisposable { - public string name; - Rectangle sourceRectangle; - NinePatch ninepatch; + public readonly string name; + readonly Rectangle sourceRectangle; + readonly NinePatch ninepatch; Texture2D regionTexture; + public TextureAtlasRegion(string name, Rectangle source, NinePatch ninePatch) + { + this.name = name; + this.sourceRectangle = source; + this.ninepatch = ninePatch; + } + public void Draw(SpriteBatch batch, Rectangle destination, Texture2D fromTexture, Color color, float rotation, Vector2 origin) { batch.Draw(fromTexture, destination, sourceRectangle, color, rotation, origin, SpriteEffects.None, 0f); diff --git a/RecrownedAthenaeum/Persistence/Preferences.cs b/RecrownedAthenaeum/Persistence/Preferences.cs deleted file mode 100644 index 4330b1e..0000000 --- a/RecrownedAthenaeum/Persistence/Preferences.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml.Serialization; - -namespace RecrownedAthenaeum.Persistence -{ - public interface Preferences - { - } -} diff --git a/RecrownedAthenaeum/Persistence/PreferencesManager.cs b/RecrownedAthenaeum/Persistence/PreferencesManager.cs index 4e105df..f005cbf 100644 --- a/RecrownedAthenaeum/Persistence/PreferencesManager.cs +++ b/RecrownedAthenaeum/Persistence/PreferencesManager.cs @@ -8,15 +8,15 @@ namespace RecrownedAthenaeum.Persistence { public class PreferencesManager { - private readonly Dictionary preferenceList; + private readonly Dictionary preferenceList; string savePath; XmlSerializer xmlSerializer; - public PreferencesManager(string savePath, params Preferences[] preferences) + public PreferencesManager(string savePath, params object[] preferences) { this.savePath = savePath; Directory.CreateDirectory(savePath); - preferenceList = new Dictionary(); + preferenceList = new Dictionary(); Debug.WriteLine("Preference manager setting up..."); Type[] preferenceTypes = new Type[preferences.Length]; for (int prefID = 0; prefID < preferences.Length; prefID++) @@ -26,10 +26,10 @@ namespace RecrownedAthenaeum.Persistence Debug.WriteLine(preferences[prefID] + " added to list of preferences"); } - xmlSerializer = new XmlSerializer(typeof(Preferences), preferenceTypes); + xmlSerializer = new XmlSerializer(typeof(object), preferenceTypes); } - public T GetPreferences() where T : Preferences + public T GetPreferences() { return (T)preferenceList[typeof(T)]; } @@ -49,7 +49,7 @@ namespace RecrownedAthenaeum.Persistence public void Save() { - foreach (KeyValuePair prefs in preferenceList) + foreach (KeyValuePair prefs in preferenceList) { SaveSpecific(prefs.Key); } @@ -61,7 +61,7 @@ namespace RecrownedAthenaeum.Persistence if (File.Exists(path)) { Stream stream = new FileStream(path, FileMode.Open); - preferenceList[preference] = (Preferences)xmlSerializer.Deserialize(stream); + preferenceList[preference] = xmlSerializer.Deserialize(stream); stream.Close(); return true; } diff --git a/RecrownedAthenaeum/RecrownedAthenaeum.csproj b/RecrownedAthenaeum/RecrownedAthenaeum.csproj index 7374626..380b028 100644 --- a/RecrownedAthenaeum/RecrownedAthenaeum.csproj +++ b/RecrownedAthenaeum/RecrownedAthenaeum.csproj @@ -64,7 +64,6 @@ -