feat: dragon list view
This commit is contained in:
parent
577926e8fc
commit
3919df1805
17 changed files with 409 additions and 4 deletions
29
src/dragon_library.gd
Normal file
29
src/dragon_library.gd
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
extends Node
|
||||
class_name DragonLibrary
|
||||
|
||||
|
||||
var dragons: Array = []
|
||||
|
||||
var hat_outfits: DragonOutfit
|
||||
var shirt_outfits: DragonOutfit
|
||||
var shoes_outfits: DragonOutfit
|
||||
|
||||
|
||||
func _init(hat_outfits: DragonOutfit, shirt_outfits: DragonOutfit, shoes_outfits: DragonOutfit) -> void:
|
||||
self.hat_outfits = hat_outfits
|
||||
self.shirt_outfits = shirt_outfits
|
||||
self.shoes_outfits = shoes_outfits
|
||||
|
||||
|
||||
func add_dragon(name: String, hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
|
||||
var hat_index: int = hat_outfits.get_index(hat)
|
||||
var shirt_index: int = shirt_outfits.get_index(shirt)
|
||||
var shoes_index: int = shoes_outfits.get_index(shoes)
|
||||
dragons.push_back({'name': name, 'hat': hat_index, 'shirt': shirt_index, 'shoes': shoes_index})
|
||||
|
||||
|
||||
func add_dragons(dragons: Array) -> void:
|
||||
for d in dragons:
|
||||
self.dragons.push_back(
|
||||
{'name': d['name'], 'hat': d['hat'], 'shirt': d['shirt'], 'shoes': d['shoes']}
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue