Client settings fix

This commit is contained in:
Rendo 2025-12-07 15:25:56 +05:00
commit 7aaa676f32
4 changed files with 27 additions and 34 deletions

View file

@ -21,6 +21,7 @@ PlayerGlobal="*res://scripts/player/player_global.gd"
Lobby="*res://scripts/multiplayer/lobby.gd" Lobby="*res://scripts/multiplayer/lobby.gd"
Session="*res://scripts/multiplayer/session.gd" Session="*res://scripts/multiplayer/session.gd"
ClientSettings="*res://scripts/client_settings.gd" ClientSettings="*res://scripts/client_settings.gd"
ClientSettingsMenu="res://scenes/gui/client_settings.tscn"
[display] [display]

View file

@ -2,29 +2,29 @@
[ext_resource type="Script" uid="uid://ddi1alk8oyi1b" path="res://scripts/gui/client_settings_menu.gd" id="1_xqyus"] [ext_resource type="Script" uid="uid://ddi1alk8oyi1b" path="res://scripts/gui/client_settings_menu.gd" id="1_xqyus"]
[node name="ClientSettings" type="PanelContainer"] [node name="ClientSettingsMenu" type="CanvasLayer"]
anchors_preset = 15
anchor_right = 1.0 [node name="PanelContainer" type="PanelContainer" parent="."]
anchor_bottom = 1.0 visible = false
grow_horizontal = 2 offset_right = 40.0
grow_vertical = 2 offset_bottom = 40.0
script = ExtResource("1_xqyus") script = ExtResource("1_xqyus")
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
layout_mode = 2 layout_mode = 2
[node name="FullscreenButton" type="CheckButton" parent="VBoxContainer"] [node name="FullscreenButton" type="CheckButton" parent="PanelContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
text = "Полный экран" text = "Полный экран"
[node name="Sensitivity" type="HBoxContainer" parent="VBoxContainer"] [node name="Sensitivity" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/Sensitivity"] [node name="Label" type="Label" parent="PanelContainer/VBoxContainer/Sensitivity"]
layout_mode = 2 layout_mode = 2
text = "Чувствительность" text = "Чувствительность"
[node name="HSlider" type="HSlider" parent="VBoxContainer/Sensitivity"] [node name="HSlider" type="HSlider" parent="PanelContainer/VBoxContainer/Sensitivity"]
custom_minimum_size = Vector2(256, 0) custom_minimum_size = Vector2(256, 0)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
@ -33,7 +33,7 @@ max_value = 0.1
step = 0.001 step = 0.001
value = 0.02 value = 0.02
[node name="SpinBox" type="SpinBox" parent="VBoxContainer/Sensitivity"] [node name="SpinBox" type="SpinBox" parent="PanelContainer/VBoxContainer/Sensitivity"]
layout_mode = 2 layout_mode = 2
max_value = 0.1 max_value = 0.1
step = 0.001 step = 0.001
@ -41,21 +41,21 @@ value = 0.02
allow_greater = true allow_greater = true
allow_lesser = true allow_lesser = true
[node name="GameplayMainAudio" type="HBoxContainer" parent="VBoxContainer"] [node name="GameplayMainAudio" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2 layout_mode = 2
[node name="Label" type="Label" parent="VBoxContainer/GameplayMainAudio"] [node name="Label" type="Label" parent="PanelContainer/VBoxContainer/GameplayMainAudio"]
layout_mode = 2 layout_mode = 2
text = "Геймплей" text = "Геймплей"
[node name="GameplayMainSlider" type="HSlider" parent="VBoxContainer/GameplayMainAudio"] [node name="GameplayMainSlider" type="HSlider" parent="PanelContainer/VBoxContainer/GameplayMainAudio"]
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
max_value = 1.0 max_value = 1.0
step = 0.01 step = 0.01
value = 1.0 value = 1.0
[connection signal="toggled" from="VBoxContainer/FullscreenButton" to="." method="_on_check_button_toggled"] [connection signal="toggled" from="PanelContainer/VBoxContainer/FullscreenButton" to="." method="_on_check_button_toggled"]
[connection signal="value_changed" from="VBoxContainer/Sensitivity/HSlider" to="." method="_on_h_slider_value_changed"] [connection signal="value_changed" from="PanelContainer/VBoxContainer/Sensitivity/HSlider" to="." method="_on_h_slider_value_changed"]
[connection signal="value_changed" from="VBoxContainer/Sensitivity/SpinBox" to="." method="_on_spin_box_value_changed"] [connection signal="value_changed" from="PanelContainer/VBoxContainer/Sensitivity/SpinBox" to="." method="_on_spin_box_value_changed"]
[connection signal="value_changed" from="VBoxContainer/GameplayMainAudio/GameplayMainSlider" to="." method="_on_gameplay_main_slider_value_changed"] [connection signal="value_changed" from="PanelContainer/VBoxContainer/GameplayMainAudio/GameplayMainSlider" to="." method="_on_gameplay_main_slider_value_changed"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=84 format=4 uid="uid://dpsr6ug3pkb40"] [gd_scene load_steps=83 format=4 uid="uid://dpsr6ug3pkb40"]
[ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"] [ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"]
[ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"] [ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"]
@ -23,7 +23,6 @@
[ext_resource type="Script" uid="uid://gan0amqbhi4i" path="res://scripts/gui/hud/player_ammo_display.gd" id="12_iortg"] [ext_resource type="Script" uid="uid://gan0amqbhi4i" path="res://scripts/gui/hud/player_ammo_display.gd" id="12_iortg"]
[ext_resource type="Script" uid="uid://bala54fa32e35" path="res://scripts/gui/hud/player_round_display.gd" id="13_x73hv"] [ext_resource type="Script" uid="uid://bala54fa32e35" path="res://scripts/gui/hud/player_round_display.gd" id="13_x73hv"]
[ext_resource type="Script" uid="uid://bos7nftlx8tv3" path="res://scripts/gui/hud/player_round_time.gd" id="13_xar7t"] [ext_resource type="Script" uid="uid://bos7nftlx8tv3" path="res://scripts/gui/hud/player_round_time.gd" id="13_xar7t"]
[ext_resource type="PackedScene" uid="uid://bv6ptrditssow" path="res://scenes/gui/client_settings.tscn" id="16_d267o"]
[ext_resource type="AudioStream" uid="uid://bd4iofirvmiu6" path="res://audio/step_wood.ogg" id="16_fbysy"] [ext_resource type="AudioStream" uid="uid://bd4iofirvmiu6" path="res://audio/step_wood.ogg" id="16_fbysy"]
[ext_resource type="Script" uid="uid://da0xv360va3b3" path="res://scripts/audio_system/multiplayer_audio_3d.gd" id="17_0cqlf"] [ext_resource type="Script" uid="uid://da0xv360va3b3" path="res://scripts/audio_system/multiplayer_audio_3d.gd" id="17_0cqlf"]
[ext_resource type="Script" uid="uid://xsgfbuyje35p" path="res://scripts/player/player_pickup.gd" id="17_fjvrb"] [ext_resource type="Script" uid="uid://xsgfbuyje35p" path="res://scripts/player/player_pickup.gd" id="17_fjvrb"]
@ -8717,18 +8716,6 @@ script = ExtResource("13_xar7t")
layout_mode = 2 layout_mode = 2
script = ExtResource("13_x73hv") script = ExtResource("13_x73hv")
[node name="CenterContainer" type="CenterContainer" parent="HUD"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ClientSettings" parent="HUD/CenterContainer" instance=ExtResource("16_d267o")]
visible = false
layout_mode = 2
[node name="PlayerPropertiesSync" type="MultiplayerSynchronizer" parent="."] [node name="PlayerPropertiesSync" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_qhqgy") replication_config = SubResource("SceneReplicationConfig_qhqgy")

View file

@ -1,5 +1,6 @@
extends Control extends Control
var cached_mouse_state: Input.MouseMode
func _on_check_button_toggled(toggled_on: bool) -> void: func _on_check_button_toggled(toggled_on: bool) -> void:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN if toggled_on else DisplayServer.WINDOW_MODE_WINDOWED) DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN if toggled_on else DisplayServer.WINDOW_MODE_WINDOWED)
@ -17,7 +18,11 @@ func _on_spin_box_value_changed(value: float) -> void:
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if event.is_action_pressed("menu_settings"): if event.is_action_pressed("menu_settings"):
visible = not visible visible = not visible
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if visible else Input.MOUSE_MODE_CAPTURED if visible:
cached_mouse_state = Input.mouse_mode
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
else:
Input.mouse_mode = cached_mouse_state
func _on_gameplay_main_slider_value_changed(value: float) -> void: func _on_gameplay_main_slider_value_changed(value: float) -> void: