implemented skin system to ui modules; progress on functional text button.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using RecrownedAthenaeum.Camera;
|
||||
using RecrownedAthenaeum.UI.Skin;
|
||||
using RecrownedAthenaeum.UI.Skin.Definitions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -11,6 +13,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
{
|
||||
public class Text : UIModule
|
||||
{
|
||||
private TextSkinDefinition skinDefinition;
|
||||
private SpriteFont font;
|
||||
private float scale;
|
||||
private Vector2 position;
|
||||
@@ -22,7 +25,8 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
public bool useEllipses;
|
||||
public string ellipsis = "...";
|
||||
private string ModifiedText { get { return displayedText; } set { displayedText = value; modifiedTextSize = font.MeasureString(value); } }
|
||||
public string Content { get { return originalText; } set { if (value == null) value = "..."; modifiedTextSize = font.MeasureString(value); originalText = value; displayedText = value; } }
|
||||
public string Content { get { return originalText; } set { if (value == null) value = ellipsis; modifiedTextSize = font.MeasureString(value); originalText = value; displayedText = value; } }
|
||||
|
||||
|
||||
public Text(SpriteFont font, string content = null)
|
||||
{
|
||||
@@ -30,6 +34,14 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
this.font = font;
|
||||
}
|
||||
|
||||
public Text(Skin.Skin skin, string skinDefinitionName = null, string content = null)
|
||||
{
|
||||
Content = content;
|
||||
skinDefinition = skin.ObtainDefinition<TextSkinDefinition>(skinDefinitionName, GetType());
|
||||
font = skin.fonts[skinDefinition.font];
|
||||
color = skin.colors[skinDefinition.color];
|
||||
}
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
position.X = bounds.X;
|
||||
|
||||
Reference in New Issue
Block a user