Merge pull request 'Refactored the pause menu to make it more consistent.' (#12) from pause_menu_refactor into main
All checks were successful
Deploy Promiscuity Auth API / deploy (push) Successful in 49s
Deploy Promiscuity Character API / deploy (push) Successful in 48s
Deploy Promiscuity Crafting API / deploy (push) Successful in 49s
Deploy Promiscuity Inventory API / deploy (push) Successful in 48s
Deploy Promiscuity Locations API / deploy (push) Successful in 49s
Deploy Promiscuity Mail API / deploy (push) Successful in 48s
Deploy Promiscuity World API / deploy (push) Successful in 49s
k8s smoke test / test (push) Successful in 9s

Reviewed-on: #12
This commit is contained in:
null 2026-04-18 18:32:39 -05:00
commit 42750356b5
7 changed files with 112 additions and 88 deletions

View File

@ -4,7 +4,7 @@
[ext_resource type="PackedScene" uid="uid://bb6hj6l23043x" path="res://assets/models/human.blend" id="1_eg4yq"] [ext_resource type="PackedScene" uid="uid://bb6hj6l23043x" path="res://assets/models/human.blend" id="1_eg4yq"]
[ext_resource type="Script" uid="uid://bpxggc8nr6tf6" path="res://scenes/player.gd" id="1_muv8p"] [ext_resource type="Script" uid="uid://bpxggc8nr6tf6" path="res://scenes/player.gd" id="1_muv8p"]
[ext_resource type="PackedScene" uid="uid://c5of6aaxop1hl" path="res://scenes/block.tscn" id="2_tc7dm"] [ext_resource type="PackedScene" uid="uid://c5of6aaxop1hl" path="res://scenes/block.tscn" id="2_tc7dm"]
[ext_resource type="Script" uid="uid://b7fopt7sx74g8" path="res://scenes/Levels/menu.gd" id="3_tc7dm"] [ext_resource type="PackedScene" uid="uid://dp6jk0k3o4v1u" path="res://scenes/UI/pause_menu.tscn" id="3_pause_menu"]
[ext_resource type="PackedScene" path="res://scenes/Characters/repo_bot.tscn" id="4_repo"] [ext_resource type="PackedScene" path="res://scenes/Characters/repo_bot.tscn" id="4_repo"]
[ext_resource type="PackedScene" path="res://scenes/Vehicles/car.tscn" id="5_car"] [ext_resource type="PackedScene" path="res://scenes/Vehicles/car.tscn" id="5_car"]
[ext_resource type="PackedScene" uid="uid://bnqaqbgynoyys" path="res://assets/models/TestCharAnimated.glb" id="5_fi66n"] [ext_resource type="PackedScene" uid="uid://bnqaqbgynoyys" path="res://assets/models/TestCharAnimated.glb" id="5_fi66n"]
@ -533,46 +533,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.298158, -7.0724635)
[node name="Block2" parent="Starter Blocks" unique_id=620097644 instance=ExtResource("2_tc7dm")] [node name="Block2" parent="Starter Blocks" unique_id=620097644 instance=ExtResource("2_tc7dm")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.63255787, 2.596316, -6.980046) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.63255787, 2.596316, -6.980046)
[node name="Menu" type="CanvasLayer" parent="." unique_id=52198534] [node name="PauseMenu" parent="." instance=ExtResource("3_pause_menu")]
process_mode = 3
visible = false
script = ExtResource("3_tc7dm")
[node name="Control" type="Control" parent="Menu" unique_id=858911582]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="VBoxContainer" type="VBoxContainer" parent="Menu/Control" unique_id=1528156009]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -39.5
offset_top = -33.0
offset_right = 39.5
offset_bottom = 33.0
grow_horizontal = 2
grow_vertical = 2
[node name="ContinueButton" type="Button" parent="Menu/Control/VBoxContainer" unique_id=104091649]
layout_mode = 2
text = "Continue"
[node name="MainMenuButton" type="Button" parent="Menu/Control/VBoxContainer" unique_id=1778226284]
layout_mode = 2
text = "Main Menu"
[node name="QuitButton" type="Button" parent="Menu/Control/VBoxContainer" unique_id=922791982]
layout_mode = 2
text = "Quit"
[node name="PhoneUI" type="CanvasLayer" parent="." unique_id=1455569026] [node name="PhoneUI" type="CanvasLayer" parent="." unique_id=1455569026]
layer = 5 layer = 5
@ -633,8 +594,4 @@ lifetime = 0.9
process_material = SubResource("ParticleProcessMaterial_mwo3k") process_material = SubResource("ParticleProcessMaterial_mwo3k")
draw_pass_1 = SubResource("QuadMesh_j43p6") draw_pass_1 = SubResource("QuadMesh_j43p6")
[connection signal="pressed" from="Menu/Control/VBoxContainer/ContinueButton" to="Menu" method="_on_continue_button_pressed"]
[connection signal="pressed" from="Menu/Control/VBoxContainer/MainMenuButton" to="Menu" method="_on_main_menu_button_pressed"]
[connection signal="pressed" from="Menu/Control/VBoxContainer/QuitButton" to="Menu" method="_on_quit_button_pressed"]
[editable path="Player/TestCharAnimated"] [editable path="Player/TestCharAnimated"]

View File

@ -1 +0,0 @@
uid://b7fopt7sx74g8

View File

@ -4,6 +4,7 @@
[ext_resource type="Script" path="res://scenes/player.gd" id="2_player"] [ext_resource type="Script" path="res://scenes/player.gd" id="2_player"]
[ext_resource type="PackedScene" path="res://assets/models/TestCharAnimated.glb" id="3_model"] [ext_resource type="PackedScene" path="res://assets/models/TestCharAnimated.glb" id="3_model"]
[ext_resource type="Material" path="res://assets/materials/kenney_prototype_ground_green.tres" id="4_ground"] [ext_resource type="Material" path="res://assets/materials/kenney_prototype_ground_green.tres" id="4_ground"]
[ext_resource type="PackedScene" uid="uid://dp6jk0k3o4v1u" path="res://scenes/UI/pause_menu.tscn" id="5_pause_menu"]
[sub_resource type="SphereShape3D" id="SphereShape3D_player"] [sub_resource type="SphereShape3D" id="SphereShape3D_player"]
@ -52,3 +53,5 @@ spot_angle = 25.0
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.819152, 0.573576, 0, -0.573576, 0.819152, 0, 6, 0) transform = Transform3D(1, 0, 0, 0, 0.819152, 0.573576, 0, -0.573576, 0.819152, 0, 6, 0)
shadow_enabled = true shadow_enabled = true
[node name="PauseMenu" parent="." instance=ExtResource("5_pause_menu")]

View File

@ -5,6 +5,7 @@
[ext_resource type="PackedScene" path="res://assets/models/TestCharAnimated.glb" id="3_model"] [ext_resource type="PackedScene" path="res://assets/models/TestCharAnimated.glb" id="3_model"]
[ext_resource type="PackedScene" path="res://scenes/Interaction/prototype_gateway.tscn" id="4_teleporter"] [ext_resource type="PackedScene" path="res://scenes/Interaction/prototype_gateway.tscn" id="4_teleporter"]
[ext_resource type="Material" path="res://assets/materials/kenney_prototype_ground_green.tres" id="5_ground_mat"] [ext_resource type="Material" path="res://assets/materials/kenney_prototype_ground_green.tres" id="5_ground_mat"]
[ext_resource type="PackedScene" uid="uid://dp6jk0k3o4v1u" path="res://scenes/UI/pause_menu.tscn" id="6_pause_menu"]
[sub_resource type="SphereShape3D" id="SphereShape3D_player"] [sub_resource type="SphereShape3D" id="SphereShape3D_player"]
@ -58,3 +59,5 @@ shadow_enabled = true
[node name="ReturnTeleporter" parent="." instance=ExtResource("4_teleporter")] [node name="ReturnTeleporter" parent="." instance=ExtResource("4_teleporter")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.5, 0, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.5, 0, 0)
target_scene_path = "res://scenes/Levels/level.tscn" target_scene_path = "res://scenes/Levels/level.tscn"
[node name="PauseMenu" parent="." instance=ExtResource("6_pause_menu")]

View File

@ -1,54 +1,51 @@
extends CanvasLayer extends CanvasLayer
const START_SCREEN_SCENE := "res://scenes/UI/start_screen.tscn" const START_SCREEN_SCENE := "res://scenes/UI/start_screen.tscn"
@onready var pause_menu = $Control @onready var buttons_container = $CenterContainer/PanelContainer/MarginContainer/VBoxContainer
func _ready() -> void: func _ready() -> void:
_register_focus_sounds() _register_focus_sounds()
func _input(event): func _input(event):
if event.is_action_pressed("ui_cancel"): if event.is_action_pressed("ui_cancel"):
if get_tree().paused: if get_tree().paused:
resume_game() resume_game()
else: else:
pause_game() pause_game()
func pause_game(): func pause_game():
get_tree().paused = true get_tree().paused = true
visible = true visible = true
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
func resume_game(): func resume_game():
get_tree().paused = false get_tree().paused = false
visible = false visible = false
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _on_quit_button_pressed(): func _on_quit_button_pressed():
get_tree().quit() get_tree().quit()
func _on_continue_button_pressed(): func _on_continue_button_pressed():
resume_game() resume_game()
func _on_main_menu_button_pressed(): func _on_main_menu_button_pressed():
resume_game() resume_game()
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
get_tree().change_scene_to_file(START_SCREEN_SCENE) get_tree().change_scene_to_file(START_SCREEN_SCENE)
func _register_focus_sounds() -> void: func _register_focus_sounds() -> void:
if pause_menu == null: if buttons_container == null:
return return
var vbox := pause_menu.get_node_or_null("VBoxContainer") for child in buttons_container.get_children():
if vbox == null: if child is BaseButton:
return var button: BaseButton = child
for child in vbox.get_children(): if not button.is_connected("focus_entered", Callable(self, "_on_menu_item_focus")):
if child is BaseButton: button.focus_entered.connect(_on_menu_item_focus)
var button: BaseButton = child if not button.is_connected("mouse_entered", Callable(self, "_on_menu_item_focus")):
if not button.is_connected("focus_entered", Callable(self, "_on_menu_item_focus")): button.mouse_entered.connect(_on_menu_item_focus)
button.focus_entered.connect(_on_menu_item_focus)
if not button.is_connected("mouse_entered", Callable(self, "_on_menu_item_focus")): func _on_menu_item_focus() -> void:
button.mouse_entered.connect(_on_menu_item_focus) if MenuSfx:
MenuSfx.play_hover()
func _on_menu_item_focus() -> void:
if MenuSfx:
MenuSfx.play_hover()

View File

@ -0,0 +1 @@
uid://ckh861smjghqc

View File

@ -0,0 +1,64 @@
[gd_scene format=3 uid="uid://dp6jk0k3o4v1u"]
[ext_resource type="Script" path="res://scenes/UI/pause_menu.gd" id="1_script"]
[ext_resource type="Theme" uid="uid://wpxmub0n2dr3" path="res://themes/button_theme.tres" id="2_theme"]
[node name="PauseMenu" type="CanvasLayer"]
process_mode = 3
visible = false
script = ExtResource("1_script")
[node name="Overlay" type="ColorRect" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 0.45098)
[node name="CenterContainer" type="CenterContainer" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="PanelContainer" type="PanelContainer" parent="CenterContainer"]
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/PanelContainer"]
layout_mode = 2
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 20
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/PanelContainer/MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="TitleLabel" type="Label" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 24
text = "Paused"
horizontal_alignment = 1
[node name="ContinueButton" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme = ExtResource("2_theme")
text = "Continue"
[node name="MainMenuButton" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme = ExtResource("2_theme")
text = "Main Menu"
[node name="QuitButton" type="Button" parent="CenterContainer/PanelContainer/MarginContainer/VBoxContainer"]
layout_mode = 2
theme = ExtResource("2_theme")
text = "Quit"
[connection signal="pressed" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/ContinueButton" to="." method="_on_continue_button_pressed"]
[connection signal="pressed" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/MainMenuButton" to="." method="_on_main_menu_button_pressed"]
[connection signal="pressed" from="CenterContainer/PanelContainer/MarginContainer/VBoxContainer/QuitButton" to="." method="_on_quit_button_pressed"]