Initial push
This commit is contained in:
commit
3240f07946
335 changed files with 11248 additions and 0 deletions
33
Scripts/Menu/inventory_menu.gd
Normal file
33
Scripts/Menu/inventory_menu.gd
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
extends Node
|
||||
|
||||
class_name InventoryMenu
|
||||
|
||||
|
||||
@onready var inventory : Inventory
|
||||
@onready var item_list : VBoxContainer = $CanvasLayer/PanelContainer/VBoxContainer/MarginContainer/ScrollContainer/VBoxContainer
|
||||
var item_scene : PackedScene = preload("res://Scenes/Menu/InventoryUiItem.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
$CanvasLayer.hide()
|
||||
pass
|
||||
|
||||
|
||||
func toggle_inventory() -> bool:
|
||||
var canvas = $CanvasLayer
|
||||
if canvas.visible == true:
|
||||
$CanvasLayer.hide()
|
||||
return false
|
||||
else:
|
||||
update_inventory()
|
||||
$CanvasLayer.show()
|
||||
return true
|
||||
|
||||
func update_inventory():
|
||||
for i in inventory.items:
|
||||
var new_item = item_scene.instantiate()
|
||||
# new_item.set_values(i.item.name, i.item.value, i.item.weight)
|
||||
item_list.add_child(new_item)
|
||||
new_item.set_values(i.item.name, 10, 10)
|
||||
print(i.item.name)
|
||||
print(i)
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue