18 lines
411 B
GDScript
18 lines
411 B
GDScript
class_name ItemSlot
|
|
extends PanelContainer
|
|
|
|
@onready var texture_rect:TextureRect = %TextureRect
|
|
@onready var count_label = %CountLabel
|
|
|
|
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()
|