Settings in the pause menu now work
This commit is contained in:
parent
209d2fdea8
commit
979341cba2
8 changed files with 66 additions and 17 deletions
|
|
@ -504,6 +504,10 @@ text = "back"
|
||||||
[node name="PauseMenu" parent="UI/Control" instance=ExtResource("19_37s47")]
|
[node name="PauseMenu" parent="UI/Control" instance=ExtResource("19_37s47")]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
grow_horizontal = 1
|
||||||
|
grow_vertical = 1
|
||||||
|
|
||||||
[node name="ControlsBox" type="VBoxContainer" parent="UI/Control"]
|
[node name="ControlsBox" type="VBoxContainer" parent="UI/Control"]
|
||||||
modulate = Color(1, 1, 1, 0.53333336)
|
modulate = Color(1, 1, 1, 0.53333336)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
[gd_scene load_steps=33 format=3 uid="uid://by43ihcec8e8q"]
|
[gd_scene load_steps=34 format=3 uid="uid://by43ihcec8e8q"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://b2sw6ymaf4t0s" path="res://scripts/game_ground.gd" id="1_6ra5r"]
|
[ext_resource type="Script" uid="uid://b2sw6ymaf4t0s" path="res://scripts/game_ground.gd" id="1_6ra5r"]
|
||||||
[ext_resource type="Script" uid="uid://dowu512otgyyf" path="res://scripts/player_ground.gd" id="3_8gbjj"]
|
[ext_resource type="Script" uid="uid://dowu512otgyyf" path="res://scripts/player_ground.gd" id="3_8gbjj"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://cwidt34ehvre4" path="res://sounds/ui_select.mp3" id="3_26mqe"]
|
||||||
[ext_resource type="AudioStream" uid="uid://cdl70q0x28717" path="res://sounds/dialogue.mp3" id="3_rncil"]
|
[ext_resource type="AudioStream" uid="uid://cdl70q0x28717" path="res://sounds/dialogue.mp3" id="3_rncil"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c0cyhybh30ogt" path="res://textures/player-ground-sheet.png" id="4_2c1ag"]
|
[ext_resource type="Texture2D" uid="uid://c0cyhybh30ogt" path="res://textures/player-ground-sheet.png" id="4_2c1ag"]
|
||||||
[ext_resource type="Texture2D" uid="uid://csrlh1sbdroud" path="res://textures/pistol.png" id="5_8gbjj"]
|
[ext_resource type="Texture2D" uid="uid://csrlh1sbdroud" path="res://textures/pistol.png" id="5_8gbjj"]
|
||||||
|
|
@ -158,8 +159,13 @@ y_sort_enabled = true
|
||||||
script = ExtResource("1_6ra5r")
|
script = ExtResource("1_6ra5r")
|
||||||
|
|
||||||
[node name="Dialogue" type="AudioStreamPlayer" parent="."]
|
[node name="Dialogue" type="AudioStreamPlayer" parent="."]
|
||||||
|
process_mode = 3
|
||||||
stream = ExtResource("3_rncil")
|
stream = ExtResource("3_rncil")
|
||||||
|
|
||||||
|
[node name="UiSelect" type="AudioStreamPlayer" parent="."]
|
||||||
|
process_mode = 3
|
||||||
|
stream = ExtResource("3_26mqe")
|
||||||
|
|
||||||
[node name="PlayerGround" type="CharacterBody2D" parent="."]
|
[node name="PlayerGround" type="CharacterBody2D" parent="."]
|
||||||
position = Vector2(349, -58)
|
position = Vector2(349, -58)
|
||||||
script = ExtResource("3_8gbjj")
|
script = ExtResource("3_8gbjj")
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://b6bq2viqao61m"]
|
[gd_scene load_steps=9 format=3 uid="uid://b6bq2viqao61m"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dqiaioigmj5wb" path="res://scripts/pause_menu.gd" id="1_5d2l8"]
|
[ext_resource type="Script" uid="uid://dqiaioigmj5wb" path="res://scripts/pause_menu.gd" id="1_5d2l8"]
|
||||||
[ext_resource type="Theme" uid="uid://dtc7h6gpwpend" path="res://scenes/ui.tres" id="2_7l7mv"]
|
[ext_resource type="Theme" uid="uid://dtc7h6gpwpend" path="res://scenes/ui.tres" id="2_7l7mv"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://cwidt34ehvre4" path="res://sounds/ui_select.mp3" id="2_v4r4p"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://bff3l15ivkcyi" path="res://sounds/ui_back.mp3" id="3_1s2dm"]
|
||||||
[ext_resource type="Script" uid="uid://b2maxk5g6yb0i" path="res://addons/super_awesome_input_icons/classes/input_icon_texture_rect.gd" id="3_v4r4p"]
|
[ext_resource type="Script" uid="uid://b2maxk5g6yb0i" path="res://addons/super_awesome_input_icons/classes/input_icon_texture_rect.gd" id="3_v4r4p"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cy4nbqbm222os" path="res://scenes/settings.tscn" id="4_1s2dm"]
|
[ext_resource type="PackedScene" uid="uid://cy4nbqbm222os" path="res://scenes/settings.tscn" id="4_1s2dm"]
|
||||||
|
|
||||||
|
|
@ -26,6 +28,12 @@ grow_vertical = 2
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_264po")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_264po")
|
||||||
script = ExtResource("1_5d2l8")
|
script = ExtResource("1_5d2l8")
|
||||||
|
|
||||||
|
[node name="UiSelect" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("2_v4r4p")
|
||||||
|
|
||||||
|
[node name="UiBack" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("3_1s2dm")
|
||||||
|
|
||||||
[node name="Panel" type="PanelContainer" parent="."]
|
[node name="Panel" type="PanelContainer" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
|
|
@ -109,14 +117,9 @@ vertical_alignment = 1
|
||||||
|
|
||||||
[node name="Settings" parent="." instance=ExtResource("4_1s2dm")]
|
[node name="Settings" parent="." instance=ExtResource("4_1s2dm")]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 0
|
layout_mode = 1
|
||||||
anchors_preset = 0
|
offset_left = -322.0
|
||||||
anchor_left = 0.0
|
offset_right = 322.0
|
||||||
anchor_right = 0.0
|
|
||||||
anchor_bottom = 0.0
|
|
||||||
offset_left = 0.0
|
|
||||||
offset_right = 640.0
|
|
||||||
grow_horizontal = 1
|
|
||||||
grow_vertical = 1
|
|
||||||
|
|
||||||
[connection signal="pressed" from="Panel/Flow/Resume" to="." method="_on_resume_pressed"]
|
[connection signal="pressed" from="Panel/Flow/Resume" to="." method="_on_resume_pressed"]
|
||||||
|
[connection signal="pressed" from="Panel/Flow/Settings" to="." method="_on_settings_pressed"]
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
[gd_scene load_steps=8 format=3 uid="uid://cy4nbqbm222os"]
|
[gd_scene load_steps=10 format=3 uid="uid://cy4nbqbm222os"]
|
||||||
|
|
||||||
[ext_resource type="Theme" uid="uid://dtc7h6gpwpend" path="res://scenes/ui.tres" id="1_r6d6q"]
|
[ext_resource type="Theme" uid="uid://dtc7h6gpwpend" path="res://scenes/ui.tres" id="1_r6d6q"]
|
||||||
[ext_resource type="Script" uid="uid://b2maxk5g6yb0i" path="res://addons/super_awesome_input_icons/classes/input_icon_texture_rect.gd" id="2_6wm04"]
|
[ext_resource type="Script" uid="uid://b2maxk5g6yb0i" path="res://addons/super_awesome_input_icons/classes/input_icon_texture_rect.gd" id="2_6wm04"]
|
||||||
[ext_resource type="Script" uid="uid://jacd1qlw1q5p" path="res://scripts/settings.gd" id="2_f4mfi"]
|
[ext_resource type="Script" uid="uid://jacd1qlw1q5p" path="res://scripts/settings.gd" id="2_f4mfi"]
|
||||||
[ext_resource type="FontFile" uid="uid://donsvh2l775rb" path="res://fonts/Doto.ttf" id="3_f4mfi"]
|
[ext_resource type="FontFile" uid="uid://donsvh2l775rb" path="res://fonts/Doto.ttf" id="3_f4mfi"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://cwidt34ehvre4" path="res://sounds/ui_select.mp3" id="3_gis3k"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://bff3l15ivkcyi" path="res://sounds/ui_back.mp3" id="4_83j8s"]
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_1kice"]
|
[sub_resource type="LabelSettings" id="LabelSettings_1kice"]
|
||||||
font_size = 48
|
font_size = 48
|
||||||
|
|
@ -28,6 +30,14 @@ grow_vertical = 2
|
||||||
theme = ExtResource("1_r6d6q")
|
theme = ExtResource("1_r6d6q")
|
||||||
script = ExtResource("2_f4mfi")
|
script = ExtResource("2_f4mfi")
|
||||||
|
|
||||||
|
[node name="UiSelect" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("3_gis3k")
|
||||||
|
bus = &"Sound Effects"
|
||||||
|
|
||||||
|
[node name="UiBack" type="AudioStreamPlayer" parent="."]
|
||||||
|
stream = ExtResource("4_83j8s")
|
||||||
|
bus = &"Sound Effects"
|
||||||
|
|
||||||
[node name="Scroll" type="ScrollContainer" parent="."]
|
[node name="Scroll" type="ScrollContainer" parent="."]
|
||||||
custom_minimum_size = Vector2(640, 0)
|
custom_minimum_size = Vector2(640, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
@ -211,7 +221,7 @@ text = "Southpaw"
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "NO"
|
text = "NO"
|
||||||
|
|
||||||
[connection signal="pressed" from="Scroll/Flow/Back" to="." method="_on_back_pressed"]
|
[connection signal="button_up" from="Scroll/Flow/Back" to="." method="_on_back_pressed"]
|
||||||
[connection signal="value_changed" from="Scroll/Flow/Flow2/MasterVolume" to="." method="_on_master_volume_value_changed"]
|
[connection signal="value_changed" from="Scroll/Flow/Flow2/MasterVolume" to="." method="_on_master_volume_value_changed"]
|
||||||
[connection signal="value_changed" from="Scroll/Flow/Flow3/MusicVolume" to="." method="_on_music_volume_value_changed"]
|
[connection signal="value_changed" from="Scroll/Flow/Flow3/MusicVolume" to="." method="_on_music_volume_value_changed"]
|
||||||
[connection signal="value_changed" from="Scroll/Flow/Flow4/SFXVolume" to="." method="_on_sfx_volume_value_changed"]
|
[connection signal="value_changed" from="Scroll/Flow/Flow4/SFXVolume" to="." method="_on_sfx_volume_value_changed"]
|
||||||
|
|
|
||||||
|
|
@ -287,6 +287,8 @@ func _set_navpanel_menu(menu: String) -> void:
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed("pause"):
|
if event.is_action_pressed("pause"):
|
||||||
|
$UiSelect.play()
|
||||||
|
|
||||||
$UI/Control/PauseMenu.visible = true
|
$UI/Control/PauseMenu.visible = true
|
||||||
|
|
||||||
$UI/Control/PauseMenu/Panel/Flow/Resume.grab_focus()
|
$UI/Control/PauseMenu/Panel/Flow/Resume.grab_focus()
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,8 @@ func _input(event: InputEvent) -> void:
|
||||||
if event.is_action_released("dialogue_continue"):
|
if event.is_action_released("dialogue_continue"):
|
||||||
dialogue_continue.emit()
|
dialogue_continue.emit()
|
||||||
if event.is_action_pressed("pause"):
|
if event.is_action_pressed("pause"):
|
||||||
|
$UiSelect.play()
|
||||||
|
|
||||||
$UI/Control/PauseMenu.visible = true
|
$UI/Control/PauseMenu.visible = true
|
||||||
|
|
||||||
$UI/Control/PauseMenu/Panel/Flow/Resume.grab_focus()
|
$UI/Control/PauseMenu/Panel/Flow/Resume.grab_focus()
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ extends Panel
|
||||||
@onready var game = get_parent().get_parent().get_parent()
|
@onready var game = get_parent().get_parent().get_parent()
|
||||||
|
|
||||||
func _resume() -> void:
|
func _resume() -> void:
|
||||||
|
$UiBack.play()
|
||||||
|
|
||||||
while Input.is_action_pressed("pause"):
|
while Input.is_action_pressed("pause"):
|
||||||
await get_tree().create_timer(0).timeout
|
await get_tree().create_timer(0).timeout
|
||||||
|
|
||||||
|
|
@ -14,5 +16,25 @@ func _on_resume_pressed() -> void:
|
||||||
_resume()
|
_resume()
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
|
if event.is_action_pressed("pause"):
|
||||||
|
if $Settings.visible:
|
||||||
|
# This is probably no good!
|
||||||
|
$Settings._on_back_pressed()
|
||||||
|
|
||||||
|
$Settings.visible = false
|
||||||
|
$Panel/Flow/Resume.grab_focus()
|
||||||
|
elif visible:
|
||||||
|
_resume()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_settings_pressed() -> void:
|
||||||
if visible:
|
if visible:
|
||||||
if event.is_action_pressed("pause"): _resume()
|
$UiSelect.play()
|
||||||
|
$Settings.visible = true
|
||||||
|
$Settings/Scroll/Flow/Back.grab_focus()
|
||||||
|
|
||||||
|
func _on_settings_back_pressed() -> void:
|
||||||
|
if visible:
|
||||||
|
$UiBack.play()
|
||||||
|
$Settings.visible = false
|
||||||
|
$Panel/Flow/Resume.grab_focus()
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,19 @@ func _on_master_volume_value_changed(value: float) -> void:
|
||||||
global.settings.master_volume = value
|
global.settings.master_volume = value
|
||||||
$Scroll/Flow/Flow2/MasterVolume/Label.text = str(floori(value * 100)) + "%"
|
$Scroll/Flow/Flow2/MasterVolume/Label.text = str(floori(value * 100)) + "%"
|
||||||
AudioServer.set_bus_volume_linear(0, value)
|
AudioServer.set_bus_volume_linear(0, value)
|
||||||
|
$UiSelect.play()
|
||||||
|
|
||||||
func _on_music_volume_value_changed(value: float) -> void:
|
func _on_music_volume_value_changed(value: float) -> void:
|
||||||
global.settings.music_volume = value
|
global.settings.music_volume = value
|
||||||
$Scroll/Flow/Flow3/MusicVolume/Label.text = str(floori(value * 100)) + "%"
|
$Scroll/Flow/Flow3/MusicVolume/Label.text = str(floori(value * 100)) + "%"
|
||||||
AudioServer.set_bus_volume_linear(1, value)
|
AudioServer.set_bus_volume_linear(1, value)
|
||||||
|
$UiSelect.play()
|
||||||
|
|
||||||
func _on_sfx_volume_value_changed(value: float) -> void:
|
func _on_sfx_volume_value_changed(value: float) -> void:
|
||||||
global.settings.sfx_volume = value
|
global.settings.sfx_volume = value
|
||||||
$Scroll/Flow/Flow4/SFXVolume/Label.text = str(floori(value * 100)) + "%"
|
$Scroll/Flow/Flow4/SFXVolume/Label.text = str(floori(value * 100)) + "%"
|
||||||
AudioServer.set_bus_volume_linear(2, value)
|
AudioServer.set_bus_volume_linear(2, value)
|
||||||
|
$UiSelect.play()
|
||||||
|
|
||||||
func _on_back_pressed() -> void:
|
func _on_back_pressed() -> void:
|
||||||
global.save_settings()
|
global.save_settings()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue