48 lines
1.3 KiB
GDScript
48 lines
1.3 KiB
GDScript
extends Window
|
|
class_name DragonEditor
|
|
|
|
|
|
@onready var hat: TextureRect = $CanvasLayer/Dragon/Hat
|
|
@onready var shirt: TextureRect = $CanvasLayer/Dragon/Shirt
|
|
@onready var shoes: TextureRect = $CanvasLayer/Dragon/Shoes
|
|
|
|
@export var hat_outfits: DragonOutfit
|
|
@export var shirt_outfits: DragonOutfit
|
|
@export var shoes_outfits: DragonOutfit
|
|
|
|
@onready var dragon_name: LineEdit = $CanvasLayer/LineEdit
|
|
|
|
signal on_create_dragon(hat: Texture2D, shirt: Texture2D, shoes: Texture2D, dragon_name: String)
|
|
|
|
|
|
func _ready() -> void:
|
|
hat.texture = null
|
|
shirt.texture = null
|
|
shoes.texture = null
|
|
|
|
|
|
func _on_close_requested() -> void:
|
|
queue_free()
|
|
|
|
|
|
func _on_change_hat_pressed() -> void:
|
|
hat.texture = hat_outfits.pick_next()
|
|
|
|
|
|
func _on_change_shirt_pressed() -> void:
|
|
shirt.texture = shirt_outfits.pick_next()
|
|
|
|
|
|
func _on_change_shoes_pressed() -> void:
|
|
shoes.texture = shoes_outfits.pick_next()
|
|
|
|
|
|
func _on_create_pressed() -> void:
|
|
if dragon_name.text.is_empty():
|
|
return
|
|
var result: String = CodeGenerator.new(hat_outfits, shirt_outfits, shoes_outfits).encrypt(hat.texture, shirt.texture, shoes.texture, dragon_name.text)
|
|
print(result)
|
|
var decrypted: Dictionary = CodeGenerator.new(hat_outfits, shirt_outfits, shoes_outfits).descrypt(result)
|
|
print(decrypted)
|
|
on_create_dragon.emit(hat.texture, shirt.texture, shoes.texture, dragon_name.text)
|
|
queue_free()
|