2018-11-30 02:41:06 +00:00
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
2018-12-04 13:45:09 +00:00
|
|
|
|
using RecrownedAthenaeum.UI.Modular.Modules;
|
|
|
|
|
using RecrownedAthenaeum.DataTypes;
|
|
|
|
|
using RecrownedAthenaeum.UI.Modular.Modules.Interactive;
|
2018-11-30 02:41:06 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2018-12-14 06:43:38 +00:00
|
|
|
|
using RecrownedAthenaeum.UI.Skin.Definitions;
|
2018-11-30 02:41:06 +00:00
|
|
|
|
|
2018-12-04 13:45:09 +00:00
|
|
|
|
namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
|
2018-11-30 02:41:06 +00:00
|
|
|
|
{
|
2018-12-04 13:45:09 +00:00
|
|
|
|
public class TextButton : Button
|
2018-11-30 02:41:06 +00:00
|
|
|
|
{
|
2018-12-14 06:43:38 +00:00
|
|
|
|
private Text text;
|
|
|
|
|
public Color FontColor { get { return text.color; } set { text.color = value; } }
|
2018-11-30 02:41:06 +00:00
|
|
|
|
|
2018-12-14 06:43:38 +00:00
|
|
|
|
public TextButton(string text, SpriteFont font, ISpecialDrawable down, ISpecialDrawable up, ISpecialDrawable disabled = null, ISpecialDrawable selected = null) : base(down, up, disabled, selected)
|
2018-11-30 02:41:06 +00:00
|
|
|
|
{
|
2018-12-14 06:43:38 +00:00
|
|
|
|
this.text = new Text(font, text)
|
|
|
|
|
{
|
|
|
|
|
autoScale = true
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public TextButton(string text, 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];
|
2018-11-30 02:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Update(GameTime gameTime)
|
|
|
|
|
{
|
2018-12-14 06:43:38 +00:00
|
|
|
|
text.bounds = bounds;
|
|
|
|
|
text.Update(gameTime);
|
2018-11-30 02:41:06 +00:00
|
|
|
|
base.Update(gameTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Draw(SpriteBatch batch)
|
|
|
|
|
{
|
2018-12-14 06:43:38 +00:00
|
|
|
|
text.Draw(batch);
|
2018-11-30 02:41:06 +00:00
|
|
|
|
base.Draw(batch);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|