implemented skin system to ui modules; progress on functional text button.
This commit is contained in:
@@ -8,29 +8,40 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RecrownedAthenaeum.UI.Skin.Definitions;
|
||||
|
||||
namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
|
||||
{
|
||||
public class TextButton : Button
|
||||
{
|
||||
private Text label;
|
||||
private Text text;
|
||||
public Color FontColor { get { return text.color; } set { text.color = value; } }
|
||||
|
||||
public TextButton(string text, SpriteFont font, NinePatch background) : base(background)
|
||||
public TextButton(string text, SpriteFont font, ISpecialDrawable down, ISpecialDrawable up, ISpecialDrawable disabled = null, ISpecialDrawable selected = null) : base(down, up, disabled, selected)
|
||||
{
|
||||
label = new Text(font, text);
|
||||
label.autoScale = true;
|
||||
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];
|
||||
}
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
label.bounds = bounds;
|
||||
label.Update(gameTime);
|
||||
text.bounds = bounds;
|
||||
text.Update(gameTime);
|
||||
base.Update(gameTime);
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch batch)
|
||||
{
|
||||
label.Draw(batch);
|
||||
text.Draw(batch);
|
||||
base.Draw(batch);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user