Applied MenuSlider scene to mouse sensitivity slider

This commit is contained in:
Jan Heemstra 2021-09-11 20:21:06 +02:00
parent 75c6657730
commit aa29738472
4 changed files with 32 additions and 27 deletions

View file

@ -3,4 +3,4 @@ extends "res://Assets/UI/Menu.gd"
func on_mouse_sensitivity_set(sensitivity):
if GUI:
GUI.set_mouse_sensitivity(sensitivity)
GUI.set_setting("Sensitivity", sensitivity)
$MouseSensitivity.save_data()

View file

@ -1,38 +1,40 @@
[gd_scene load_steps=3 format=3 uid="uid://c6hqr4kqxt5rw"]
[gd_scene load_steps=4 format=3 uid="uid://c6hqr4kqxt5rw"]
[ext_resource type="PackedScene" path="res://Assets/UI/Menu.tscn" id="1"]
[ext_resource type="Script" path="res://Assets/UI/ControlsMenu.gd" id="2_wjgrv"]
[ext_resource type="PackedScene" uid="uid://bwqwic7ex6muv" path="res://Assets/UI/MenuSlider.tscn" id="3_tp8y1"]
[node name="ControlsMenu" instance=ExtResource( "1" )]
script = ExtResource( "2_wjgrv" )
[node name="MouseSensitivity" type="HBoxContainer" parent="." index="0"]
offset_right = 337.0
offset_bottom = 26.0
script = null
[node name="MouseSensitivity" parent="." index="0" instance=ExtResource( "3_tp8y1" )]
anchor_right = 0.0
anchor_bottom = 0.0
offset_right = 205.0
offset_bottom = 23.0
label = "Mouse sensitivity"
index = "Sensitivity"
[node name="Label" type="Label" parent="MouseSensitivity" index="0"]
offset_right = 133.0
offset_bottom = 26.0
text = "Mouse sensitivity"
[node name="Label" parent="MouseSensitivity" index="0"]
offset_top = 0.0
offset_right = 1.0
offset_bottom = 23.0
structured_text_bidi_override_options = []
script = null
[node name="Slider" type="HSlider" parent="MouseSensitivity" index="1"]
offset_left = 137.0
offset_right = 337.0
offset_bottom = 16.0
rect_min_size = Vector2(200, 0)
[node name="Slider" parent="MouseSensitivity" index="1"]
offset_left = 5.0
offset_right = 205.0
min_value = 0.1
max_value = 2.0
max_value = 1.5
step = 0.0
value = 0.1
value = 0.45
exp_edit = true
script = null
[node name="Back" parent="." index="1"]
offset_top = 30.0
offset_right = 337.0
offset_bottom = 59.0
offset_top = 27.0
offset_right = 205.0
offset_bottom = 56.0
[connection signal="value_changed" from="MouseSensitivity/Slider" to="." method="on_mouse_sensitivity_set"]
[connection signal="data_changed" from="MouseSensitivity" to="." method="on_mouse_sensitivity_set"]
[editable path="MouseSensitivity"]

View file

@ -2,7 +2,7 @@ extends "res://Assets/UI/MenuData.gd"
func set_data(_data):
super.set_data(_data)
self.value = _data
$Slider.value = _data
func on_label_changed():
$Label.text = label

View file

@ -12,15 +12,18 @@ __meta__ = {
[node name="Label" type="Label" parent="."]
offset_top = 288.0
offset_right = 1.0
offset_right = 510.0
offset_bottom = 311.0
size_flags_horizontal = 3
structured_text_bidi_override_options = []
script = null
[node name="Slider" type="HSlider" parent="."]
offset_left = 5.0
offset_right = 21.0
offset_left = 514.0
offset_right = 1024.0
offset_bottom = 16.0
rect_min_size = Vector2(200, 0)
size_flags_horizontal = 3
script = null
[connection signal="value_changed" from="Slider" to="." method="on_value_changed"]