Show if items can be placed in a slot when hovering (#1480)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
@@ -48,6 +48,7 @@ namespace Content.Client.GameObjects
|
||||
{
|
||||
button.OnPressed = (e) => AddToInventory(e, slot);
|
||||
button.OnStoragePressed = (e) => OpenStorage(e, slot);
|
||||
button.OnHover = (e) => RequestItemHover(slot);
|
||||
_inventoryButtons.Add(slot, new List<ItemSlotButton> {button});
|
||||
}
|
||||
|
||||
@@ -58,7 +59,8 @@ namespace Content.Client.GameObjects
|
||||
variable = new ItemSlotButton(texture, storageTexture)
|
||||
{
|
||||
OnPressed = (e) => AddToInventory(e, slot),
|
||||
OnStoragePressed = (e) => OpenStorage(e, slot)
|
||||
OnStoragePressed = (e) => OpenStorage(e, slot),
|
||||
OnHover = (e) => RequestItemHover(slot)
|
||||
};
|
||||
_inventoryButtons[slot].Add(variable);
|
||||
}
|
||||
@@ -114,6 +116,21 @@ namespace Content.Client.GameObjects
|
||||
}
|
||||
}
|
||||
|
||||
public override void HoverInSlot(Slots slot, IEntity entity, bool fits)
|
||||
{
|
||||
base.HoverInSlot(slot, entity, fits);
|
||||
|
||||
if (!_inventoryButtons.TryGetValue(slot, out var buttons))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var button in buttons)
|
||||
{
|
||||
_itemSlotManager.HoverInSlot(button, entity, fits);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void HandleInventoryKeybind(GUIBoundKeyEventArgs args, Slots slot)
|
||||
{
|
||||
if (!_inventoryButtons.TryGetValue(slot, out var buttons))
|
||||
|
||||
Reference in New Issue
Block a user