Global refactor
This commit is contained in:
parent
3868af29e3
commit
0589ca4e23
180 changed files with 249 additions and 401 deletions
7
gui/client_settings/client_settings.gd
Normal file
7
gui/client_settings/client_settings.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Node
|
||||
|
||||
|
||||
var SENSITIVITY: float = 0.004
|
||||
var TOGGLE_CROUCH: bool = false
|
||||
var TOGGLE_SCOPE: bool = false
|
||||
var TOGGLE_WALK: bool = false
|
||||
1
gui/client_settings/client_settings.gd.uid
Normal file
1
gui/client_settings/client_settings.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://d3trljsb8awmr
|
||||
86
gui/client_settings/client_settings.tscn
Normal file
86
gui/client_settings/client_settings.tscn
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://bv6ptrditssow"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ddi1alk8oyi1b" path="res://gui/client_settings/client_settings_menu.gd" id="1_xqyus"]
|
||||
|
||||
[node name="ClientSettingsMenu" type="CanvasLayer"]
|
||||
layer = 3
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="CenterContainer"]
|
||||
layout_mode = 2
|
||||
script = ExtResource("1_xqyus")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/PanelContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="FullscreenButton" type="CheckButton" parent="CenterContainer/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Полный экран"
|
||||
|
||||
[node name="Sensitivity" type="HBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="CenterContainer/PanelContainer/VBoxContainer/Sensitivity"]
|
||||
layout_mode = 2
|
||||
text = "Чувствительность"
|
||||
|
||||
[node name="SensitivitySlider" type="HSlider" parent="CenterContainer/PanelContainer/VBoxContainer/Sensitivity"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(256, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
min_value = 0.001
|
||||
max_value = 0.02
|
||||
step = 0.001
|
||||
value = 0.001
|
||||
|
||||
[node name="SensitivityBox" type="SpinBox" parent="CenterContainer/PanelContainer/VBoxContainer/Sensitivity"]
|
||||
unique_name_in_owner = true
|
||||
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="CenterContainer/PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="CenterContainer/PanelContainer/VBoxContainer/GameplayMainAudio"]
|
||||
layout_mode = 2
|
||||
text = "Геймплейные звуки"
|
||||
|
||||
[node name="GameplayMainSlider" type="HSlider" parent="CenterContainer/PanelContainer/VBoxContainer/GameplayMainAudio"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 1.0
|
||||
|
||||
[node name="LeaveButton" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Покинуть сессию"
|
||||
|
||||
[node name="StopSession" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Окончить сессию"
|
||||
|
||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/FullscreenButton" to="CenterContainer/PanelContainer" method="_on_fullscreen_button_pressed"]
|
||||
[connection signal="toggled" from="CenterContainer/PanelContainer/VBoxContainer/FullscreenButton" to="CenterContainer/PanelContainer" method="_on_fullscreen_button_toggled"]
|
||||
[connection signal="value_changed" from="CenterContainer/PanelContainer/VBoxContainer/Sensitivity/SensitivitySlider" to="CenterContainer/PanelContainer" method="_on_sensitivity_slider_value_changed"]
|
||||
[connection signal="value_changed" from="CenterContainer/PanelContainer/VBoxContainer/Sensitivity/SensitivityBox" to="CenterContainer/PanelContainer" method="_on_sensitivity_box_value_changed"]
|
||||
[connection signal="value_changed" from="CenterContainer/PanelContainer/VBoxContainer/GameplayMainAudio/GameplayMainSlider" to="CenterContainer/PanelContainer" method="_on_gameplay_main_slider_value_changed"]
|
||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/LeaveButton" to="CenterContainer/PanelContainer" method="_on_leave_button_pressed"]
|
||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/StopSession" to="CenterContainer/PanelContainer" method="_on_stop_session_pressed"]
|
||||
43
gui/client_settings/client_settings_menu.gd
Normal file
43
gui/client_settings/client_settings_menu.gd
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
extends Control
|
||||
|
||||
func _ready() -> void:
|
||||
hide()
|
||||
Session.session_started.connect(%LeaveButton.show)
|
||||
Session.session_ended.connect(%LeaveButton.hide)
|
||||
Lobby.lobby_created.connect(%StopSession.show)
|
||||
Lobby.lobby_closed.connect(%StopSession.hide)
|
||||
%SensitivitySlider.set_value_no_signal(ClientSettings.SENSITIVITY)
|
||||
%SensitivityBox.set_value_no_signal(ClientSettings.SENSITIVITY)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("menu_settings"):
|
||||
visible = not visible
|
||||
if visible:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
else:
|
||||
if Session.session_started_flag:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
else:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
|
||||
|
||||
func _on_gameplay_main_slider_value_changed(value: float) -> void:
|
||||
AudioServer.set_bus_volume_linear(1,value)
|
||||
|
||||
func _on_fullscreen_button_toggled(toggled_on: bool) -> void:
|
||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN if toggled_on else DisplayServer.WINDOW_MODE_WINDOWED)
|
||||
|
||||
func _on_sensitivity_slider_value_changed(value: float) -> void:
|
||||
%SensitivityBox.set_value_no_signal(value)
|
||||
ClientSettings.SENSITIVITY = value
|
||||
|
||||
func _on_sensitivity_box_value_changed(value: float) -> void:
|
||||
%SensitivitySlider.set_value_no_signal(value)
|
||||
ClientSettings.SENSITIVITY = value
|
||||
|
||||
func _on_leave_button_pressed() -> void:
|
||||
Session.quit_session()
|
||||
|
||||
func _on_stop_session_pressed() -> void:
|
||||
if multiplayer.is_server():
|
||||
Session.end_session()
|
||||
1
gui/client_settings/client_settings_menu.gd.uid
Normal file
1
gui/client_settings/client_settings_menu.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ddi1alk8oyi1b
|
||||
Loading…
Add table
Add a link
Reference in a new issue