Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ UIBestiaryNPCEntryPortrait()

Terraria.GameContent.UI.Elements.UIBestiaryNPCEntryPortrait.UIBestiaryNPCEntryPortrait ( BestiaryEntry entry,
Asset< Texture2D > portraitBackgroundAsset,
Color portraitColor,
List< IBestiaryBackgroundOverlayAndColorProvider > overlays )
inline

Definition at line 14 of file UIBestiaryNPCEntryPortrait.cs.

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 {
32 uIElement.Append(new UIImage(portraitBackgroundAsset)
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();
46 uIElement.Append(new UIImage(backgroundOverlayImage)
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 }
56 UIBestiaryEntryIcon element = new UIBestiaryEntryIcon(entry, isPortrait: true);
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 }
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)

References Terraria.UI.UIElement.Append(), Terraria.Main.Assets, System.Collections.Generic.Dictionary< TKey, TValue >.Count, Terraria.GameContent.UI.Elements.UIBestiaryNPCEntryPortrait.Entry, Terraria.UI.UIElement.HAlign, Terraria.UI.UIElement.Height, Terraria.UI.UIElement.IgnoresMouseInteraction, Microsoft.Xna.Framework.Color.Lerp(), Terraria.UI.UIElement.OverflowHidden, Terraria.UI.StyleDimension.Set(), Terraria.UI.UIElement.SetPadding(), Terraria.UI.UIElement.VAlign, Microsoft.Xna.Framework.Color.White, and Terraria.UI.UIElement.Width.