Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UIHeader.cs
Go to the documentation of this file.
1
using
Microsoft.Xna.Framework
;
2
using
Microsoft.Xna.Framework.Graphics
;
3
using
ReLogic.Graphics
;
4
using
Terraria.UI
;
5
6
namespace
Terraria.GameContent.UI.Elements
;
7
8
public
class
UIHeader
:
UIElement
9
{
10
private
string
_text
;
11
12
public
string
Text
13
{
14
get
15
{
16
return
_text
;
17
}
18
set
19
{
20
if
(
_text
!= value)
21
{
22
_text
= value;
23
if
(!
Main
.
dedServ
)
24
{
25
Vector2
vector =
FontAssets
.
DeathText
.Value.MeasureString(Text);
26
Width.Pixels = vector.
X
;
27
Height.Pixels = vector.
Y
;
28
}
29
Width.Precent = 0f;
30
Height.Precent = 0f;
31
Recalculate
();
32
}
33
}
34
}
35
36
public
UIHeader
()
37
{
38
Text =
""
;
39
}
40
41
public
UIHeader
(
string
text)
42
{
43
Text = text;
44
}
45
46
protected
override
void
DrawSelf
(
SpriteBatch
spriteBatch)
47
{
48
CalculatedStyle
dimensions =
GetDimensions
();
49
float
num = 1.2f;
50
DynamicSpriteFontExtensionMethods
.
DrawString
(spriteBatch,
FontAssets
.
DeathText
.Value, Text,
new
Vector2
(dimensions.
X
- num, dimensions.
Y
- num),
Color
.
Black
);
51
DynamicSpriteFontExtensionMethods
.
DrawString
(spriteBatch,
FontAssets
.
DeathText
.Value, Text,
new
Vector2
(dimensions.
X
+ num, dimensions.
Y
- num),
Color
.
Black
);
52
DynamicSpriteFontExtensionMethods
.
DrawString
(spriteBatch,
FontAssets
.
DeathText
.Value, Text,
new
Vector2
(dimensions.
X
- num, dimensions.
Y
+ num),
Color
.
Black
);
53
DynamicSpriteFontExtensionMethods
.
DrawString
(spriteBatch,
FontAssets
.
DeathText
.Value, Text,
new
Vector2
(dimensions.
X
+ num, dimensions.
Y
+ num),
Color
.
Black
);
54
if
(
WorldGen
.
tenthAnniversaryWorldGen
&& !
WorldGen
.
remixWorldGen
)
55
{
56
DynamicSpriteFontExtensionMethods
.
DrawString
(spriteBatch,
FontAssets
.
DeathText
.Value, Text,
new
Vector2
(dimensions.
X
, dimensions.
Y
),
Color
.
HotPink
);
57
}
58
else
59
{
60
DynamicSpriteFontExtensionMethods
.
DrawString
(spriteBatch,
FontAssets
.
DeathText
.Value, Text,
new
Vector2
(dimensions.
X
, dimensions.
Y
),
Color
.
White
);
61
}
62
}
63
}
Microsoft.Xna.Framework.Graphics.SpriteBatch
Definition
SpriteBatch.cs:8
ReLogic.Graphics.DynamicSpriteFontExtensionMethods.DrawString
static void DrawString(this SpriteBatch spriteBatch, DynamicSpriteFont spriteFont, string text, Vector2 position, Color color)
Definition
DynamicSpriteFontExtensionMethods.cs:9
ReLogic.Graphics.DynamicSpriteFontExtensionMethods
Definition
DynamicSpriteFontExtensionMethods.cs:8
Terraria.GameContent.FontAssets.DeathText
static Asset< DynamicSpriteFont > DeathText
Definition
FontAssets.cs:12
Terraria.GameContent.FontAssets
Definition
FontAssets.cs:7
Terraria.GameContent.UI.Elements.UIHeader.UIHeader
UIHeader(string text)
Definition
UIHeader.cs:41
Terraria.GameContent.UI.Elements.UIHeader.DrawSelf
override void DrawSelf(SpriteBatch spriteBatch)
Definition
UIHeader.cs:46
Terraria.GameContent.UI.Elements.UIHeader.UIHeader
UIHeader()
Definition
UIHeader.cs:36
Terraria.GameContent.UI.Elements.UIHeader._text
string _text
Definition
UIHeader.cs:10
Terraria.GameContent.UI.Elements.UIHeader
Definition
UIHeader.cs:9
Terraria.Main.dedServ
static bool dedServ
Definition
Main.cs:1226
Terraria.Main
Definition
Main.cs:79
Terraria.UI.UIElement.Recalculate
virtual void Recalculate()
Definition
UIElement.cs:281
Terraria.UI.UIElement.GetDimensions
CalculatedStyle GetDimensions()
Definition
UIElement.cs:382
Terraria.UI.UIElement
Definition
UIElement.cs:12
Terraria.WorldGen.remixWorldGen
static bool remixWorldGen
Definition
WorldGen.cs:1148
Terraria.WorldGen.tenthAnniversaryWorldGen
static bool tenthAnniversaryWorldGen
Definition
WorldGen.cs:1160
Terraria.WorldGen
Definition
WorldGen.cs:32
Microsoft.Xna.Framework.Graphics
Definition
AlphaTestEffect.cs:1
Microsoft.Xna.Framework
Definition
AlphaTestEffect.cs:1
ReLogic.Graphics
Definition
BasicDebugDrawer.cs:5
Terraria.GameContent.UI.Elements
Definition
AWorldListItem.cs:8
Terraria.UI
Definition
ChatLine.cs:3
Microsoft.Xna.Framework.Color.Black
static Color Black
Definition
Color.cs:92
Microsoft.Xna.Framework.Color.HotPink
static Color HotPink
Definition
Color.cs:186
Microsoft.Xna.Framework.Color.White
static Color White
Definition
Color.cs:350
Microsoft.Xna.Framework.Color
Definition
Color.cs:12
Microsoft.Xna.Framework.Vector2.X
float X
Definition
Vector2.cs:14
Microsoft.Xna.Framework.Vector2.Y
float Y
Definition
Vector2.cs:17
Microsoft.Xna.Framework.Vector2
Definition
Vector2.cs:12
Terraria.UI.CalculatedStyle.X
float X
Definition
CalculatedStyle.cs:7
Terraria.UI.CalculatedStyle.Y
float Y
Definition
CalculatedStyle.cs:9
Terraria.UI.CalculatedStyle
Definition
CalculatedStyle.cs:6
source
Terraria.GameContent.UI.Elements
UIHeader.cs
Generated by
1.10.0