2024-07-09 22:33:38 +02:00
|
|
|
class_name ItemSlot
|
|
|
|
extends PanelContainer
|
|
|
|
|
|
|
|
@onready var texture_rect:TextureRect = %TextureRect
|
2024-09-06 12:34:18 +02:00
|
|
|
@onready var count_label = %CountLabel
|
2024-07-09 22:33:38 +02:00
|
|
|
|
2024-09-06 12:34:18 +02:00
|
|
|
func display(item:Item, count:int):
|
|
|
|
if item != null:
|
|
|
|
texture_rect.texture = item.icon
|
|
|
|
update_quantity_text(count)
|
|
|
|
|
|
|
|
func update_quantity_text(stack_size) -> void:
|
|
|
|
if stack_size <= 1:
|
|
|
|
count_label.hide()
|
|
|
|
else:
|
|
|
|
count_label.text = str(stack_size)
|
|
|
|
count_label.show()
|