feat: menu overhaul
This commit is contained in:
parent
b17c7280ea
commit
f379dff516
16 changed files with 273 additions and 181 deletions
BIN
assets/fonts/Montjuic.ttf
Normal file
BIN
assets/fonts/Montjuic.ttf
Normal file
Binary file not shown.
40
assets/fonts/Montjuic.ttf.import
Normal file
40
assets/fonts/Montjuic.ttf.import
Normal file
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://u1pey2ilx31c"
|
||||
path="res://.godot/imported/Montjuic.ttf-8309c10243eb822274a7d41c695112ee.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/Montjuic.ttf"
|
||||
dest_files=["res://.godot/imported/Montjuic.ttf-8309c10243eb822274a7d41c695112ee.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=0
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=4
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[{
|
||||
"chars": [],
|
||||
"glyphs": [],
|
||||
"name": "New Configuration",
|
||||
"size": Vector2i(16, 0)
|
||||
}]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
Binary file not shown.
BIN
assets/fonts/m3x6.ttf
Normal file
BIN
assets/fonts/m3x6.ttf
Normal file
Binary file not shown.
|
@ -2,18 +2,18 @@
|
|||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://dn8qanm8tctb2"
|
||||
path="res://.godot/imported/Montserrat-Regular.ttf-15e5248c373097bdb910cdf2cfc29eaa.fontdata"
|
||||
uid="uid://5nniov81t44i"
|
||||
path="res://.godot/imported/m3x6.ttf-21dd1b2d0cb60e4b8c1f80f8ebd64585.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/fonts/Montserrat-Regular.ttf"
|
||||
dest_files=["res://.godot/imported/Montserrat-Regular.ttf-15e5248c373097bdb910cdf2cfc29eaa.fontdata"]
|
||||
source_file="res://assets/fonts/m3x6.ttf"
|
||||
dest_files=["res://.godot/imported/m3x6.ttf-21dd1b2d0cb60e4b8c1f80f8ebd64585.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
antialiasing=0
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
|
@ -29,7 +29,12 @@ Fallbacks=null
|
|||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
preload=[{
|
||||
"chars": [],
|
||||
"glyphs": [],
|
||||
"name": "New Configuration",
|
||||
"size": Vector2i(16, 0)
|
||||
}]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=23 format=3 uid="uid://fut42ruut302"]
|
||||
[gd_scene load_steps=24 format=3 uid="uid://fut42ruut302"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bfuos2kgfgber" path="res://scenes/dragon_editor/dragon_editor.gd" id="1_8vkll"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://ccxyplt2t7t6y" path="res://assets/animations/hats/barretina.tres" id="2_aystc"]
|
||||
|
@ -11,10 +11,11 @@
|
|||
[ext_resource type="Script" path="res://src/draggable.gd" id="7_1vw8k"]
|
||||
[ext_resource type="Texture2D" uid="uid://bu5xa7tgfk3h3" path="res://assets/sprites/ui/DP_UI_Buttons01.png" id="7_qppok"]
|
||||
[ext_resource type="Texture2D" uid="uid://bgpbbkmwt8ysq" path="res://assets/sprites/ui/DP_UI_Button_Text.png" id="8_ofxsr"]
|
||||
[ext_resource type="Script" uid="uid://mhudiyt5gnt1" path="res://scenes/dragon_editor/line_edit.gd" id="9_xhgxf"]
|
||||
[ext_resource type="Texture2D" uid="uid://bdrm1nxydvf5t" path="res://assets/sprites/ui/DP_UI_Label_Big.png" id="12_qppok"]
|
||||
[ext_resource type="FontFile" uid="uid://u1pey2ilx31c" path="res://assets/fonts/Montjuic.ttf" id="14_1vw8k"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://duxxw4mfxql3c" path="res://assets/animations/dragons/verd.tres" id="14_aystc"]
|
||||
[ext_resource type="StyleBox" uid="uid://bhe580k04w6ve" path="res://assets/styles/style_box_empty.tres" id="14_bh8dj"]
|
||||
[ext_resource type="FontFile" uid="uid://5nniov81t44i" path="res://assets/fonts/m3x6.ttf" id="14_rrp4v"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://dsxhfu2ekw7j" path="res://assets/animations/shirts/traje.tres" id="15_x0448"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ofxsr"]
|
||||
|
@ -144,6 +145,18 @@ focus_mode = 0
|
|||
icon = SubResource("AtlasTexture_mc14k")
|
||||
flat = true
|
||||
|
||||
[node name="Label" type="Label" parent="CanvasLayer/create"]
|
||||
layout_mode = 0
|
||||
offset_left = 6.0
|
||||
offset_top = -2.0
|
||||
offset_right = 64.0
|
||||
offset_bottom = 26.0
|
||||
theme_override_colors/font_color = Color(0.537255, 0.603922, 0.615686, 1)
|
||||
theme_override_fonts/font = ExtResource("14_rrp4v")
|
||||
theme_override_font_sizes/font_size = 33
|
||||
text = "crea"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="close" type="Button" parent="CanvasLayer"]
|
||||
offset_left = 178.0
|
||||
offset_top = 6.0
|
||||
|
@ -166,13 +179,14 @@ offset_left = 10.0
|
|||
offset_top = 8.0
|
||||
offset_right = 138.0
|
||||
offset_bottom = 42.0
|
||||
theme_override_fonts/font = ExtResource("14_1vw8k")
|
||||
theme_override_font_sizes/font_size = 28
|
||||
theme_override_styles/focus = ExtResource("14_bh8dj")
|
||||
placeholder_text = "NOM"
|
||||
alignment = 1
|
||||
max_length = 8
|
||||
flat = true
|
||||
caret_blink = true
|
||||
script = ExtResource("9_xhgxf")
|
||||
|
||||
[connection signal="close_requested" from="." to="." method="_on_close_requested"]
|
||||
[connection signal="pressed" from="CanvasLayer/change_hat" to="." method="_on_change_hat_pressed"]
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
extends LineEdit
|
||||
|
||||
|
||||
var available_characters: Array[String] = [
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
'G',
|
||||
'H',
|
||||
'I',
|
||||
'J',
|
||||
'K',
|
||||
'L',
|
||||
'M',
|
||||
'N',
|
||||
'O',
|
||||
'P',
|
||||
'Q',
|
||||
'R',
|
||||
'S',
|
||||
'T',
|
||||
'U',
|
||||
'V',
|
||||
'W',
|
||||
'X',
|
||||
'Y',
|
||||
'Z',
|
||||
' ',
|
||||
]
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
connect("text_changed", _text_to_upper)
|
||||
|
||||
|
||||
func _text_to_upper(new_text: String):
|
||||
var ascii_map := {
|
||||
"á":"a", "à":"a", "â":"a", "ä":"a", "ã":"a", "å":"a",
|
||||
"é":"e", "è":"e", "ê":"e", "ë":"e",
|
||||
"í":"i", "ì":"i", "î":"i", "ï":"i",
|
||||
"ó":"o", "ò":"o", "ô":"o", "ö":"o", "õ":"o",
|
||||
"ú":"u", "ù":"u", "û":"u", "ü":"u",
|
||||
"ñ":"n", "ç":"c",
|
||||
"Á":"A", "À":"A", "Â":"A", "Ä":"A", "Ã":"A", "Å":"A",
|
||||
"É":"E", "È":"E", "Ê":"E", "Ë":"E",
|
||||
"Í":"I", "Ì":"I", "Î":"I", "Ï":"I",
|
||||
"Ó":"O", "Ò":"O", "Ô":"O", "Ö":"O", "Õ":"O",
|
||||
"Ú":"U", "Ù":"U", "Û":"U", "Ü":"U",
|
||||
"Ñ":"N", "Ç":"C"
|
||||
}
|
||||
|
||||
var filtered_text := ""
|
||||
for c in new_text.to_upper():
|
||||
if ascii_map.has(c) and available_characters.has(ascii_map[c]):
|
||||
filtered_text += ascii_map[c]
|
||||
elif c.unicode_at(0) <= 127 and available_characters.has(c):
|
||||
filtered_text += c
|
||||
|
||||
var last_caret_column = caret_column
|
||||
text = filtered_text
|
||||
caret_column = last_caret_column
|
|
@ -1 +0,0 @@
|
|||
uid://mhudiyt5gnt1
|
28
scenes/dragon_list/dragon/dragon.tscn
Normal file
28
scenes/dragon_list/dragon/dragon.tscn
Normal file
|
@ -0,0 +1,28 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://cq3orf2ktmel0"]
|
||||
|
||||
[ext_resource type="SpriteFrames" uid="uid://duxxw4mfxql3c" path="res://assets/animations/dragons/verd.tres" id="1_o3jkx"]
|
||||
[ext_resource type="Script" uid="uid://b7knkhjgtdy4l" path="res://scenes/dragon_list/dragon/dragon_list_entry.gd" id="2_uckob"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://ccxyplt2t7t6y" path="res://assets/animations/hats/barretina.tres" id="3_jl6px"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://dsxhfu2ekw7j" path="res://assets/animations/shirts/traje.tres" id="4_v3rc7"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://c5rqqy7b5ihi5" path="res://assets/animations/decor/rosa.tres" id="5_jpsrj"]
|
||||
|
||||
[node name="Dragon" type="AnimatedSprite2D" node_paths=PackedStringArray("color", "hat", "shirt", "decor")]
|
||||
sprite_frames = ExtResource("1_o3jkx")
|
||||
animation = &"idle"
|
||||
script = ExtResource("2_uckob")
|
||||
color = NodePath(".")
|
||||
hat = NodePath("Hat")
|
||||
shirt = NodePath("Shirt")
|
||||
decor = NodePath("Decor")
|
||||
|
||||
[node name="Hat" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = ExtResource("3_jl6px")
|
||||
animation = &"idle"
|
||||
|
||||
[node name="Shirt" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = ExtResource("4_v3rc7")
|
||||
animation = &"idle"
|
||||
|
||||
[node name="Decor" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = ExtResource("5_jpsrj")
|
||||
animation = &"idle"
|
26
scenes/dragon_list/dragon/dragon_list_entry.gd
Normal file
26
scenes/dragon_list/dragon/dragon_list_entry.gd
Normal file
|
@ -0,0 +1,26 @@
|
|||
extends Node2D
|
||||
class_name DragonListEntry
|
||||
|
||||
|
||||
@export var color: AnimatedSprite2D
|
||||
@export var hat: AnimatedSprite2D
|
||||
@export var shirt: AnimatedSprite2D
|
||||
@export var decor: AnimatedSprite2D
|
||||
|
||||
|
||||
func play_animation(anim: String):
|
||||
color.set_frame(0)
|
||||
color.play(anim)
|
||||
hat.set_frame(0)
|
||||
hat.play(anim)
|
||||
shirt.set_frame(0)
|
||||
shirt.play(anim)
|
||||
decor.set_frame(0)
|
||||
decor.play(anim)
|
||||
|
||||
|
||||
func face_direction(left: bool):
|
||||
color.flip_h = not left
|
||||
hat.flip_h = not left
|
||||
shirt.flip_h = not left
|
||||
decor.flip_h = not left
|
1
scenes/dragon_list/dragon/dragon_list_entry.gd.uid
Normal file
1
scenes/dragon_list/dragon/dragon_list_entry.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://b7knkhjgtdy4l
|
|
@ -1,15 +1,9 @@
|
|||
[gd_scene load_steps=16 format=3 uid="uid://tubxrqxjic6r"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://tubxrqxjic6r"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dm8d0ikf1n8qa" path="res://scenes/dragon_list/dragon_list_view.gd" id="1_q7g8i"]
|
||||
[ext_resource type="Resource" uid="uid://x063x858re3f" path="res://assets/outfits/hats.tres" id="2_1ytgk"]
|
||||
[ext_resource type="Texture2D" uid="uid://dceoy4417v83e" path="res://assets/sprites/ui/DP_UI_CharCreation_BG.png" id="3_3pkqp"]
|
||||
[ext_resource type="Resource" uid="uid://bsydervvb1jpe" path="res://assets/outfits/shirts.tres" id="3_74fyi"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://duxxw4mfxql3c" path="res://assets/animations/dragons/verd.tres" id="4_1n46k"]
|
||||
[ext_resource type="Resource" uid="uid://dkm7d10c1lp2n" path="res://assets/outfits/decor.tres" id="4_b7eir"]
|
||||
[ext_resource type="Resource" uid="uid://c03ejnvavmcj5" path="res://assets/outfits/dragons.tres" id="5_cv2ce"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://ccxyplt2t7t6y" path="res://assets/animations/hats/barretina.tres" id="5_u20w8"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://dsxhfu2ekw7j" path="res://assets/animations/shirts/traje.tres" id="6_1ytgk"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://c5rqqy7b5ihi5" path="res://assets/animations/decor/rosa.tres" id="7_74fyi"]
|
||||
[ext_resource type="PackedScene" uid="uid://cq3orf2ktmel0" path="res://scenes/dragon_list/dragon/dragon.tscn" id="2_h4iwm"]
|
||||
[ext_resource type="Texture2D" uid="uid://d27vpp71fe4de" path="res://assets/sprites/ui/DP_UI_CharList_Frame.png" id="6_74fyi"]
|
||||
[ext_resource type="FontFile" uid="uid://u1pey2ilx31c" path="res://assets/fonts/Montjuic.ttf" id="8_74fyi"]
|
||||
[ext_resource type="Script" path="res://src/draggable.gd" id="8_b7eir"]
|
||||
[ext_resource type="Texture2D" uid="uid://bdrm1nxydvf5t" path="res://assets/sprites/ui/DP_UI_Label_Big.png" id="9_cv2ce"]
|
||||
[ext_resource type="Texture2D" uid="uid://bu5xa7tgfk3h3" path="res://assets/sprites/ui/DP_UI_Buttons01.png" id="9_k4ppc"]
|
||||
|
@ -22,52 +16,63 @@ region = Rect2(0, 120, 38, 40)
|
|||
atlas = ExtResource("9_k4ppc")
|
||||
region = Rect2(0, 160, 38, 40)
|
||||
|
||||
[node name="DragonList" type="Window" node_paths=PackedStringArray("origin_name_label", "dragon_name_label", "hat", "shirt", "decor", "dragon")]
|
||||
[node name="DragonList" type="Window" node_paths=PackedStringArray("dragon_list_pivot", "origin_name_label", "dragon_name_label")]
|
||||
transparent_bg = true
|
||||
size = Vector2i(230, 332)
|
||||
size = Vector2i(300, 332)
|
||||
unresizable = true
|
||||
borderless = true
|
||||
always_on_top = true
|
||||
transparent = true
|
||||
script = ExtResource("1_q7g8i")
|
||||
origin_name_label = NodePath("CanvasLayer/TowerLabel/Label")
|
||||
dragon_list_entry_template = ExtResource("2_h4iwm")
|
||||
dragon_list_pivot = NodePath("CanvasLayer/SubViewportContainer/SubViewport/Pivot")
|
||||
origin_name_label = NodePath("CanvasLayer/TowerNameLabel/Label")
|
||||
dragon_name_label = NodePath("CanvasLayer/NameLabel/Label")
|
||||
hat = NodePath("CanvasLayer/Dragon/Hat")
|
||||
shirt = NodePath("CanvasLayer/Dragon/Shirt")
|
||||
decor = NodePath("CanvasLayer/Dragon/Decor")
|
||||
dragon = NodePath("CanvasLayer/Dragon")
|
||||
hat_outfits = ExtResource("2_1ytgk")
|
||||
shirt_outfits = ExtResource("3_74fyi")
|
||||
decor_outfits = ExtResource("4_b7eir")
|
||||
dragon_colors = ExtResource("5_cv2ce")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="BG" type="TextureRect" parent="CanvasLayer"]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
texture = ExtResource("3_3pkqp")
|
||||
[node name="ColorRect" type="ColorRect" parent="CanvasLayer"]
|
||||
offset_left = 22.0
|
||||
offset_top = 38.0
|
||||
offset_right = 296.0
|
||||
offset_bottom = 308.0
|
||||
color = Color(0.176471, 0.227451, 0.239216, 1)
|
||||
|
||||
[node name="TowerLabel" type="TextureRect" parent="CanvasLayer"]
|
||||
[node name="Background" type="NinePatchRect" parent="CanvasLayer"]
|
||||
offset_left = 18.0
|
||||
offset_top = 32.0
|
||||
offset_right = 300.0
|
||||
offset_bottom = 314.0
|
||||
texture = ExtResource("6_74fyi")
|
||||
patch_margin_left = 32
|
||||
patch_margin_top = 32
|
||||
patch_margin_right = 32
|
||||
patch_margin_bottom = 32
|
||||
|
||||
[node name="TowerNameLabel" type="NinePatchRect" parent="CanvasLayer"]
|
||||
offset_left = 34.0
|
||||
offset_top = 50.0
|
||||
offset_right = 182.0
|
||||
offset_right = 284.0
|
||||
offset_bottom = 98.0
|
||||
texture = ExtResource("9_cv2ce")
|
||||
patch_margin_left = 74
|
||||
patch_margin_right = 74
|
||||
|
||||
[node name="Label" type="Label" parent="CanvasLayer/TowerLabel"]
|
||||
layout_mode = 0
|
||||
[node name="Label" type="Label" parent="CanvasLayer/TowerNameLabel"]
|
||||
offset_left = 2.0
|
||||
offset_top = 2.0
|
||||
offset_right = 148.0
|
||||
offset_right = 250.0
|
||||
offset_bottom = 48.0
|
||||
text = "La Seu d'Urgell"
|
||||
theme_override_fonts/font = ExtResource("8_74fyi")
|
||||
theme_override_font_sizes/font_size = 28
|
||||
text = "AAAAAAAAAAAAAAAA"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="NameLabel" type="TextureRect" parent="CanvasLayer"]
|
||||
offset_left = 34.0
|
||||
offset_left = 89.0
|
||||
offset_top = 228.0
|
||||
offset_right = 182.0
|
||||
offset_right = 237.0
|
||||
offset_bottom = 276.0
|
||||
texture = ExtResource("9_cv2ce")
|
||||
|
||||
|
@ -76,6 +81,8 @@ layout_mode = 0
|
|||
offset_top = 2.0
|
||||
offset_right = 148.0
|
||||
offset_bottom = 48.0
|
||||
theme_override_fonts/font = ExtResource("8_74fyi")
|
||||
theme_override_font_sizes/font_size = 28
|
||||
text = "DRAGONET"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
@ -85,31 +92,29 @@ layout_mode = 3
|
|||
anchors_preset = 0
|
||||
offset_left = 18.0
|
||||
offset_top = 32.0
|
||||
offset_right = 198.0
|
||||
offset_right = 307.0
|
||||
offset_bottom = 320.0
|
||||
script = ExtResource("8_b7eir")
|
||||
|
||||
[node name="Dragon" type="AnimatedSprite2D" parent="CanvasLayer"]
|
||||
position = Vector2(112, 154)
|
||||
sprite_frames = ExtResource("4_1n46k")
|
||||
animation = &"idle"
|
||||
[node name="SubViewportContainer" type="SubViewportContainer" parent="CanvasLayer"]
|
||||
offset_left = 24.0
|
||||
offset_top = 105.0
|
||||
offset_right = 224.0
|
||||
offset_bottom = 213.0
|
||||
|
||||
[node name="Hat" type="AnimatedSprite2D" parent="CanvasLayer/Dragon"]
|
||||
sprite_frames = ExtResource("5_u20w8")
|
||||
animation = &"idle"
|
||||
[node name="SubViewport" type="SubViewport" parent="CanvasLayer/SubViewportContainer"]
|
||||
transparent_bg = true
|
||||
handle_input_locally = false
|
||||
size = Vector2i(270, 108)
|
||||
render_target_update_mode = 4
|
||||
|
||||
[node name="Shirt" type="AnimatedSprite2D" parent="CanvasLayer/Dragon"]
|
||||
sprite_frames = ExtResource("6_1ytgk")
|
||||
animation = &"idle"
|
||||
|
||||
[node name="Decor" type="AnimatedSprite2D" parent="CanvasLayer/Dragon"]
|
||||
sprite_frames = ExtResource("7_74fyi")
|
||||
animation = &"idle"
|
||||
[node name="Pivot" type="Node2D" parent="CanvasLayer/SubViewportContainer/SubViewport"]
|
||||
position = Vector2(135, 54)
|
||||
|
||||
[node name="dragon_previous" type="Button" parent="CanvasLayer"]
|
||||
offset_left = 76.0
|
||||
offset_left = 127.0
|
||||
offset_top = 136.0
|
||||
offset_right = 122.0
|
||||
offset_right = 173.0
|
||||
offset_bottom = 184.0
|
||||
scale = Vector2(-1, 1)
|
||||
focus_mode = 0
|
||||
|
@ -117,22 +122,24 @@ icon = SubResource("AtlasTexture_1n46k")
|
|||
flat = true
|
||||
|
||||
[node name="dragon_next" type="Button" parent="CanvasLayer"]
|
||||
offset_left = 134.0
|
||||
offset_left = 185.0
|
||||
offset_top = 136.0
|
||||
offset_right = 180.0
|
||||
offset_right = 231.0
|
||||
offset_bottom = 184.0
|
||||
focus_mode = 0
|
||||
icon = SubResource("AtlasTexture_1n46k")
|
||||
flat = true
|
||||
|
||||
[node name="close" type="Button" parent="CanvasLayer"]
|
||||
offset_left = 178.0
|
||||
offset_top = 6.0
|
||||
offset_right = 224.0
|
||||
offset_bottom = 54.0
|
||||
offset_left = 264.0
|
||||
offset_top = 12.0
|
||||
offset_right = 310.0
|
||||
offset_bottom = 60.0
|
||||
focus_mode = 0
|
||||
icon = SubResource("AtlasTexture_u20w8")
|
||||
flat = true
|
||||
|
||||
[connection signal="close_requested" from="." to="." method="_on_close_requested"]
|
||||
[connection signal="pressed" from="CanvasLayer/dragon_previous" to="." method="_on_dragon_previous_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/dragon_next" to="." method="_on_dragon_next_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/close" to="." method="_on_close_pressed"]
|
||||
|
|
|
@ -2,24 +2,22 @@ extends Window
|
|||
class_name DragonList
|
||||
|
||||
var _library: DragonLibrary
|
||||
var _dragons: Array[DragonListEntry]
|
||||
@export var dragon_list_entry_template: PackedScene
|
||||
@export var dragon_list_pivot: Node2D
|
||||
|
||||
@onready var dragger: DraggableWindow = $CanvasLayer/Dragger
|
||||
|
||||
@export var origin_name_label: Label
|
||||
@export var dragon_name_label: Label
|
||||
|
||||
@export var hat: AnimatedSprite2D
|
||||
@export var shirt: AnimatedSprite2D
|
||||
@export var decor: AnimatedSprite2D
|
||||
@export var dragon: AnimatedSprite2D
|
||||
|
||||
@export var hat_outfits: DragonOutfit
|
||||
@export var shirt_outfits: DragonOutfit
|
||||
@export var decor_outfits: DragonOutfit
|
||||
@export var dragon_colors: DragonOutfit
|
||||
var _index_showing: int = 0
|
||||
var _pivot_start_pos: Vector2
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
dragger.on_drag.connect(_on_drag)
|
||||
_pivot_start_pos = dragon_list_pivot.position
|
||||
|
||||
|
||||
func _on_drag(offset: Vector2i):
|
||||
|
@ -28,30 +26,65 @@ func _on_drag(offset: Vector2i):
|
|||
|
||||
func set_library(library: DragonLibrary):
|
||||
_library = library
|
||||
for i in len(_library.dragons):
|
||||
_instantiate_dragon(_library.dragons[i], i)
|
||||
|
||||
_play_idle_animations()
|
||||
_show_dragon(library.dragons[0])
|
||||
|
||||
|
||||
func _instantiate_dragon(dragon: DragonProperties, offset_step: int):
|
||||
var instance: DragonListEntry = dragon_list_entry_template.instantiate()
|
||||
dragon_list_pivot.add_child(instance)
|
||||
instance.position.x += offset_step * 110
|
||||
_dragons.push_back(instance)
|
||||
|
||||
|
||||
func _show_dragon(dragon: DragonProperties):
|
||||
hat.sprite_frames = hat_outfits.get_texture(dragon.hat)
|
||||
shirt.sprite_frames = shirt_outfits.get_texture(dragon.shirt)
|
||||
decor.sprite_frames = decor_outfits.get_texture(dragon.decor)
|
||||
self.dragon.sprite_frames = dragon_colors.get_texture(dragon.color)
|
||||
_restart_animations()
|
||||
|
||||
origin_name_label.text = dragon.origin
|
||||
dragon_name_label.text = dragon.name
|
||||
|
||||
|
||||
func _restart_animations():
|
||||
hat.set_frame(0)
|
||||
hat.play('idle')
|
||||
shirt.set_frame(0)
|
||||
shirt.play('idle')
|
||||
decor.set_frame(0)
|
||||
decor.play('idle')
|
||||
dragon.set_frame(0)
|
||||
dragon.play('idle')
|
||||
|
||||
|
||||
func _on_close_pressed() -> void:
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_dragon_previous_pressed() -> void:
|
||||
if _index_showing == 0:
|
||||
return
|
||||
_index_showing -= 1
|
||||
_move_to_position(-110 * _index_showing)
|
||||
_show_dragon(_library.dragons[_index_showing])
|
||||
|
||||
|
||||
func _on_dragon_next_pressed() -> void:
|
||||
if _index_showing == len(_library.dragons) - 1:
|
||||
return
|
||||
_index_showing += 1
|
||||
_move_to_position(-110 * _index_showing)
|
||||
_show_dragon(_library.dragons[_index_showing])
|
||||
|
||||
|
||||
func _move_to_position(target_position: int):
|
||||
var tween = create_tween()
|
||||
_play_walk_animations()
|
||||
var new_pos: Vector2 = _pivot_start_pos + Vector2(target_position, 0)
|
||||
_face_direction(new_pos.x < dragon_list_pivot.position.x)
|
||||
|
||||
tween.tween_property(dragon_list_pivot, "position", new_pos, 1.0).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
||||
tween.tween_callback(_play_idle_animations)
|
||||
|
||||
|
||||
func _play_idle_animations():
|
||||
for dragon in _dragons:
|
||||
dragon.play_animation('idle')
|
||||
|
||||
|
||||
func _play_walk_animations():
|
||||
for dragon in _dragons:
|
||||
dragon.play_animation('walk')
|
||||
|
||||
|
||||
func _face_direction(left: bool):
|
||||
for dragon in _dragons:
|
||||
dragon.face_direction(left)
|
||||
|
|
|
@ -6,6 +6,8 @@ extends Button
|
|||
|
||||
|
||||
func _on_pressed() -> void:
|
||||
if base._library.dragons.is_empty():
|
||||
return
|
||||
var list: DragonList = dragon_list.instantiate()
|
||||
list.set_library(base._library)
|
||||
|
||||
|
|
|
@ -6,10 +6,6 @@ var save_load: SaveLoad
|
|||
@onready var name_edit: LineEdit = $Name
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
|
||||
func set_save_load(save_load: SaveLoad) -> void:
|
||||
self.save_load = save_load
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://cdlipr8l1k38a"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://cdlipr8l1k38a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://drulv5ptupx2w" path="res://scenes/name_setter/name_setter.gd" id="1_f3gk5"]
|
||||
[ext_resource type="Texture2D" uid="uid://d27vpp71fe4de" path="res://assets/sprites/ui/DP_UI_CharList_Frame.png" id="2_wkl5f"]
|
||||
[ext_resource type="Texture2D" uid="uid://bgpbbkmwt8ysq" path="res://assets/sprites/ui/DP_UI_Button_Text.png" id="3_1ipfa"]
|
||||
[ext_resource type="FontFile" uid="uid://u1pey2ilx31c" path="res://assets/fonts/Montjuic.ttf" id="3_fjxtl"]
|
||||
[ext_resource type="Texture2D" uid="uid://bdrm1nxydvf5t" path="res://assets/sprites/ui/DP_UI_Label_Big.png" id="3_rlhj7"]
|
||||
[ext_resource type="StyleBox" uid="uid://bhe580k04w6ve" path="res://assets/styles/style_box_empty.tres" id="4_fjxtl"]
|
||||
|
||||
|
@ -13,7 +14,7 @@ region = Rect2(0, 0, 62, 24)
|
|||
[node name="NameSetter" type="Window"]
|
||||
transparent_bg = true
|
||||
position = Vector2i(0, 36)
|
||||
size = Vector2i(500, 250)
|
||||
size = Vector2i(700, 300)
|
||||
unresizable = true
|
||||
borderless = true
|
||||
always_on_top = true
|
||||
|
@ -23,13 +24,13 @@ script = ExtResource("1_f3gk5")
|
|||
[node name="Background" type="ColorRect" parent="."]
|
||||
offset_left = 4.0
|
||||
offset_top = 4.0
|
||||
offset_right = 496.0
|
||||
offset_bottom = 244.0
|
||||
offset_right = 697.0
|
||||
offset_bottom = 294.0
|
||||
color = Color(0.176471, 0.227451, 0.239216, 1)
|
||||
|
||||
[node name="Border" type="NinePatchRect" parent="."]
|
||||
offset_right = 500.0
|
||||
offset_bottom = 250.0
|
||||
offset_right = 700.0
|
||||
offset_bottom = 300.0
|
||||
texture = ExtResource("2_wkl5f")
|
||||
patch_margin_left = 32
|
||||
patch_margin_top = 32
|
||||
|
@ -38,9 +39,11 @@ patch_margin_bottom = 32
|
|||
|
||||
[node name="Instructions" type="Label" parent="."]
|
||||
offset_left = 6.0
|
||||
offset_top = 8.0
|
||||
offset_right = 494.0
|
||||
offset_bottom = 161.0
|
||||
offset_top = 12.0
|
||||
offset_right = 694.0
|
||||
offset_bottom = 223.0
|
||||
theme_override_fonts/font = ExtResource("3_fjxtl")
|
||||
theme_override_font_sizes/font_size = 28
|
||||
text = "En aquesta torreta, present a la cantonada del teu escriptori, hi viuran uns dracs que t’acompanyaran en el teu dia a dia. Fins i tot et vindran a visitar dracs d'altres torretes!
|
||||
|
||||
Per començar, posa un nom a la torreta.
|
||||
|
@ -49,19 +52,21 @@ horizontal_alignment = 1
|
|||
autowrap_mode = 2
|
||||
|
||||
[node name="NameLabelBG" type="NinePatchRect" parent="."]
|
||||
offset_left = 104.0
|
||||
offset_top = 167.0
|
||||
offset_right = 396.0
|
||||
offset_bottom = 215.0
|
||||
offset_left = 204.0
|
||||
offset_top = 214.0
|
||||
offset_right = 496.0
|
||||
offset_bottom = 262.0
|
||||
texture = ExtResource("3_rlhj7")
|
||||
patch_margin_left = 74
|
||||
patch_margin_right = 74
|
||||
|
||||
[node name="Name" type="LineEdit" parent="."]
|
||||
offset_left = 84.0
|
||||
offset_top = 167.0
|
||||
offset_right = 423.0
|
||||
offset_bottom = 215.0
|
||||
offset_left = 180.0
|
||||
offset_top = 214.0
|
||||
offset_right = 520.0
|
||||
offset_bottom = 262.0
|
||||
theme_override_fonts/font = ExtResource("3_fjxtl")
|
||||
theme_override_font_sizes/font_size = 28
|
||||
theme_override_styles/focus = ExtResource("4_fjxtl")
|
||||
placeholder_text = "Nom"
|
||||
alignment = 1
|
||||
|
@ -70,10 +75,10 @@ flat = true
|
|||
caret_blink = true
|
||||
|
||||
[node name="create" type="Button" parent="."]
|
||||
offset_left = 426.0
|
||||
offset_top = 212.0
|
||||
offset_right = 496.0
|
||||
offset_bottom = 244.0
|
||||
offset_left = 626.0
|
||||
offset_top = 262.0
|
||||
offset_right = 696.0
|
||||
offset_bottom = 294.0
|
||||
focus_mode = 0
|
||||
icon = SubResource("AtlasTexture_27shg")
|
||||
flat = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue