khanat-client/scenes/interfaces/inventory_window/inventory_box.gd
2020-04-01 21:02:49 +02:00

27 lines
916 B
GDScript

extends VBoxContainer
signal inventory_item_hovered( item )
signal inventory_item_gui_input( item, event, node )
func _on_inventory_item_hovered( item ):
emit_signal( "inventory_item_hovered", item )
func _on_inventory_item_gui_input( item, event, node ):
emit_signal( "inventory_item_gui_input", item, event, node )
func clean_inventory():
for child in $scroll_item_box/items_box.get_children():
$scroll_item_box/items_box.remove_child( child )
child.queue_free()
func set_inventory( p_inventory ):
self.clean_inventory()
if p_inventory:
for item in p_inventory.items:
print( item )
var new_item_box = preload( "res://scenes/interfaces/inventory_window/item_box.tscn").instance()
new_item_box.item = item
new_item_box.update()
$scroll_item_box/items_box.add_child( new_item_box )