aboutsummaryrefslogtreecommitdiff
path: root/client/menu
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2024-06-25 23:36:17 +0200
committertpart <tpart120@proton.me>2024-06-25 23:36:17 +0200
commitb24e3fbd14a238dbdd880b4eda1709b7c60aabc9 (patch)
tree564206c5dc975f585b01b200a760d92f333287d5 /client/menu
parentd2bafe3a0b9d7ec6f92adededc635653a23506d6 (diff)
downloadhurrycurry-b24e3fbd14a238dbdd880b4eda1709b7c60aabc9.tar
hurrycurry-b24e3fbd14a238dbdd880b4eda1709b7c60aabc9.tar.bz2
hurrycurry-b24e3fbd14a238dbdd880b4eda1709b7c60aabc9.tar.zst
Make hairstyles selectable
Diffstat (limited to 'client/menu')
-rw-r--r--client/menu/arrow.svg1
-rw-r--r--client/menu/arrow.svg.import37
-rw-r--r--client/menu/back.svg.import37
-rw-r--r--client/menu/character_menu.gd15
-rw-r--r--client/menu/character_menu.tscn81
5 files changed, 145 insertions, 26 deletions
diff --git a/client/menu/arrow.svg b/client/menu/arrow.svg
new file mode 100644
index 00000000..bafc9e69
--- /dev/null
+++ b/client/menu/arrow.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70 100"><path stroke="white" stroke-width="10" fill="none" d="M20,20 L50,50 L 20,80" /></svg> \ No newline at end of file
diff --git a/client/menu/arrow.svg.import b/client/menu/arrow.svg.import
new file mode 100644
index 00000000..198224ad
--- /dev/null
+++ b/client/menu/arrow.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://35rd5gamtyqm"
+path="res://.godot/imported/arrow.svg-41f5cc1ac36d42c934f574d48bb6dcd0.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://menu/arrow.svg"
+dest_files=["res://.godot/imported/arrow.svg-41f5cc1ac36d42c934f574d48bb6dcd0.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/client/menu/back.svg.import b/client/menu/back.svg.import
new file mode 100644
index 00000000..c1d3f246
--- /dev/null
+++ b/client/menu/back.svg.import
@@ -0,0 +1,37 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://bho8snt36o47u"
+path="res://.godot/imported/back.svg-3e820259a1f002a01cdabc54e94ce8f4.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://menu/back.svg"
+dest_files=["res://.godot/imported/back.svg-3e820259a1f002a01cdabc54e94ce8f4.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
+svg/scale=1.0
+editor/scale_with_editor_scale=false
+editor/convert_colors_with_editor_theme=false
diff --git a/client/menu/character_menu.gd b/client/menu/character_menu.gd
index 836dc7c3..e63243e1 100644
--- a/client/menu/character_menu.gd
+++ b/client/menu/character_menu.gd
@@ -15,8 +15,13 @@
#
extends Control
+@onready var character: Character = $Character
+@onready var num_hairstyles := character.hairstyles.keys().size()
+
+var hairstyle := 0
+
func _ready():
- $top_panel/a/username.text = Global.username
+ $VBoxContainer/top_panel/a/username.text = Global.username
func _notification(what):
if what == NOTIFICATION_PREDELETE:
@@ -27,3 +32,11 @@ func _on_back_pressed():
func _on_username_text_changed(new_text):
Global.username = new_text
+
+func _on_character_back_pressed():
+ hairstyle = (hairstyle - 1) % num_hairstyles
+ character.select_hairstyle(hairstyle)
+
+func _on_character_forward_pressed():
+ hairstyle = (hairstyle + 1) % num_hairstyles
+ character.select_hairstyle(hairstyle)
diff --git a/client/menu/character_menu.tscn b/client/menu/character_menu.tscn
index 8c4d0d96..29c9c88f 100644
--- a/client/menu/character_menu.tscn
+++ b/client/menu/character_menu.tscn
@@ -1,9 +1,10 @@
-[gd_scene load_steps=6 format=3 uid="uid://1f7xpirm5d28"]
+[gd_scene load_steps=7 format=3 uid="uid://1f7xpirm5d28"]
[ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme.tres" id="1_ak2pw"]
[ext_resource type="Script" path="res://menu/character_menu.gd" id="1_brhd1"]
[ext_resource type="PackedScene" uid="uid://b3hhir2fvnunu" path="res://player/character/character.tscn" id="3_odq7n"]
[ext_resource type="PackedScene" uid="uid://bg2d78ycorcqk" path="res://menu/scene_transition.tscn" id="4_c0ocf"]
+[ext_resource type="Texture2D" uid="uid://35rd5gamtyqm" path="res://menu/arrow.svg" id="5_kvd7k"]
[sub_resource type="Environment" id="Environment_ex25y"]
background_mode = 1
@@ -28,16 +29,25 @@ transform = Transform3D(0.857401, 0, 0.514649, -0.15367, 0.954381, 0.256012, -0.
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.75, 1.75)
-[node name="guy" parent="." instance=ExtResource("3_odq7n")]
+[node name="Character" parent="." instance=ExtResource("3_odq7n")]
-[node name="top_panel" type="Panel" parent="."]
+[node name="SceneTransition" parent="." instance=ExtResource("4_c0ocf")]
+visible = false
+layout_mode = 1
+
+[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
-anchors_preset = 10
+anchors_preset = 15
anchor_right = 1.0
-offset_bottom = 113.0
+anchor_bottom = 1.0
grow_horizontal = 2
+grow_vertical = 2
-[node name="a" type="VBoxContainer" parent="top_panel"]
+[node name="top_panel" type="Panel" parent="VBoxContainer"]
+custom_minimum_size = Vector2(0, 100)
+layout_mode = 2
+
+[node name="a" type="VBoxContainer" parent="VBoxContainer/top_panel"]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
@@ -48,25 +58,48 @@ offset_right = 216.0
offset_bottom = 110.0
grow_horizontal = 2
-[node name="Label" type="Label" parent="top_panel/a"]
+[node name="Label" type="Label" parent="VBoxContainer/top_panel/a"]
layout_mode = 2
-text = "This Chef is called"
+text = "Username"
horizontal_alignment = 1
-[node name="username" type="LineEdit" parent="top_panel/a"]
+[node name="username" type="LineEdit" parent="VBoxContainer/top_panel/a"]
layout_mode = 2
-[node name="bottom_panel" type="Panel" parent="."]
-layout_mode = 1
-anchors_preset = 12
-anchor_top = 1.0
-anchor_right = 1.0
-anchor_bottom = 1.0
-offset_top = -61.0
-grow_horizontal = 2
-grow_vertical = 0
+[node name="Spacer" type="MarginContainer" parent="VBoxContainer"]
+layout_mode = 2
+size_flags_vertical = 3
+theme_override_constants/margin_left = 50
+theme_override_constants/margin_top = 50
+theme_override_constants/margin_right = 50
+theme_override_constants/margin_bottom = 50
+
+[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/Spacer"]
+layout_mode = 2
+alignment = 1
+
+[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Spacer/VBoxContainer"]
+layout_mode = 2
+alignment = 1
+
+[node name="Back" type="TextureButton" parent="VBoxContainer/Spacer/VBoxContainer/HBoxContainer"]
+layout_mode = 2
+texture_normal = ExtResource("5_kvd7k")
+flip_h = true
+
+[node name="Spacer" type="Control" parent="VBoxContainer/Spacer/VBoxContainer/HBoxContainer"]
+layout_mode = 2
+size_flags_horizontal = 3
-[node name="back" type="Button" parent="bottom_panel"]
+[node name="Forward" type="TextureButton" parent="VBoxContainer/Spacer/VBoxContainer/HBoxContainer"]
+layout_mode = 2
+texture_normal = ExtResource("5_kvd7k")
+
+[node name="bottom_panel" type="Panel" parent="VBoxContainer"]
+custom_minimum_size = Vector2(0, 75)
+layout_mode = 2
+
+[node name="back" type="Button" parent="VBoxContainer/bottom_panel"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
@@ -82,9 +115,7 @@ grow_vertical = 2
size_flags_vertical = 8
text = "Back"
-[node name="SceneTransition" parent="." instance=ExtResource("4_c0ocf")]
-visible = false
-layout_mode = 1
-
-[connection signal="text_changed" from="top_panel/a/username" to="." method="_on_username_text_changed"]
-[connection signal="pressed" from="bottom_panel/back" to="." method="_on_back_pressed"]
+[connection signal="text_changed" from="VBoxContainer/top_panel/a/username" to="." method="_on_username_text_changed"]
+[connection signal="pressed" from="VBoxContainer/Spacer/VBoxContainer/HBoxContainer/Back" to="." method="_on_character_back_pressed"]
+[connection signal="pressed" from="VBoxContainer/Spacer/VBoxContainer/HBoxContainer/Forward" to="." method="_on_character_forward_pressed"]
+[connection signal="pressed" from="VBoxContainer/bottom_panel/back" to="." method="_on_back_pressed"]