attempt at fixing skin system as well as improved convenience.

This commit is contained in:
2019-01-28 19:43:41 -06:00
parent 7892bff6be
commit 8ea9ae3921
7 changed files with 26 additions and 129 deletions

View File

@@ -57,7 +57,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
/// <param name="definitionName">The name of the definition in the skin. Can be null to select the default.</param>
public Button(ISkin skin, string definitionName = null)
{
skinDefinition = skin.ObtainDefinition<ButtonSkinDefinition>(definitionName, GetType());
skinDefinition = skin.ObtainDefinition<ButtonSkinDefinition>(definitionName);
downTexture = skin.GetTextureAtlasRegion(skinDefinition.downRegion);
upTexture = skin.GetTextureAtlasRegion(skinDefinition.upRegion);
disabledTexture = skin.GetTextureAtlasRegion(skinDefinition.disabledRegion);

View File

@@ -45,7 +45,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
/// <param name="definitionName">Name of the definition for this type in the skin given.</param>
public TextButton(string text, SpriteFont font, ISkin skin, string definitionName = null) : base(skin, definitionName)
{
TextButtonSkinDefinition skinDefinition = skin.ObtainDefinition<TextButtonSkinDefinition>(definitionName, GetType());
TextButtonSkinDefinition skinDefinition = skin.ObtainDefinition<TextButtonSkinDefinition>(definitionName);
this.text = new Text(font, text);
FontColor = skin.GetColor(skinDefinition.fontColor);
}

View File

@@ -64,7 +64,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
/// <param name="content">The string of text to be displayed.</param>
public Text(ISkin skin, SpriteFont font, string skinDefinitionName = null, string content = null) : this(font, content)
{
skinDefinition = skin.ObtainDefinition<TextSkinDefinition>(skinDefinitionName, GetType());
skinDefinition = skin.ObtainDefinition<TextSkinDefinition>(skinDefinitionName);
color = skin.GetColor(skinDefinition.color);
}