Many refactors and minor changes. idk.

This commit is contained in:
2019-04-08 23:58:27 -05:00
parent 4d4d46ad1b
commit 3e5b838abe
13 changed files with 465 additions and 60 deletions

View File

@@ -3,7 +3,7 @@
namespace RecrownedAthenaeum.UI.SkinSystem.Definitions
{
/// <summary>
/// Definition for a button.
/// Skin definition for a button.
/// </summary>
public class ButtonSkinDefinition : SkinDefinitionData
{

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RecrownedAthenaeum.UI.SkinSystem.Definitions
{
/// <summary>
/// Skin definition of a scroll module.
/// </summary>
public class UIScrollableSkinDefinition : SkinDefinitionData
{
/// <summary>
/// Name of the region that specifies the texture needed.
/// </summary>
public string horizontalBar, verticalBar, horizontalBarTrack, verticalBarTrack, background;
/// <summary>
/// Instantiates the definition with the minimum requirements.
/// </summary>
/// <param name="horizontalBar">Name of the region used by the skin that defines what the horizontal scroll bar looks like.</param>
/// <param name="verticalBar">Name of the region used by the skin that defines what the vertical scroll bar looks like.</param>
public UIScrollableSkinDefinition(string horizontalBar, string verticalBar)
{
this.horizontalBar = horizontalBar;
this.verticalBar = verticalBar;
}
}
}

View File

@@ -22,7 +22,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
private TextureAtlas textureAtlas;
Dictionary<string, Color> colors;
readonly Dictionary<string, string> moduleTypeOfDefinition;
readonly Dictionary<string, string> definitionOfType;
readonly Dictionary<string, Dictionary<string, SkinDefinitionData>> definitions;
/// <summary>
@@ -40,7 +40,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
this.textureAtlas = textureAtlas;
this.CursorTexture = cursorTexture;
colors = new Dictionary<string, Color>();
moduleTypeOfDefinition = new Dictionary<string, string>();
definitionOfType = new Dictionary<string, string>();
definitions = new Dictionary<string, Dictionary<string, SkinDefinitionData>>();
}
@@ -105,7 +105,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
/// <returns>The definition cast to T.</returns>
public T ObtainDefinition<T>(string definitionName = null) where T : SkinDefinitionData
{
return (T)ObtainDefinition(moduleTypeOfDefinition[typeof(T).FullName], definitionName);
return (T)ObtainDefinition(definitionOfType[typeof(T).FullName], definitionName);
}
/// <summary>
@@ -120,7 +120,7 @@ namespace RecrownedAthenaeum.UI.SkinSystem
if (definitionName == null) definitionName = "default";
if (!definitions.ContainsKey(skinDefinition.uiModuleTypeFullName))
{
moduleTypeOfDefinition.Add(skinDefinition.GetType().FullName, skinDefinition.uiModuleTypeFullName);
definitionOfType.Add(skinDefinition.GetType().FullName, skinDefinition.uiModuleTypeFullName);
definitions.Add(skinDefinition.uiModuleTypeFullName, new Dictionary<string, SkinDefinitionData>());
}
else if (definitions[skinDefinition.uiModuleTypeFullName].ContainsKey(definitionName)) throw new ArgumentException("Type of definition with that name already exists!");