diff options
author | tpart <tpart120@proton.me> | 2024-07-15 13:08:59 +0200 |
---|---|---|
committer | tpart <tpart120@proton.me> | 2024-07-15 13:08:59 +0200 |
commit | d9ad661792297503fb0ea11f79ec153d8430f65b (patch) | |
tree | f352d6a16beb366027001bce3cf172b5518b90c0 /client/menu | |
parent | 7aef7f193dca90a5253944450196d2dd71fefed5 (diff) | |
download | hurrycurry-d9ad661792297503fb0ea11f79ec153d8430f65b.tar hurrycurry-d9ad661792297503fb0ea11f79ec153d8430f65b.tar.bz2 hurrycurry-d9ad661792297503fb0ea11f79ec153d8430f65b.tar.zst |
Add join/spectate button; Join by default
Diffstat (limited to 'client/menu')
-rw-r--r-- | client/menu/controller_buttons/y.svg | 6 | ||||
-rw-r--r-- | client/menu/controller_buttons/y.svg.import | 37 | ||||
-rw-r--r-- | client/menu/lobby.gd | 16 | ||||
-rw-r--r-- | client/menu/lobby.tscn | 22 |
4 files changed, 70 insertions, 11 deletions
diff --git a/client/menu/controller_buttons/y.svg b/client/menu/controller_buttons/y.svg new file mode 100644 index 00000000..a378078b --- /dev/null +++ b/client/menu/controller_buttons/y.svg @@ -0,0 +1,6 @@ +<svg width="64" height="64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <defs/> + <g> + <path stroke="none" fill="#FEB504" d="M56 32 Q56 42 48.95 48.95 42 56 32 56 22.05 56 15 48.95 8 42 8 32 8 22.05 15 15 22.05 8 32 8 42 8 48.95 15 56 22.05 56 32 M23 25 L30 32.9 30 42 34 42 34 32.9 41 25 41 24 38.75 22 37.65 22 32 28.55 26.4 22 25.25 22 23 24 23 25"/> + </g> +</svg>
\ No newline at end of file diff --git a/client/menu/controller_buttons/y.svg.import b/client/menu/controller_buttons/y.svg.import new file mode 100644 index 00000000..5fec3cf1 --- /dev/null +++ b/client/menu/controller_buttons/y.svg.import @@ -0,0 +1,37 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cr2a6ide6vnnv" +path="res://.godot/imported/y.svg-41b9f391c7719d6f019c38a3e4816a9f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://menu/controller_buttons/y.svg" +dest_files=["res://.godot/imported/y.svg-41b9f391c7719d6f019c38a3e4816a9f.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/lobby.gd b/client/menu/lobby.gd index 3c4a6f58..89f73473 100644 --- a/client/menu/lobby.gd +++ b/client/menu/lobby.gd @@ -34,7 +34,8 @@ var difficulty_names = [tr("Easy"), tr("Moderate"), tr("Hard"), tr("Very hard"), @onready var map_selector = $VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer @onready var prev_map = $VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Left @onready var next_map = $VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/Right -@onready var start_button = $VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer/ControllerButton +@onready var start_button = $VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer/Start +@onready var join_spectate = $VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer/JoinSpectate func _ready(): game.update_players.connect(update_players) @@ -78,12 +79,11 @@ func _input(_event): func _on_game_joined(): map_selector.show() - start_button.text = tr("Start Game") start_button.disabled = false func _on_game_left(): map_selector.hide() - start_button.text = tr("Join Game") + start_button.disabled = true func _on_left_pressed(): selected_map = (selected_map - 1) % map_count @@ -94,9 +94,13 @@ func _on_right_pressed(): select_map(selected_map) func _on_controller_button_pressed(): + if selected_map_name != null: + game.mp.send_chat("/start %s" % selected_map_name) + +func _on_join_spectate_pressed(): if game.is_joined: - if selected_map_name != null: - game.mp.send_chat("/start %s" % selected_map_name) + game.leave() + join_spectate.text = tr("Join game") elif not game.join_sent: - start_button.disabled = true game.join() + join_spectate.text = tr("Spectate") diff --git a/client/menu/lobby.tscn b/client/menu/lobby.tscn index 06b050d0..e2da5094 100644 --- a/client/menu/lobby.tscn +++ b/client/menu/lobby.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=12 format=3 uid="uid://bc50la65ntifb"] +[gd_scene load_steps=13 format=3 uid="uid://bc50la65ntifb"] [ext_resource type="Theme" uid="uid://b0qmvo504e457" path="res://menu/theme/theme.tres" id="1_u18ke"] [ext_resource type="Script" path="res://menu/lobby.gd" id="2_7657i"] @@ -10,6 +10,7 @@ [ext_resource type="PackedScene" uid="uid://b1f7bgn65j7b5" path="res://menu/controller_buttons/controller_button.tscn" id="7_t6mox"] [ext_resource type="FontFile" uid="uid://5ixo6b3bd3km" path="res://menu/theme/font-josefin-sans.woff2" id="8_cwbpa"] [ext_resource type="Texture2D" uid="uid://bsx6fo7mv2u6a" path="res://menu/controller_buttons/x.svg" id="9_q14bw"] +[ext_resource type="Texture2D" uid="uid://cr2a6ide6vnnv" path="res://menu/controller_buttons/y.svg" id="11_5uugf"] [sub_resource type="FontVariation" id="FontVariation_5xxr2"] base_font = ExtResource("8_cwbpa") @@ -125,17 +126,28 @@ texture_focused = ExtResource("6_tulu3") ignore_texture_size = true stretch_mode = 4 -[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer/Bottom/MarginContainer/VBoxContainer"] +[node name="CenterContainer" type="HBoxContainer" parent="VBoxContainer/Bottom/MarginContainer/VBoxContainer"] layout_mode = 2 +theme_override_constants/separation = 50 +alignment = 1 -[node name="ControllerButton" parent="VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer" instance=ExtResource("7_t6mox")] +[node name="Start" parent="VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer" instance=ExtResource("7_t6mox")] custom_minimum_size = Vector2(148, 0) layout_mode = 2 -text = "Join Game" +text = "Start game" expand_icon = true controller_texture = ExtResource("9_q14bw") press_action = "start_game" +[node name="JoinSpectate" parent="VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer" instance=ExtResource("7_t6mox")] +custom_minimum_size = Vector2(148, 0) +layout_mode = 2 +text = "Spectate" +expand_icon = true +controller_texture = ExtResource("11_5uugf") +press_action = "join_spectate" + [connection signal="pressed" from="VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/Left" to="." method="_on_left_pressed"] [connection signal="pressed" from="VBoxContainer/Bottom/MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer2/Right" to="." method="_on_right_pressed"] -[connection signal="pressed" from="VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer/ControllerButton" to="." method="_on_controller_button_pressed"] +[connection signal="pressed" from="VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer/Start" to="." method="_on_controller_button_pressed"] +[connection signal="pressed" from="VBoxContainer/Bottom/MarginContainer/VBoxContainer/CenterContainer/JoinSpectate" to="." method="_on_join_spectate_pressed"] |