32 lines
759 B
GDScript3
32 lines
759 B
GDScript3
|
extends MarginContainer
|
||
|
|
||
|
signal item_hovered( item )
|
||
|
signal item_gui_input( item, event, node )
|
||
|
|
||
|
var item = null
|
||
|
|
||
|
func _on_icon_mouse_entered():
|
||
|
emit_signal( "item_hovered", self.item )
|
||
|
|
||
|
|
||
|
func _on_icon_gui_input(event):
|
||
|
emit_signal( "item_gui_input", self.item, event, self.name )
|
||
|
|
||
|
func update():
|
||
|
|
||
|
if self.item.icon:
|
||
|
$icon.texture = self.item.icon
|
||
|
elif not $icon.texture:
|
||
|
$icon.texture = preload( "res://assets/interfaces/unknow_icon.png" )
|
||
|
$label.text = self.item.label
|
||
|
# if self.item.number > 1:
|
||
|
# $number.text = str(self.item.number)
|
||
|
# else:
|
||
|
# $number.text = ""
|
||
|
#
|
||
|
# if not self.item.is_stackable and self.item.number_uses > 1:
|
||
|
# $number.text = str(self.item.number_uses)
|
||
|
|
||
|
|
||
|
|