diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/game.gd | 6 | ||||
-rw-r--r-- | client/global.gd | 3 | ||||
-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/game.gd | 2 | ||||
-rw-r--r-- | client/menu/lobby.gd | 16 | ||||
-rw-r--r-- | client/menu/lobby.tscn | 22 | ||||
-rw-r--r-- | client/menu/popup_message.gd | 10 | ||||
-rw-r--r-- | client/menu/popup_message.tscn | 5 | ||||
-rw-r--r-- | client/project.godot | 5 |
10 files changed, 99 insertions, 13 deletions
diff --git a/client/game.gd b/client/game.gd index c18f8d67..04aa7518 100644 --- a/client/game.gd +++ b/client/game.gd @@ -243,12 +243,18 @@ func _ready(): mp.set_ingame.connect( func toggle_lobby(_state: bool, lobby_state: bool): lobby.visible = lobby_state + if lobby_state and not join_sent: + join() ) func join(): join_sent = true mp.send_join(Global.get_profile("username"), Global.get_profile("character")) +func leave(): + join_sent = false + mp.send_leave() + func _process(delta): update_center() diff --git a/client/global.gd b/client/global.gd index b4d5a535..e3fe9000 100644 --- a/client/global.gd +++ b/client/global.gd @@ -32,7 +32,8 @@ var default_profile := { "has_interacted": false, "has_rotated": false, "has_reset": false, - "has_zoomed": false + "has_zoomed": false, + "has_seen_join_while_running": false } } var languages := [tr("System default"), "en", "de"] 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/game.gd b/client/menu/game.gd index 78c01c42..be501d2c 100644 --- a/client/menu/game.gd +++ b/client/menu/game.gd @@ -28,7 +28,7 @@ func _input(_event): if Input.is_action_just_pressed("ui_menu"): open_ingame_menu() -func _process(delta): +func _process(_delta): if Global.get_setting("debug_info"): debug_label.show() debug_label.text = "%d FPS" % Engine.get_frames_per_second() 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"] diff --git a/client/menu/popup_message.gd b/client/menu/popup_message.gd index 2d707289..82a16a9e 100644 --- a/client/menu/popup_message.gd +++ b/client/menu/popup_message.gd @@ -31,6 +31,7 @@ var is_joined := false @onready var auto_hint_timers: Node = $AutoHintTimers @onready var reset_timer = $Reset +@onready var join_while_running_timer = $JoinWhileRunning @onready var game: Game = $"../Game" @@ -57,6 +58,9 @@ func lobby(): func update_state(): if is_ingame and is_joined: start_game_hints() + elif is_ingame: + stop_game_hints() + join_while_running_timer.start() else: stop_game_hints() @@ -85,6 +89,7 @@ func stop_game_hints(): for c: Timer in auto_hint_timers.get_children(): c.stop() reset_timer.stop() + join_while_running_timer.stop() func _input(_event): if Input.is_action_just_pressed("boost"): @@ -144,3 +149,8 @@ func _on_nametags_timeout(): if not Global.get_hint("has_seen_nametags") and not Global.get_setting("usernames"): Global.set_hint("has_seen_nametags", true) display_hint_msg(tr("Username tags can be enabled/disabled in the settings")) + +func _on_join_while_running_timeout(): + if not game.is_joined and not Global.get_hint("has_seen_join_while_running"): + Global.set_hint("has_seen_join_while_running", true) + display_hint_msg(tr("Press %s and click \"Join\" to join the game while it is running") % display_keybind(tr("ESCAPE"), tr("Menu button"))) diff --git a/client/menu/popup_message.tscn b/client/menu/popup_message.tscn index b83d15a0..8a91f7c8 100644 --- a/client/menu/popup_message.tscn +++ b/client/menu/popup_message.tscn @@ -138,6 +138,10 @@ one_shot = true wait_time = 10.0 one_shot = true +[node name="JoinWhileRunning" type="Timer" parent="."] +wait_time = 5.0 +one_shot = true + [connection signal="timeout" from="ServerTimer" to="." method="_on_server_timer_timeout"] [connection signal="timeout" from="HintTimer" to="." method="_on_hint_timer_timeout"] [connection signal="timeout" from="AutoHintTimers/Move" to="." method="_on_move_timeout"] @@ -147,3 +151,4 @@ one_shot = true [connection signal="timeout" from="AutoHintTimers/Zoom" to="." method="_on_zoom_timeout"] [connection signal="timeout" from="AutoHintTimers/Nametags" to="." method="_on_nametags_timeout"] [connection signal="timeout" from="Reset" to="." method="_on_reset_timeout"] +[connection signal="timeout" from="JoinWhileRunning" to="." method="_on_join_while_running_timeout"] diff --git a/client/project.godot b/client/project.godot index 0c0613cc..3ff0fc0f 100644 --- a/client/project.godot +++ b/client/project.godot @@ -166,6 +166,11 @@ start_game={ "events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null) ] } +join_spectate={ +"deadzone": 0.5, +"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":true,"script":null) +] +} [internationalization] |