recrownedgtk/RecrownedAthenaeum/UI/Skin/Skin.cs

55 lines
2.0 KiB
C#
Raw Normal View History

2018-12-11 07:12:34 +00:00
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<string, Color> colors;
Dictionary<string, SpriteFont> fonts;
Dictionary<Type, Dictionary<string, ISkinDefinition>> definitions;
public Skin(TextureAtlas textureAtlas)
{
this.textureAtlas = textureAtlas;
colors = new Dictionary<string, Color>();
fonts = new Dictionary<string, SpriteFont>();
definitions = new Dictionary<Type, Dictionary<string, ISkinDefinition>>();
}
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<string, ISkinDefinition>());
} 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.");
}
}
}
}