refactored naming of ui text from text label to text.
This commit is contained in:
parent
af7653dbdd
commit
f3bfba0045
@ -13,11 +13,11 @@ namespace RecrownedAthenaeum.UI.Modular.Modules.Interactive
|
||||
{
|
||||
public class TextButton : Button
|
||||
{
|
||||
private TextLabel label;
|
||||
private Text label;
|
||||
|
||||
public TextButton(string text, SpriteFont font, NinePatch background) : base(background)
|
||||
{
|
||||
label = new TextLabel(font, text);
|
||||
label = new Text(font, text);
|
||||
label.autoScale = true;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
{
|
||||
public class TextLabel : UIModule
|
||||
public class Text : UIModule
|
||||
{
|
||||
private SpriteFont font;
|
||||
private float scale;
|
||||
@ -21,37 +21,12 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
public bool autoScale;
|
||||
public bool useEllipses;
|
||||
public string ellipsis = "...";
|
||||
private string ModifiedText
|
||||
{
|
||||
get
|
||||
{
|
||||
return displayedText;
|
||||
}
|
||||
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; } }
|
||||
|
||||
set
|
||||
{
|
||||
displayedText = value;
|
||||
modifiedTextSize = font.MeasureString(value);
|
||||
}
|
||||
}
|
||||
public string Text
|
||||
public Text(SpriteFont font, string content = null)
|
||||
{
|
||||
get
|
||||
{
|
||||
return originalText;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null) value = "...";
|
||||
modifiedTextSize = font.MeasureString(value);
|
||||
originalText = value;
|
||||
displayedText = value;
|
||||
}
|
||||
}
|
||||
|
||||
public TextLabel(SpriteFont font, string text = null)
|
||||
{
|
||||
Text = text;
|
||||
Content = content;
|
||||
this.font = font;
|
||||
}
|
||||
|
||||
@ -69,7 +44,7 @@ namespace RecrownedAthenaeum.UI.Modular.Modules
|
||||
|
||||
public override void Draw(SpriteBatch batch)
|
||||
{
|
||||
batch.DrawString(font, Text, position, color, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
batch.DrawString(font, Content, position, color, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
base.Draw(batch);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user