Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UIBestiaryNPCEntryPortrait.cs
Go to the documentation of this file.
6using Terraria.UI;
7
9
11{
12 public BestiaryEntry Entry { get; private set; }
13
15 {
16 Entry = entry;
17 Height.Set(112f, 0f);
18 Width.Set(193f, 0f);
19 SetPadding(0f);
21 {
22 Width = new StyleDimension(-4f, 1f),
23 Height = new StyleDimension(-4f, 1f),
25 OverflowHidden = true,
26 HAlign = 0.5f,
27 VAlign = 0.5f
28 };
29 uIElement.SetPadding(0f);
30 if (portraitBackgroundAsset != null)
31 {
33 {
34 HAlign = 0.5f,
35 VAlign = 0.5f,
36 ScaleToFit = true,
37 Width = new StyleDimension(0f, 1f),
38 Height = new StyleDimension(0f, 1f),
40 });
41 }
42 for (int i = 0; i < overlays.Count; i++)
43 {
44 Asset<Texture2D> backgroundOverlayImage = overlays[i].GetBackgroundOverlayImage();
45 Color? backgroundOverlayColor = overlays[i].GetBackgroundOverlayColor();
47 {
48 HAlign = 0.5f,
49 VAlign = 0.5f,
50 ScaleToFit = true,
51 Width = new StyleDimension(0f, 1f),
52 Height = new StyleDimension(0f, 1f),
53 Color = (backgroundOverlayColor.HasValue ? backgroundOverlayColor.Value : Color.Lerp(Color.White, portraitColor, 0.5f))
54 });
55 }
57 uIElement.Append(element);
59 Append(new UIImage(Main.Assets.Request<Texture2D>("Images/UI/Bestiary/Portrait_Front", (AssetRequestMode)1))
60 {
61 VAlign = 0.5f,
62 HAlign = 0.5f,
63 IgnoresMouseInteraction = true
64 });
65 }
66}
UIBestiaryNPCEntryPortrait(BestiaryEntry entry, Asset< Texture2D > portraitBackgroundAsset, Color portraitColor, List< IBestiaryBackgroundOverlayAndColorProvider > overlays)
static IAssetRepository Assets
Definition Main.cs:209
StyleDimension Height
Definition UIElement.cs:29
void Append(UIElement element)
Definition UIElement.cs:166
StyleDimension Width
Definition UIElement.cs:27
void SetPadding(float pixels)
Definition UIElement.cs:361
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
void Set(float pixels, float precent)