From f1b51bed52ffbd90b5b7cc8dcfc6f0484bbbeb3c Mon Sep 17 00:00:00 2001 From: Matheus Date: Mon, 8 Sep 2025 22:10:45 -0300 Subject: inventário acessivel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/GUI/ItemMenuEntry.cs | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 scripts/GUI/ItemMenuEntry.cs (limited to 'scripts/GUI/ItemMenuEntry.cs') diff --git a/scripts/GUI/ItemMenuEntry.cs b/scripts/GUI/ItemMenuEntry.cs new file mode 100644 index 0000000..449c97b --- /dev/null +++ b/scripts/GUI/ItemMenuEntry.cs @@ -0,0 +1,41 @@ +using Godot; + +public partial class ItemMenuEntry : HBoxContainer +{ + private TextureRect icon; + private Label shortcutLabel; + private Label nameLabel; + private Button activateBtn; + private Button dropBtn; + + [Signal] + public delegate void ActivateEventHandler(ConsumableItem Item); + + [Signal] + public delegate void DropEventHandler(ConsumableItem item); + + private ConsumableItem item; + + public void Initialize(ConsumableItem item, char? shortcut) { + this.item = item; + nameLabel.Text = item.DisplayName; + if (shortcut != null) { + shortcutLabel.Text = $"{shortcut}"; + } else { + shortcutLabel.Text = ""; + } + icon.Texture = item.Texture; + } + + public override void _Ready() { + base._Ready(); + icon = GetNode("Icon"); + shortcutLabel = GetNode