Commit 50bc8143 authored by Gerard Gascón's avatar Gerard Gascón
Browse files

fix: compilation errors that were caused by the dragonproperties refactoring

parent 46726bca
Loading
Loading
Loading
Loading

scenes/dragon_adder.gd

deleted100644 → 0
+0 −22
Original line number Diff line number Diff line
extends Button


@export var dragon_adder: PackedScene
@onready var base: GameManager = $"../.."


func _on_pressed() -> void:
	var adder: DragonAdder = dragon_adder.instantiate()
	adder.dragon_added.connect(_add_dragon)
	
	var window_position: Vector2i = DisplayServer.window_get_position()
	var window_size: Vector2i = DisplayServer.window_get_size()
	
	adder.position = window_position - adder.size / 2
	
	adder.show()
	add_child(adder)


func _add_dragon(dragon_name: String, hat: Texture2D, shirt: Texture2D, shoes: Texture2D):
	base.add_dragon(hat, shirt, shoes, dragon_name)

scenes/dragon_adder.gd.uid

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
uid://w60u0tg1hlvu
+0 −35
Original line number Diff line number Diff line
extends Window
class_name DragonAdder


@export var hat_outfits: DragonOutfit
@export var shirt_outfits: DragonOutfit
@export var shoes_outfits: DragonOutfit

var code_generator: CodeGenerator

@onready var line_edit: LineEdit = $CanvasLayer/LineEdit

signal dragon_added(dragon_name: String, hat: Texture2D, shirt: Texture2D, shoes: Texture2D)


func _ready() -> void:
	code_generator = CodeGenerator.new(hat_outfits, shirt_outfits, shoes_outfits)


func _on_button_pressed() -> void:
	var dragon: Dictionary = code_generator.descrypt(line_edit.text)
	if dragon['name'] == null:
		return
	
	var name: String = dragon['name']
	var hat: Texture2D = dragon['hat']
	var shirt: Texture2D = dragon['shirt']
	var shoes: Texture2D = dragon['shoes']
	
	dragon_added.emit(name, hat, shirt, shoes)
	
	queue_free()

func _on_close_requested() -> void:
	queue_free()
+0 −1
Original line number Diff line number Diff line
uid://b1fnwy6wnufw1
+0 −62
Original line number Diff line number Diff line
[gd_scene load_steps=6 format=3 uid="uid://oqa2ry73vqjf"]

[ext_resource type="Script" uid="uid://b1fnwy6wnufw1" path="res://scenes/dragon_adder/dragon_adder.gd" id="1_x83p2"]
[ext_resource type="Resource" uid="uid://cnhwn6kfcbjl5" path="res://assets/outfits/hats.tres" id="2_33u3u"]
[ext_resource type="Script" uid="uid://mhudiyt5gnt1" path="res://scenes/dragon_editor/line_edit.gd" id="2_77mmq"]
[ext_resource type="Resource" uid="uid://etegcak2sphs" path="res://assets/outfits/shirts.tres" id="3_xb0i6"]
[ext_resource type="Resource" uid="uid://ba5684xylts3f" path="res://assets/outfits/shoes.tres" id="4_nf61g"]

[node name="DragonAdder" type="Window"]
position = Vector2i(0, 36)
size = Vector2i(500, 300)
always_on_top = true
script = ExtResource("1_x83p2")
hat_outfits = ExtResource("2_33u3u")
shirt_outfits = ExtResource("3_xb0i6")
shoes_outfits = ExtResource("4_nf61g")

[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="Button" type="Button" parent="CanvasLayer"]
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -32.0
offset_top = -31.0
offset_right = 32.0
grow_horizontal = 2
grow_vertical = 0
focus_mode = 0
text = "afegeix"

[node name="LineEdit" type="LineEdit" parent="CanvasLayer"]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -214.0
offset_top = -29.0
offset_right = 214.0
offset_bottom = 29.0
grow_horizontal = 2
grow_vertical = 2
placeholder_text = "CODI"
alignment = 1
max_length = 22
script = ExtResource("2_77mmq")

[node name="Label" type="Label" parent="CanvasLayer"]
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -59.5
offset_right = 59.5
offset_bottom = 23.0
grow_horizontal = 2
text = "afegeix un drac"

[connection signal="close_requested" from="." to="." method="_on_close_requested"]
[connection signal="pressed" from="CanvasLayer/Button" to="." method="_on_button_pressed"]
Loading