Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
TextSnippet.cs
Go to the documentation of this file.
4
5namespace Terraria.UI.Chat;
6
7public class TextSnippet
8{
9 public string Text;
10
11 public string TextOriginal;
12
14
15 public float Scale = 1f;
16
17 public bool CheckForHover;
18
19 public bool DeleteWhole;
20
21 public TextSnippet(string text = "")
22 {
23 Text = text;
24 TextOriginal = text;
25 }
26
27 public TextSnippet(string text, Color color, float scale = 1f)
28 {
29 Text = text;
30 TextOriginal = text;
31 Color = color;
32 Scale = scale;
33 }
34
35 public virtual void Update()
36 {
37 }
38
39 public virtual void OnHover()
40 {
41 }
42
43 public virtual void OnClick()
44 {
45 }
46
47 public virtual Color GetVisibleColor()
48 {
50 }
51
52 public virtual bool UniqueDraw(bool justCheckingString, out Vector2 size, SpriteBatch spriteBatch, Vector2 position = default(Vector2), Color color = default(Color), float scale = 1f)
53 {
54 size = Vector2.Zero;
55 return false;
56 }
57
58 public virtual TextSnippet CopyMorph(string newText)
59 {
60 TextSnippet obj = (TextSnippet)MemberwiseClone();
61 obj.Text = newText;
62 return obj;
63 }
64
65 public virtual float GetStringLength(DynamicSpriteFont font)
66 {
67 return font.MeasureString(Text).X * Scale;
68 }
69
70 public override string ToString()
71 {
72 return "Text: " + Text + " | OriginalText: " + TextOriginal;
73 }
74}
static Color WaveColor(Color color)
virtual Color GetVisibleColor()
virtual TextSnippet CopyMorph(string newText)
virtual float GetStringLength(DynamicSpriteFont font)
TextSnippet(string text="")
TextSnippet(string text, Color color, float scale=1f)
virtual bool UniqueDraw(bool justCheckingString, out Vector2 size, SpriteBatch spriteBatch, Vector2 position=default(Vector2), Color color=default(Color), float scale=1f)
override string ToString()