Files
Babushka/scripts/CSharp/Common/Inventory/SlotUi.cs
T

32 lines
704 B
C#
Raw Normal View History

2025-04-07 02:10:59 +02:00
using Godot;
using System;
namespace Babushka.scripts.CSharp.Common.Inventory;
public partial class SlotUi : Control
{
public Label nameLabel;
public int index;
2025-04-17 16:10:12 +02:00
public Label amountLabel;
2025-05-20 19:48:49 +02:00
public TextureRect icon;
2025-04-07 02:10:59 +02:00
[Signal] public delegate void ClickedEventHandler(int index);
public override void _EnterTree()
{
nameLabel = GetNode<Label>("NameLabel");
2025-04-17 16:10:12 +02:00
amountLabel = GetNode<Label>("AmountLabel");
2025-05-20 19:48:49 +02:00
icon = GetNode<TextureRect>("Icon");
2025-04-07 02:10:59 +02:00
}
public void _on_gui_input(InputEvent ev)
{
if (ev is not InputEventMouseButton mev) return;
if (mev.Pressed)
{
EmitSignalClicked(index);
}
}
}