Lots of little tweaks and fixes
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
class_name SettingsMenu extends Control
|
||||
|
||||
const TEXT_SPEED_VALUES:Array[float] = [0.2, 1.0, 2.0]
|
||||
|
||||
@export var tabs:TabBar
|
||||
@export var tabControls:Array[Control]
|
||||
@export var checkInvertX:CheckBox
|
||||
@export var checkInvertY:CheckBox
|
||||
@export var sliderControllerSpeed:HSlider
|
||||
@export var sliderMouseSpeed:HSlider
|
||||
@export var optionTextSpeed:OptionButton
|
||||
|
||||
func _ready() -> void:
|
||||
tabs.tab_changed.connect(onTabChanged)
|
||||
@@ -17,8 +20,16 @@ func _ready() -> void:
|
||||
sliderMouseSpeed.value = SETTINGS.cameraSpeedMouse
|
||||
sliderControllerSpeed.value_changed.connect(func(v:float): SETTINGS.cameraSpeedController = v)
|
||||
sliderMouseSpeed.value_changed.connect(func(v:float): SETTINGS.cameraSpeedMouse = v)
|
||||
optionTextSpeed.select(_textSpeedToIndex(SETTINGS.textSpeed))
|
||||
optionTextSpeed.item_selected.connect(func(idx:int): SETTINGS.textSpeed = TEXT_SPEED_VALUES[idx])
|
||||
onTabChanged(tabs.current_tab)
|
||||
|
||||
func _textSpeedToIndex(speed:float) -> int:
|
||||
match speed:
|
||||
0.2: return 0
|
||||
2.0: return 2
|
||||
_: return 1
|
||||
|
||||
func _notification(what:int) -> void:
|
||||
if what == NOTIFICATION_VISIBILITY_CHANGED and visible:
|
||||
tabs.grab_focus()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://efmr0xkbw1py" path="res://ui/settings/SettingsMenu.gd" id="1_4lnig"]
|
||||
|
||||
[node name="SettingsMenu" type="Control" node_paths=PackedStringArray("tabs", "tabControls", "checkInvertX", "checkInvertY", "sliderControllerSpeed", "sliderMouseSpeed")]
|
||||
[node name="SettingsMenu" type="Control" node_paths=PackedStringArray("tabs", "tabControls", "checkInvertX", "checkInvertY", "sliderControllerSpeed", "sliderMouseSpeed", "optionTextSpeed")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -11,11 +11,12 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_4lnig")
|
||||
tabs = NodePath("VBoxContainer/TabBar")
|
||||
tabControls = [NodePath("VBoxContainer/ScrollContainer/LabelGameplay"), NodePath("VBoxContainer/ScrollContainer/LabelSound"), NodePath("VBoxContainer/ScrollContainer/LabelGraphics"), NodePath("VBoxContainer/ScrollContainer/PanelControls")]
|
||||
tabControls = [NodePath("VBoxContainer/ScrollContainer/PanelGameplay"), NodePath("VBoxContainer/ScrollContainer/LabelSound"), NodePath("VBoxContainer/ScrollContainer/LabelGraphics"), NodePath("VBoxContainer/ScrollContainer/PanelControls")]
|
||||
checkInvertX = NodePath("VBoxContainer/ScrollContainer/PanelControls/CheckInvertX")
|
||||
checkInvertY = NodePath("VBoxContainer/ScrollContainer/PanelControls/CheckInvertY")
|
||||
sliderControllerSpeed = NodePath("VBoxContainer/ScrollContainer/PanelControls/SliderControllerSpeed")
|
||||
sliderMouseSpeed = NodePath("VBoxContainer/ScrollContainer/PanelControls/SliderMouseSpeed")
|
||||
optionTextSpeed = NodePath("VBoxContainer/ScrollContainer/PanelGameplay/OptionTextSpeed")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
@@ -48,10 +49,24 @@ visible = false
|
||||
layout_mode = 2
|
||||
text = "Sound"
|
||||
|
||||
[node name="LabelGameplay" type="Label" parent="VBoxContainer/ScrollContainer"]
|
||||
[node name="PanelGameplay" type="VBoxContainer" parent="VBoxContainer/ScrollContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
text = "Gameplay"
|
||||
|
||||
[node name="LabelTextSpeed" type="Label" parent="VBoxContainer/ScrollContainer/PanelGameplay"]
|
||||
layout_mode = 2
|
||||
text = "Text Speed"
|
||||
|
||||
[node name="OptionTextSpeed" type="OptionButton" parent="VBoxContainer/ScrollContainer/PanelGameplay"]
|
||||
layout_mode = 2
|
||||
focus_mode = 2
|
||||
item_count = 3
|
||||
item_0/text = "Slow"
|
||||
item_0/id = 0
|
||||
item_1/text = "Normal"
|
||||
item_1/id = 1
|
||||
item_2/text = "Fast"
|
||||
item_2/id = 2
|
||||
|
||||
[node name="PanelControls" type="VBoxContainer" parent="VBoxContainer/ScrollContainer"]
|
||||
visible = false
|
||||
|
||||
Reference in New Issue
Block a user