event now passes the button that sent the event.

This commit is contained in:
Harrison Deng 2019-01-27 17:59:55 -06:00
parent 872a0f8a66
commit 66b2fb9c5c
2 changed files with 9 additions and 7 deletions

View File

@ -9,7 +9,8 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
/// <summary>
/// Function to be called when button is clicked.
/// </summary>
public delegate void Clicked();
/// <param name="button">The button that was clicked.</param>
public delegate void Clicked(Button button);
/// <summary>
/// A very primitive button containing all the basic functions.
@ -130,7 +131,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
internal void OnClick()
{
Listeners?.Invoke();
Listeners?.Invoke(this);
}
}

View File

@ -10,7 +10,10 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
/// </summary>
public class TextButton : Button
{
private Text text;
/// <summary>
/// The text that is used to display the string.
/// </summary>
public readonly Text text;
/// <summary>
/// The color the font should be rendered in.
@ -28,10 +31,8 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
/// <param name="selected">What to draw as button is selected.</param>
public TextButton(string text, SpriteFont font, ISpecialDrawable down, ISpecialDrawable up, ISpecialDrawable disabled = null, ISpecialDrawable selected = null) : base(down, up, disabled, selected)
{
this.text = new Text(font, text)
{
autoScale = true
};
this.text = new Text(font, text);
this.text.autoScale = true;
}
/// <summary>