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

◆ ProvideUIElement()

UIElement Terraria.GameContent.Bestiary.NPCKillCounterInfoElement.ProvideUIElement ( BestiaryUICollectionInfo info)
inline

Implements Terraria.GameContent.Bestiary.IBestiaryInfoElement.

Definition at line 26 of file NPCKillCounterInfoElement.cs.

27 {
28 int? killCount = GetKillCount();
29 if (!killCount.HasValue || killCount.Value < 1)
30 {
31 return null;
32 }
34 {
35 Width = new StyleDimension(0f, 1f),
36 Height = new StyleDimension(109f, 0f)
37 };
38 if (killCount.HasValue)
39 {
40 _ = killCount.Value > 0;
41 }
42 else
43 _ = 0;
44 _ = 3;
45 int num = 0;
46 int num2 = 30;
47 int num3 = num2;
48 string text = killCount.Value.ToString();
49 _ = text.Length;
50 int num4 = Math.Max(0, -48 + 8 * text.Length);
51 float num5 = 0.5f;
52 _ = 0;
53 num4 = -3;
54 num5 = 1f;
55 int num6 = 8;
56 UIElement uIElement = new UIPanel(Main.Assets.Request<Texture2D>("Images/UI/Bestiary/Stat_Panel", (AssetRequestMode)1), null, 12, 7)
57 {
58 Width = new StyleDimension(-8 + num4, num5),
59 Height = new StyleDimension(num2, 0f),
60 BackgroundColor = new Color(43, 56, 101),
61 BorderColor = Color.Transparent,
62 Top = new StyleDimension(num, 0f),
63 Left = new StyleDimension(-num6, 0f),
64 HAlign = 1f
65 };
66 uIElement.SetPadding(0f);
67 uIElement.PaddingRight = 5f;
68 obj.Append(uIElement);
69 uIElement.OnUpdate += ShowDescription;
70 float textScale = 0.85f;
71 UIText element = new UIText(text, textScale)
72 {
73 HAlign = 1f,
74 VAlign = 0.5f,
75 Left = new StyleDimension(-3f, 0f),
76 Top = new StyleDimension(0f, 0f)
77 };
78 Item item = new Item();
79 item.SetDefaults(321);
80 item.scale = 0.8f;
81 UIItemIcon element2 = new UIItemIcon(item, blackedOut: false)
82 {
83 IgnoresMouseInteraction = true,
84 HAlign = 0f,
85 Left = new StyleDimension(-1f, 0f)
86 };
87 obj.Height.Pixels = num3;
88 uIElement.Append(element2);
89 uIElement.Append(element);
90 return obj;
91 }
static byte Max(byte val1, byte val2)
Definition Math.cs:738
void Append(UIElement element)
Definition UIElement.cs:166
void SetPadding(float pixels)
Definition UIElement.cs:361
static Color Transparent
Definition Color.cs:76

References Terraria.UI.UIElement.Append(), Terraria.Main.Assets, Microsoft.Xna.Framework.Graphics.Color, Terraria.GameContent.Bestiary.NPCKillCounterInfoElement.GetKillCount(), System.item, System.Math.Max(), System.obj, Terraria.UI.UIElement.SetPadding(), Terraria.GameContent.Bestiary.NPCKillCounterInfoElement.ShowDescription(), System.text, and Microsoft.Xna.Framework.Color.Transparent.