Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UIBestiaryEntryButton.cs
Go to the documentation of this file.
2using System.Linq;
8using Terraria.UI;
9
11
13{
15
17
19
21
22 public BestiaryEntry Entry { get; private set; }
23
25 {
26 Entry = entry;
27 Height.Set(72f, 0f);
28 Width.Set(72f, 0f);
29 SetPadding(0f);
31 {
32 Width = new StyleDimension(-4f, 1f),
33 Height = new StyleDimension(-4f, 1f),
35 OverflowHidden = true,
36 HAlign = 0.5f,
37 VAlign = 0.5f
38 };
39 uIElement.SetPadding(0f);
40 uIElement.Append(new UIImage(Main.Assets.Request<Texture2D>("Images/UI/Bestiary/Slot_Back", (AssetRequestMode)1))
41 {
42 VAlign = 0.5f,
43 HAlign = 0.5f
44 });
46 {
48 if (val != null)
49 {
50 uIElement.Append(new UIImage(val)
51 {
52 HAlign = 0.5f,
53 VAlign = 0.5f
54 });
55 }
56 }
61 int? num = TryGettingDisplayIndex(entry);
62 if (num.HasValue)
63 {
64 UIText element = new UIText(num.Value.ToString(), 0.9f)
65 {
66 Top = new StyleDimension(10f, 0f),
67 Left = new StyleDimension(10f, 0f),
69 };
70 Append(element);
71 }
72 _bordersGlow = new UIImage(Main.Assets.Request<Texture2D>("Images/UI/Bestiary/Slot_Selection", (AssetRequestMode)1))
73 {
74 VAlign = 0.5f,
75 HAlign = 0.5f,
77 };
78 _bordersOverlay = new UIImage(Main.Assets.Request<Texture2D>("Images/UI/Bestiary/Slot_Overlay", (AssetRequestMode)1))
79 {
80 VAlign = 0.5f,
81 HAlign = 0.5f,
83 Color = Color.White * 0.6f
84 };
86 UIImage uIImage = new UIImage(Main.Assets.Request<Texture2D>("Images/UI/Bestiary/Slot_Front", (AssetRequestMode)1))
87 {
88 VAlign = 0.5f,
89 HAlign = 0.5f,
91 };
95 {
97 }
99 {
100 base.OnMouseOver += MouseOver;
101 base.OnMouseOut += MouseOut;
102 }
103 }
104
131
133 {
134 int? result = null;
136 if (bestiaryInfoElement != null)
137 {
138 result = (bestiaryInfoElement as IBestiaryEntryDisplayIndex).BestiaryDisplayIndex;
139 }
140 return result;
141 }
142
143 protected override void DrawSelf(SpriteBatch spriteBatch)
144 {
145 if (base.IsMouseHovering)
146 {
147 Main.instance.MouseText(_icon.GetHoverText(), 0, 0);
148 }
149 }
150
161
171}
static void PlaySound(int type, Vector2 position, int style=1)
void MouseOut(UIMouseEvent evt, UIElement listeningElement)
Asset< Texture2D > TryGettingBackgroundImageProvider(BestiaryEntry entry)
UIBestiaryEntryButton(BestiaryEntry entry, bool isAPrettyPortrait)
void MouseOver(UIMouseEvent evt, UIElement listeningElement)
static Main instance
Definition Main.cs:283
static IAssetRepository Assets
Definition Main.cs:209
StyleDimension Height
Definition UIElement.cs:29
void Append(UIElement element)
Definition UIElement.cs:166
StyleDimension Left
Definition UIElement.cs:25
StyleDimension Width
Definition UIElement.cs:27
void RemoveChild(UIElement child)
Definition UIElement.cs:182
void SetPadding(float pixels)
Definition UIElement.cs:361
StyleDimension Top
Definition UIElement.cs:23
void Set(float pixels, float precent)