Added debug inventory menu

This commit is contained in:
2025-05-19 17:41:39 -05:00
parent 3b9986b4ee
commit 057ed10851
26 changed files with 309 additions and 24 deletions

View File

@@ -6,6 +6,8 @@ func _ready() -> void:
$MainMenu.connect("pressed", _on_MainMenu_pressed);
$OverworldOption/Overworld.connect("pressed", _on_Overworld_pressed);
$Quests.connect("pressed", _on_Quests_pressed);
$Inventory.connect("pressed", _on_Inventory_pressed);
$Event.connect("pressed", _on_Event_pressed);
$Cutscene.connect("pressed", _on_Custscene_pressed);
$Cooking.connect("pressed", _on_Cooking_pressed);
$Battle.connect("pressed", _on_Battle_pressed);
@@ -58,6 +60,16 @@ func _on_Cooking_pressed():
func _on_Battle_pressed():
print("Battle pressed")
func _on_Event_pressed():
print("Event pressed")
func _on_Inventory_pressed():
close()
if UI.INVENTORY_MENU.isOpen():
UI.INVENTORY_MENU.close()
else:
UI.INVENTORY_MENU.open()
func open() -> void:
show()

View File

@@ -0,0 +1 @@
uid://bqe8ve2hn3coc

View File

@@ -0,0 +1,46 @@
class_name FullInventoryMenu extends Panel
@export var itemLine:PackedScene = null;
@export var itemList:Control = null;
var inventory:Inventory = null;
func _ready() -> void:
hide()
_updateItemList()
func _exit_tree() -> void:
pass
func open(inventory:Inventory = null) -> void:
if self.inventory != null:
self.inventory.inventoryUpdated.disconnect(_updateItemList)
if inventory == null:
inventory = ITEM.PLAYER_INVENTORY;
self.inventory = inventory;
self.inventory.inventoryUpdated.connect(_updateItemList)
_updateItemList()
self.show()
func close() -> void:
self.hide()
func isOpen() -> bool:
return self.visible
func _updateItemList() -> void:
if inventory == null:
return
# Clear item list
while itemList.get_child_count() > 0:
var child = itemList.get_child(0)
itemList.remove_child(child)
child.queue_free()
for stack in inventory.contents:
var node = itemLine.instantiate()
node.setStack(stack)
itemList.add_child(node)

View File

@@ -0,0 +1 @@
uid://cla3ph1j2ligp

View File

@@ -0,0 +1,5 @@
class_name ItemLine extends HBoxContainer
func setStack(stack:ItemStack) -> void:
$ItemName.text = Item.getName(stack.type, 1)
$ItemQuantity.text = str(stack.quantity)

View File

@@ -0,0 +1 @@
uid://dgblia2ukssbe