DreamBall/menus/pause_menu.tscn

151 lines
4.2 KiB
Text
Raw Permalink Normal View History

[gd_scene load_steps=5 format=3 uid="uid://dkxtwpcy4moyo"]
[ext_resource type="Theme" uid="uid://c6ceauyc42c33" path="res://menus/menu.tres" id="1_s0u37"]
[sub_resource type="GDScript" id="GDScript_d8v8v"]
script/source = "extends Control
signal request_pause
signal request_restart
signal request_quit
var settings_menu_scene := preload(\"res://menus/settings_menu.tscn\")
func _ready() -> void:
var os_name = OS.get_name()
if os_name == \"Web\": ## you can't quit the game on web (you're stuck here forever :))
$VBoxContainer/Btn_Quit.hide()
func _input(_event: InputEvent) -> void:
if Input.is_action_just_pressed(\"pause_game\"):
request_pause.emit(!self.visible)
func _on_btn_resume_pressed() -> void:
request_pause.emit(false)
func _on_btn_restart_pressed() -> void:
request_restart.emit()
func _on_btn_settings_pressed() -> void:
var settings := settings_menu_scene.instantiate()
settings.connect(\"return_to_pause_menu\", exit_settings)
$SettingsContainer.add_child(settings)
$SettingsContainer.show()
func exit_settings() -> void:
$SettingsContainer.hide()
for child in $SettingsContainer.get_children():
child.queue_free()
func _on_btn_quit_pressed() -> void:
request_quit.emit()
"
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_s0u37"]
bg_color = Color(0.268015, 0.649122, 0.807649, 1)
skew = Vector2(-0.1, 0.05)
border_width_left = 5
border_width_top = 5
border_width_right = 5
border_width_bottom = 5
border_color = Color(1, 1, 1, 1)
corner_radius_top_left = 12
corner_radius_top_right = 12
corner_radius_bottom_right = 12
corner_radius_bottom_left = 12
expand_margin_left = 20.0
expand_margin_top = 8.0
expand_margin_right = 20.0
[sub_resource type="LabelSettings" id="LabelSettings_s0u37"]
font_size = 48
outline_size = 8
outline_color = Color(0, 0, 0, 1)
[node name="PauseMenu" type="Control"]
z_index = 2
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 1
theme = ExtResource("1_s0u37")
script = SubResource("GDScript_d8v8v")
[node name="ColorRect" type="ColorRect" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(1, 1, 0.666667, 0.0784314)
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -171.5
offset_top = -155.0
offset_right = 171.5
offset_bottom = 155.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 10
alignment = 1
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer"]
layout_mode = 2
theme_override_constants/margin_bottom = 40
[node name="Notice" type="Label" parent="VBoxContainer/MarginContainer"]
layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxFlat_s0u37")
text = "Paused!"
label_settings = SubResource("LabelSettings_s0u37")
horizontal_alignment = 1
vertical_alignment = 1
[node name="Btn_Resume" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 6
mouse_default_cursor_shape = 2
text = "Resume the game!"
[node name="Btn_Settings" type="Button" parent="VBoxContainer"]
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Show the settings menu!"
[node name="Btn_Restart" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 6
mouse_default_cursor_shape = 2
text = "Restart the level!"
[node name="Btn_Quit" type="Button" parent="VBoxContainer"]
layout_mode = 2
size_flags_vertical = 6
mouse_default_cursor_shape = 2
text = "Quit to the main menu!"
[node name="SettingsContainer" type="ColorRect" parent="."]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.20871, 0.20871, 0.20871, 0.784314)
[connection signal="pressed" from="VBoxContainer/Btn_Resume" to="." method="_on_btn_resume_pressed"]
[connection signal="pressed" from="VBoxContainer/Btn_Settings" to="." method="_on_btn_settings_pressed"]
[connection signal="pressed" from="VBoxContainer/Btn_Restart" to="." method="_on_btn_restart_pressed"]
[connection signal="pressed" from="VBoxContainer/Btn_Quit" to="." method="_on_btn_quit_pressed"]