Progress on skin system, added skin stack.

This commit is contained in:
2019-01-20 01:08:38 -06:00
parent 6fdcdcf923
commit ea8f96d877
10 changed files with 393 additions and 64 deletions

View File

@@ -55,11 +55,11 @@ 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(Skin.Skin skin, string definitionName = null)
{
this.skinDefinition = skin.ObtainDefinition<ButtonSkinDefinition>(definitionName, GetType());
downTexture = skin.textureAtlas[skinDefinition.downRegion];
upTexture = skin.textureAtlas[skinDefinition.upRegion];
disabledTexture = skin.textureAtlas[skinDefinition.disabledRegion];
highlightedTexture = skin.textureAtlas[skinDefinition.selectedRegion];
skinDefinition = skin.ObtainDefinition<ButtonSkinDefinition>(definitionName, GetType());
downTexture = skin.GetTextureAtlasRegion(skinDefinition.downRegion);
upTexture = skin.GetTextureAtlasRegion(skinDefinition.upRegion);
disabledTexture = skin.GetTextureAtlasRegion(skinDefinition.disabledRegion);
highlightedTexture = skin.GetTextureAtlasRegion(skinDefinition.selectedRegion);
}
/// <summary>

View File

@@ -38,13 +38,14 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
/// Constructs a text button using a skin and definition.
/// </summary>
/// <param name="text">The text to display.</param>
/// <param name="font">The font to be used.</param>
/// <param name="skin">The skin to use.</param>
/// <param name="definitionName">Name of the definition for this type in the skin given.</param>
public TextButton(string text, Skin.Skin skin, string definitionName = null) : base(skin, definitionName)
public TextButton(string text, SpriteFont font, Skin.Skin skin, string definitionName = null) : base(skin, definitionName)
{
TextButtonSkinDefinition skinDefinition = skin.ObtainDefinition<TextButtonSkinDefinition>(definitionName, GetType());
this.text = new Text(skin.fonts[skinDefinition.fontName], text);
FontColor = skin.colors[skinDefinition.fontColor];
this.text = new Text(font, text);
FontColor = skin.GetColor(skinDefinition.fontColor);
}
/// <summary>

View File

@@ -57,13 +57,14 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
/// <summary>
/// Creates a UI text object
/// </summary>
/// <param name="skin"></param>
/// <param name="skinDefinitionName"></param>
/// <param name="content"></param>
public Text(Skin.Skin skin, string skinDefinitionName = null, string content = null) : this(skin.fonts[skin.ObtainDefinition<TextSkinDefinition>(skinDefinitionName, typeof(Text)).font])
/// <param name="skin">The skin to be used.</param>
/// <param name="skinDefinitionName">The name of the skin's definition to use of a <see cref="TextSkinDefinition"/>.</param>
/// <param name="font">The font to be used.</param>
/// <param name="content">The string of text to be displayed.</param>
public Text(Skin.Skin skin, SpriteFont font, string skinDefinitionName = null, string content = null) : this(font, content)
{
skinDefinition = skin.ObtainDefinition<TextSkinDefinition>(skinDefinitionName, GetType());
color = skin.colors[skinDefinition.color];
color = skin.GetColor(skinDefinition.color);
}
/// <summary>