Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ChatMessageContainer.cs
Go to the documentation of this file.
4
5namespace Terraria.UI.Chat;
6
8{
9 public string OriginalText;
10
11 private bool _prepared;
12
14
15 private Color _color;
16
18
19 private int _timeLeft;
20
22
24
25 public bool Prepared => _prepared;
26
27 public void SetContents(string text, Color color, int widthLimitInPixels)
28 {
29 OriginalText = text;
30 _color = color;
34 _timeLeft = 600;
35 Refresh();
36 }
37
38 public void MarkToNeedRefresh()
39 {
40 _prepared = false;
41 }
42
43 public void Update()
44 {
45 if (_timeLeft > 0)
46 {
47 _timeLeft--;
48 }
49 Refresh();
50 }
51
53 {
54 int index = _parsedText.Count - 1 - snippetIndex;
55 return _parsedText[index];
56 }
57
58 public void Refresh()
59 {
60 if (!_prepared)
61 {
62 _prepared = true;
63 int num = _widthLimitInPixels;
64 if (num == -1)
65 {
66 num = Main.screenWidth - 320;
67 }
70 for (int i = 0; i < list.Count; i++)
71 {
72 _parsedText.Add(list[i].ToArray());
73 }
74 }
75 }
76}
void Add(TKey key, TValue value)
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
TextSnippet[] GetSnippetWithInversedIndex(int snippetIndex)
void SetContents(string text, Color color, int widthLimitInPixels)
static List< List< TextSnippet > > WordwrapStringSmart(string text, Color c, DynamicSpriteFont font, int maxWidth, int maxLines)
Definition Utils.cs:438