From 639cd8cef403e9e66bf31e7888e786effac2b292 Mon Sep 17 00:00:00 2001 From: Matheus Date: Fri, 24 Oct 2025 21:25:15 -0300 Subject: refactor: Sistema de itens reescrito MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Em tese, este novo sistema é mais fácil de serializar. Descanse em paz pergaminhos, eu não quero reimplementá-los neste novo sistema. --- scripts/GUI/InventoryMenu.cs | 10 +++++----- scripts/GUI/ItemMenuEntry.cs | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'scripts/GUI') diff --git a/scripts/GUI/InventoryMenu.cs b/scripts/GUI/InventoryMenu.cs index dd8e133..7e264fa 100644 --- a/scripts/GUI/InventoryMenu.cs +++ b/scripts/GUI/InventoryMenu.cs @@ -11,9 +11,9 @@ public partial class InventoryMenu : CanvasLayer private VBoxContainer itemsNode; [Signal] - public delegate void ItemSelectedEventHandler(ConsumableItem item); + public delegate void ItemSelectedEventHandler(Item item); [Signal] - public delegate void ItemDropEventHandler(ConsumableItem item); + public delegate void ItemDropEventHandler(Item item); public override void _Ready() { @@ -23,12 +23,12 @@ public partial class InventoryMenu : CanvasLayer Hide(); } - public void OnActivate(ConsumableItem item) + public void OnActivate(Item item) { EmitSignal(SignalName.ItemSelected, item); } - public void OnDrop(ConsumableItem item) + public void OnDrop(Item item) { EmitSignal(SignalName.ItemDrop, item); } @@ -43,7 +43,7 @@ public partial class InventoryMenu : CanvasLayer Show(); } - private void RegisterItem(int index, ConsumableItem item) + private void RegisterItem(int index, Item item) { char? shortcut = null; diff --git a/scripts/GUI/ItemMenuEntry.cs b/scripts/GUI/ItemMenuEntry.cs index 6f18bd9..364c694 100644 --- a/scripts/GUI/ItemMenuEntry.cs +++ b/scripts/GUI/ItemMenuEntry.cs @@ -11,13 +11,13 @@ public partial class ItemMenuEntry : HBoxContainer private Label nameLabel; private Button activateBtn; private Button dropBtn; - private ConsumableItem item; + private Item item; [Signal] - public delegate void ActivateEventHandler(ConsumableItem Item); + public delegate void ActivateEventHandler(Item Item); [Signal] - public delegate void DropEventHandler(ConsumableItem Item); + public delegate void DropEventHandler(Item Item); public override void _Ready() { @@ -32,10 +32,10 @@ public partial class ItemMenuEntry : HBoxContainer dropBtn.Pressed += () => EmitSignal(SignalName.Drop, item); } - public void Initialize(ConsumableItem item, char? shortcut) + public void Initialize(Item item, char? shortcut) { this.item = item; - nameLabel.Text = item.DisplayName; + nameLabel.Text = item.Definition.DisplayName; if (shortcut != null) { shortcutLabel.Text = $"{shortcut}"; @@ -70,6 +70,6 @@ public partial class ItemMenuEntry : HBoxContainer { shortcutLabel.Text = ""; } - icon.Texture = item.Texture; + icon.Texture = item.Definition.Icon; } } -- cgit v1.2.3