using heirarchy for definitions implemented.
This commit is contained in:
parent
2e984db135
commit
e356a82190
@ -64,6 +64,18 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
|
||||
highlightedTexture = skin.GetTextureAtlasRegion(skinDefinition.selectedRegion);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a button using a definition.
|
||||
/// </summary>
|
||||
/// <param name="skin">The skin the definition is defined in.</param>
|
||||
/// <param name="skinDefinition">The definition itself.</param>
|
||||
public Button(ISkin skin, ButtonSkinDefinition skinDefinition) :
|
||||
this(skin.GetTextureAtlasRegion(skinDefinition.downRegion),
|
||||
skin.GetTextureAtlasRegion(skinDefinition.upRegion),
|
||||
skin.GetTextureAtlasRegion(skinDefinition.disabledRegion),
|
||||
skin.GetTextureAtlasRegion(skinDefinition.selectedRegion))
|
||||
{}
|
||||
|
||||
/// <summary>
|
||||
/// Draws the button.
|
||||
/// </summary>
|
||||
|
@ -43,13 +43,29 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
|
||||
/// <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, SpriteFont font, ISkin skin, string definitionName = null) : base(skin, definitionName)
|
||||
public TextButton(string text, SpriteFont font, ISkin skin, string definitionName = null) : base(skin, skin.ObtainDefinition<TextButtonSkinDefinition>(definitionName))
|
||||
{
|
||||
TextButtonSkinDefinition skinDefinition = skin.ObtainDefinition<TextButtonSkinDefinition>(definitionName);
|
||||
this.text = new Text(font, text);
|
||||
FontColor = skin.GetColor(skinDefinition.fontColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a text button with a given definition.
|
||||
/// </summary>
|
||||
/// <param name="text">The text to be displayed on this button.</param>
|
||||
/// <param name="font">The font to use for this button.</param>
|
||||
/// <param name="skin">The skin the definition is from.</param>
|
||||
/// <param name="skinDefinition">The definition to use.</param>
|
||||
public TextButton(string text, SpriteFont font, ISkin skin, TextButtonSkinDefinition skinDefinition) :
|
||||
this(text,
|
||||
font,
|
||||
skin.GetTextureAtlasRegion(skinDefinition.downRegion),
|
||||
skin.GetTextureAtlasRegion(skinDefinition.upRegion),
|
||||
skin.GetTextureAtlasRegion(skinDefinition.disabledRegion),
|
||||
skin.GetTextureAtlasRegion(skinDefinition.selectedRegion))
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Updates the text button.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user