30 lines
882 B
GDScript
30 lines
882 B
GDScript
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()
|