feat: dragon list view
This commit is contained in:
parent
577926e8fc
commit
3919df1805
17 changed files with 409 additions and 4 deletions
30
scenes/dragon_list/dragon_list_view.gd
Normal file
30
scenes/dragon_list/dragon_list_view.gd
Normal 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()
|
Loading…
Add table
Add a link
Reference in a new issue