began working on skin system.
This commit is contained in:
54
RecrownedAthenaeum/UI/Skin/Skin.cs
Normal file
54
RecrownedAthenaeum/UI/Skin/Skin.cs
Normal file
@@ -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<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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user