class_name InventorySlotUi extends Button var slot_data: SlotData : set = set_slot_data @onready var texture_rect: TextureRect = $TextureRect @onready var label: Label = $Label func _ready() -> void: texture_rect.texture = null label.text = "" focus_entered.connect(on_item_focus) focus_exited.connect(on_item_unfocus) pressed.connect(item_pressed) func set_slot_data(value: SlotData) -> void: slot_data = value if slot_data == null: return texture_rect.texture = slot_data.item_data.texture label.text = str(slot_data.quantity) func on_item_focus() -> void: if slot_data == null or slot_data.item_data == null: return PauseMenu.update_item_description(slot_data.item_data.description) func on_item_unfocus() -> void: PauseMenu.update_item_description("") pass func item_pressed() -> void: if !slot_data or !slot_data.item_data: return if !slot_data.item_data.use(): return slot_data.quantity -= 1 label.text = str(slot_data.quantity)