Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
UIItemSlot.cs
Go to the documentation of this file.
3using Terraria.UI;
4
6
7public class UIItemSlot : UIElement
8{
9 private Item[] _itemArray;
10
11 private int _itemIndex;
12
13 private int _itemSlotContext;
14
15 public UIItemSlot(Item[] itemArray, int itemIndex, int itemSlotContext)
16 {
17 _itemArray = itemArray;
18 _itemIndex = itemIndex;
19 _itemSlotContext = itemSlotContext;
20 Width = new StyleDimension(48f, 0f);
21 Height = new StyleDimension(48f, 0f);
22 }
23
24 private void HandleItemSlotLogic()
25 {
26 if (base.IsMouseHovering)
27 {
28 Main.LocalPlayer.mouseInterface = true;
35 }
36 }
37
38 protected override void DrawSelf(SpriteBatch spriteBatch)
39 {
42 Vector2 position = GetDimensions().Center() + new Vector2(52f, 52f) * -0.5f * Main.inventoryScale;
43 ItemSlot.Draw(spriteBatch, ref inv, _itemSlotContext, position);
44 }
45}
override void DrawSelf(SpriteBatch spriteBatch)
Definition UIItemSlot.cs:38
UIItemSlot(Item[] itemArray, int itemIndex, int itemSlotContext)
Definition UIItemSlot.cs:15
static float inventoryScale
Definition Main.cs:1779
static void Draw(SpriteBatch spriteBatch, ref Item inv, int context, Vector2 position, Color lightColor=default(Color))
Definition ItemSlot.cs:1777
static void OverrideHover(ref Item inv, int context=0)
Definition ItemSlot.cs:322
static void RightClick(ref Item inv, int context=0)
Definition ItemSlot.cs:1313
static void LeftClick(ref Item inv, int context=0)
Definition ItemSlot.cs:630
static void MouseHover(int context=0)
Definition ItemSlot.cs:2445
StyleDimension Height
Definition UIElement.cs:29
StyleDimension Width
Definition UIElement.cs:27
CalculatedStyle GetDimensions()
Definition UIElement.cs:382