Player settings
This commit is contained in:
parent
de2736c701
commit
e8127ee423
8 changed files with 109 additions and 5 deletions
|
|
@ -149,6 +149,11 @@ spc_down={
|
|||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194326,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
menu_settings={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
|
|
|||
61
scenes/gui/client_settings.tscn
Normal file
61
scenes/gui/client_settings.tscn
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://bv6ptrditssow"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ddi1alk8oyi1b" path="res://scripts/gui/client_settings_menu.gd" id="1_xqyus"]
|
||||
|
||||
[node name="ClientSettings" type="PanelContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_xqyus")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="FullscreenButton" type="CheckButton" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Полный экран"
|
||||
|
||||
[node name="Sensitivity" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/Sensitivity"]
|
||||
layout_mode = 2
|
||||
text = "Чувствительность"
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="VBoxContainer/Sensitivity"]
|
||||
custom_minimum_size = Vector2(256, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
min_value = 0.001
|
||||
max_value = 0.1
|
||||
step = 0.001
|
||||
value = 0.02
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="VBoxContainer/Sensitivity"]
|
||||
layout_mode = 2
|
||||
max_value = 0.1
|
||||
step = 0.001
|
||||
value = 0.02
|
||||
allow_greater = true
|
||||
allow_lesser = true
|
||||
|
||||
[node name="GameplayMainAudio" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/GameplayMainAudio"]
|
||||
layout_mode = 2
|
||||
text = "Геймплей"
|
||||
|
||||
[node name="GameplayMainSlider" type="HSlider" parent="VBoxContainer/GameplayMainAudio"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 1.0
|
||||
|
||||
[connection signal="toggled" from="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="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"]
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=71 format=4 uid="uid://dpsr6ug3pkb40"]
|
||||
[gd_scene load_steps=72 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://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"]
|
||||
|
|
@ -21,6 +21,7 @@
|
|||
[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://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="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"]
|
||||
|
|
@ -6888,13 +6889,25 @@ script = ExtResource("13_xar7t")
|
|||
layout_mode = 2
|
||||
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="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_qhqgy")
|
||||
|
||||
[node name="StepAudio" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = ExtResource("16_fbysy")
|
||||
attenuation_model = 1
|
||||
volume_db = -25.0
|
||||
volume_db = -30.0
|
||||
max_distance = 50.0
|
||||
max_polyphony = 10
|
||||
bus = &"GameplayMain"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
extends Node
|
||||
|
||||
|
||||
var SENSITIVITY: float
|
||||
var SENSITIVITY: float = 0.02
|
||||
|
|
|
|||
24
scripts/gui/client_settings_menu.gd
Normal file
24
scripts/gui/client_settings_menu.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extends Control
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
func _on_h_slider_value_changed(value: float) -> void:
|
||||
$VBoxContainer/Sensitivity/SpinBox.set_value_no_signal(value)
|
||||
ClientSettings.SENSITIVITY = value
|
||||
|
||||
|
||||
func _on_spin_box_value_changed(value: float) -> void:
|
||||
$VBoxContainer/Sensitivity/HSlider.set_value_no_signal(value)
|
||||
ClientSettings.SENSITIVITY = value
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("menu_settings"):
|
||||
visible = not visible
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if visible else Input.MOUSE_MODE_CAPTURED
|
||||
|
||||
|
||||
func _on_gameplay_main_slider_value_changed(value: float) -> void:
|
||||
AudioServer.set_bus_volume_linear(1,value)
|
||||
1
scripts/gui/client_settings_menu.gd.uid
Normal file
1
scripts/gui/client_settings_menu.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ddi1alk8oyi1b
|
||||
|
|
@ -29,7 +29,7 @@ func _process(delta: float) -> void:
|
|||
func _input(event: InputEvent) -> void:
|
||||
if not is_multiplayer_authority() or disabled:
|
||||
return
|
||||
if event is InputEventMouseMotion:
|
||||
if Input.mouse_mode == Input.MouseMode.MOUSE_MODE_CAPTURED and event is InputEventMouseMotion:
|
||||
rotate_camera(-event.relative.x * ClientSettings.SENSITIVITY,-event.relative.y * ClientSettings.SENSITIVITY)
|
||||
|
||||
func rotate_camera(x,y) -> void:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ func exit() -> void:
|
|||
pass
|
||||
|
||||
func state_input(event: InputEvent) -> void:
|
||||
if not machine.is_multiplayer_authority(): return
|
||||
if not machine.is_multiplayer_authority() or Input.mouse_mode != Input.MouseMode.MOUSE_MODE_CAPTURED: return
|
||||
|
||||
if event.is_action_pressed("plr_reload"):
|
||||
init_reload.rpc()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue