feat: dragon list view

This commit is contained in:
Gerard Gascón 2025-04-09 13:59:41 +02:00
parent 577926e8fc
commit 3919df1805
17 changed files with 409 additions and 4 deletions

View file

@ -0,0 +1,30 @@
extends Window
class_name DragonList
@export var dragon_list_entry: PackedScene
@export var dragon_list_view: VBoxContainer
@export var hat_outfits: DragonOutfit
@export var shirt_outfits: DragonOutfit
@export var shoes_outfits: DragonOutfit
var _library: DragonLibrary
func set_library(library: DragonLibrary):
_library = library
for d in _library.dragons:
var hat: Texture2D = hat_outfits.get_texture(d['hat'])
var shirt: Texture2D = shirt_outfits.get_texture(d['shirt'])
var shoes: Texture2D = shoes_outfits.get_texture(d['shoes'])
append_dragon(d['name'], hat, shirt, shoes)
func append_dragon(name: String, hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
var dragon: DragonListEntry = dragon_list_entry.instantiate()
dragon.set_properties(name, hat, shirt, shoes)
dragon_list_view.add_child(dragon)
func _on_close_requested() -> void:
queue_free()