diff --git a/RecrownedAthenaeum/RecrownedAthenaeum.csproj b/RecrownedAthenaeum/RecrownedAthenaeum.csproj index ec0b821..ca82cdc 100644 --- a/RecrownedAthenaeum/RecrownedAthenaeum.csproj +++ b/RecrownedAthenaeum/RecrownedAthenaeum.csproj @@ -73,9 +73,13 @@ - + + + + + diff --git a/RecrownedAthenaeum/UI/Skin/Definitions/ButtonSkinDefinition.cs b/RecrownedAthenaeum/UI/Skin/Definitions/ButtonSkinDefinition.cs new file mode 100644 index 0000000..7e3b080 --- /dev/null +++ b/RecrownedAthenaeum/UI/Skin/Definitions/ButtonSkinDefinition.cs @@ -0,0 +1,27 @@ +using RecrownedAthenaeum.UI.Modular.Modules.Interactive; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RecrownedAthenaeum.UI.Skin.Definitions +{ + public class ButtonSkinDefinition : ISkinDefinition + { + public string downRegion; + public string upRegion; + public string disabledRegion; + + public ButtonSkinDefinition(string downRegion, string upRegion) + { + this.downRegion = downRegion; + this.upRegion = upRegion; + } + + public Type UIModuleType() + { + return typeof(Button); + } + } +} diff --git a/RecrownedAthenaeum/UI/Skin/Definitions/ISkinDefinition.cs b/RecrownedAthenaeum/UI/Skin/Definitions/ISkinDefinition.cs new file mode 100644 index 0000000..d00f98c --- /dev/null +++ b/RecrownedAthenaeum/UI/Skin/Definitions/ISkinDefinition.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RecrownedAthenaeum.UI.Skin.Definitions +{ + public interface ISkinDefinition + { + Type UIModuleType { get; } + } +} diff --git a/RecrownedAthenaeum/UI/Skin/Definitions/TextSkinDefinition.cs b/RecrownedAthenaeum/UI/Skin/Definitions/TextSkinDefinition.cs new file mode 100644 index 0000000..5a2c429 --- /dev/null +++ b/RecrownedAthenaeum/UI/Skin/Definitions/TextSkinDefinition.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static System.Net.Mime.MediaTypeNames; + +namespace RecrownedAthenaeum.UI.Skin.Definitions +{ + class TextSkinDefinition : ISkinDefinition + { + public string font; + public string color; + + public TextSkinDefinition(string font, string color) + { + this.font = font; + this.color = color; + } + + public Type UIModuleType() + { + return typeof(Text); + } + } +} diff --git a/RecrownedAthenaeum/UI/Skin/Skin.cs b/RecrownedAthenaeum/UI/Skin/Skin.cs new file mode 100644 index 0000000..9867bdd --- /dev/null +++ b/RecrownedAthenaeum/UI/Skin/Skin.cs @@ -0,0 +1,54 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using RecrownedAthenaeum.DataTypes; +using RecrownedAthenaeum.UI.Skin.Definitions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RecrownedAthenaeum.UI.Skin +{ + public class Skin + { + TextureAtlas textureAtlas; + Dictionary colors; + Dictionary fonts; + Dictionary> definitions; + + public Skin(TextureAtlas textureAtlas) + { + this.textureAtlas = textureAtlas; + colors = new Dictionary(); + fonts = new Dictionary(); + definitions = new Dictionary>(); + } + + public void Draw(string texture, string color, Rectangle region) + { + + } + + public void AddDefinition(string definitionName, ISkinDefinition skinDefinition) + { + if (!definitions.ContainsKey(skinDefinition.UIModuleType)) + { + definitions.Add(skinDefinition.UIModuleType, new Dictionary()); + } else if (definitions[skinDefinition.UIModuleType].ContainsKey(definitionName)) throw new ArgumentException("Type of definition with that name already exists!"); + + definitions[skinDefinition.UIModuleType].Add(definitionName, skinDefinition); + } + + public void RemoveDefinition(string definitionName, Type definitionType) + { + if (definitions.ContainsKey(definitionType) && definitions[definitionType].ContainsKey(definitionName)) + { + definitions[definitionType].Remove(definitionName); + } else + { + throw new ArgumentException("a definition of type " + definitionType.Name + " with a name of " + definitionName + " does not exist."); + } + } + } +}