feat: pulling dragons from server working

This commit is contained in:
Gerard Gascón 2025-04-12 00:21:07 +02:00
parent 50bc814367
commit b080ab7bf4
11 changed files with 46 additions and 193 deletions

View file

@ -4,25 +4,18 @@ 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)
#
append_dragon(d)
func append_dragon(name: String, hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
func append_dragon(properties: DragonProperties):
var dragon: DragonListEntry = dragon_list_entry.instantiate()
dragon.set_properties(name, hat, shirt, shoes)
dragon.set_properties(properties)
dragon_list_view.add_child(dragon)