reset settings button + saving window mode + saving settings in main menu
This commit is contained in:
@@ -11,12 +11,14 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/margin_left = 100
|
||||
theme_override_constants/margin_top = 100
|
||||
theme_override_constants/margin_right = 100
|
||||
theme_override_constants/margin_bottom = 100
|
||||
script = ExtResource("1_g86te")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=385220162]
|
||||
layout_mode = 2
|
||||
color = Color(0, 0, 0, 0)
|
||||
|
||||
[node name="ControlsWindow" parent="." unique_id=257725506 instance=ExtResource("1_mnd1d")]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(900, 0)
|
||||
@@ -33,8 +35,17 @@ size_flags_horizontal = 3
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 0
|
||||
|
||||
[node name="ControlsContainer" type="VBoxContainer" parent="ControlsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer" unique_id=167218094]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ControlsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer" unique_id=1490504458]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ControlsContainer" type="VBoxContainer" parent="ControlsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/VBoxContainer" unique_id=167218094]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Reset" type="Button" parent="ControlsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/VBoxContainer" unique_id=369586391]
|
||||
layout_mode = 2
|
||||
text = "RESET_CONTROLS"
|
||||
|
||||
[connection signal="pressed" from="ControlsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/VBoxContainer/Reset" to="." method="_on_reset_pressed"]
|
||||
|
||||
[editable path="ControlsWindow"]
|
||||
|
||||
@@ -11,7 +11,9 @@ func _ready():
|
||||
%ControlsWindow.closed.connect(
|
||||
func ():
|
||||
GameInfo.save_settings()
|
||||
hide()
|
||||
)
|
||||
hide()
|
||||
|
||||
func open_controls():
|
||||
create_input_list()
|
||||
@@ -20,6 +22,7 @@ func open_controls():
|
||||
|
||||
func close_controls():
|
||||
%ControlsWindow.close_window()
|
||||
hide()
|
||||
|
||||
func create_input_list():
|
||||
InputMap.load_from_project_settings()
|
||||
@@ -34,4 +37,8 @@ func create_input_list():
|
||||
|
||||
|
||||
func instantiate_input_group() -> InputGroup:
|
||||
return INPUT_GROUP_SCENE.instantiate() as InputGroup
|
||||
return INPUT_GROUP_SCENE.instantiate() as InputGroup
|
||||
|
||||
func _on_reset_pressed() -> void:
|
||||
GameInfo.settings_data.reset_controls()
|
||||
create_input_list()
|
||||
@@ -2,7 +2,7 @@
|
||||
extends Control
|
||||
class_name GuiSettings
|
||||
|
||||
@onready var settings : SettingsData = GameInfo.settings_data
|
||||
@onready var settings: SettingsData = GameInfo.settings_data
|
||||
|
||||
@export_tool_button("Open", "Callable") var open_action = open_settings
|
||||
@export_tool_button("Close", "Callable") var close_action = close_settings
|
||||
@@ -20,11 +20,30 @@ func _ready():
|
||||
%SettingsWindow.closed.connect(
|
||||
func():
|
||||
GameInfo.save_settings()
|
||||
hide()
|
||||
)
|
||||
|
||||
TwitchConnection.pseudo_gathered_updated.connect(
|
||||
func (_p):update_twitch_pseudo()
|
||||
func(_p): update_twitch_pseudo()
|
||||
)
|
||||
hide()
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if settings:
|
||||
var window_mode := DisplayServer.window_get_mode()
|
||||
if window_mode != settings.window_mode:
|
||||
settings.window_mode = window_mode
|
||||
GameInfo.save_settings()
|
||||
if window_mode == DisplayServer.WINDOW_MODE_WINDOWED:
|
||||
var window := get_tree().root.get_window()
|
||||
var changed := false
|
||||
if settings.window_size != window.size:
|
||||
settings.window_size = window.size
|
||||
changed = true
|
||||
if settings.window_pos != window.position:
|
||||
settings.window_pos = window.position
|
||||
changed = true
|
||||
if changed:
|
||||
GameInfo.save_settings()
|
||||
|
||||
func open_settings():
|
||||
setup_languages()
|
||||
@@ -40,6 +59,7 @@ func open_settings():
|
||||
func close_settings():
|
||||
GameInfo.save_settings()
|
||||
%SettingsWindow.close_window()
|
||||
hide()
|
||||
|
||||
func setup_languages():
|
||||
var optionButton := (%LanguageOptionButton as OptionButton)
|
||||
@@ -55,7 +75,7 @@ func setup_sound():
|
||||
%SFXSlider.value = settings.sfx_volume
|
||||
|
||||
func setup_video():
|
||||
%FullScreenCheckBox.button_pressed = settings.full_screen
|
||||
%FullScreenCheckBox.button_pressed = settings.window_mode == DisplayServer.WINDOW_MODE_FULLSCREEN
|
||||
%UiSizeSlider.value = settings.ui_size
|
||||
|
||||
func setup_controls():
|
||||
@@ -82,7 +102,7 @@ func _on_language_option_button_item_selected(index: int):
|
||||
|
||||
|
||||
func _on_full_screen_check_box_toggled(toggled_on: bool):
|
||||
settings.full_screen = toggled_on
|
||||
settings.window_mode = DisplayServer.WINDOW_MODE_FULLSCREEN if toggled_on else DisplayServer.WINDOW_MODE_WINDOWED
|
||||
|
||||
func _on_master_slider_drag_ended(_value_changed: bool) -> void:
|
||||
%MasterTestPlayer.play()
|
||||
@@ -122,3 +142,14 @@ func _on_twitch_channel_line_edit_editing_toggled(toggled_on: bool):
|
||||
|
||||
func _on_story_mode_difficulty_option_button_item_selected(index: int):
|
||||
settings.story_mode_difficulty = index
|
||||
|
||||
func _on_reset_pressed() -> void:
|
||||
settings.reset_settings()
|
||||
setup_languages()
|
||||
setup_sound()
|
||||
setup_video()
|
||||
setup_controls()
|
||||
setup_difficulty()
|
||||
setup_twitch()
|
||||
update_twitch_pseudo()
|
||||
GameInfo.save_settings()
|
||||
|
||||
@@ -25,15 +25,18 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/margin_left = 100
|
||||
theme_override_constants/margin_top = 100
|
||||
theme_override_constants/margin_right = 100
|
||||
theme_override_constants/margin_bottom = 100
|
||||
script = ExtResource("1_7t8mv")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="." unique_id=221228455]
|
||||
layout_mode = 2
|
||||
color = Color(0, 0, 0, 0)
|
||||
|
||||
[node name="SettingsWindow" parent="." unique_id=798514856 instance=ExtResource("1_gkn1k")]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(800, 0)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 1
|
||||
@@ -295,6 +298,14 @@ text = "PSEUDO_GATHERED "
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ResetTitle" parent="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent" unique_id=281140274 instance=ExtResource("3_rbiwc")]
|
||||
layout_mode = 2
|
||||
title = ""
|
||||
|
||||
[node name="Reset" type="Button" parent="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent" unique_id=1566401845]
|
||||
layout_mode = 2
|
||||
text = "RESET_SETTINGS"
|
||||
|
||||
[node name="MasterTestPlayer" type="AudioStreamPlayer" parent="." unique_id=1170520824]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("6_8f00b")
|
||||
@@ -327,5 +338,6 @@ bus = &"Sfx"
|
||||
[connection signal="toggled" from="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/GameSettings/AutoPickupCheckBox" to="." method="_on_auto_pickup_check_box_toggled"]
|
||||
[connection signal="toggled" from="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/GridContainer/TwitchActivationCheckBox" to="." method="_on_twitch_activation_check_box_toggled"]
|
||||
[connection signal="editing_toggled" from="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/GridContainer/TwitchChannelLineEdit" to="." method="_on_twitch_channel_line_edit_editing_toggled"]
|
||||
[connection signal="pressed" from="SettingsWindow/WindowContent/MarginContainer/ContentContainer/MarginContainer/SettingsContent/Reset" to="." method="_on_reset_pressed"]
|
||||
|
||||
[editable path="SettingsWindow"]
|
||||
|
||||
Reference in New Issue
Block a user