more work on the ui theme and changing the hud
This commit is contained in:
54
UI/Menus/OptionsMenu/audio_options.gd
Normal file
54
UI/Menus/OptionsMenu/audio_options.gd
Normal file
@@ -0,0 +1,54 @@
|
||||
class_name AudioOptionsMenu
|
||||
extends VBoxContainer
|
||||
|
||||
@export var master_input: SpinBox
|
||||
@export var master_slider: HSlider
|
||||
@export var music_input: SpinBox
|
||||
@export var music_slider: HSlider
|
||||
@export var sfx_input: SpinBox
|
||||
@export var sfx_slider: HSlider
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
master_input.value = Data.audio.master
|
||||
master_slider.value = Data.audio.master
|
||||
music_input.value = Data.audio.music
|
||||
music_slider.value = Data.audio.music
|
||||
sfx_input.value = Data.audio.sfx
|
||||
sfx_slider.value = Data.audio.sfx
|
||||
|
||||
|
||||
func _on_master_spin_box_value_changed(value: float) -> void:
|
||||
master_slider.value = value
|
||||
Data.audio.master = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_master_h_slider_value_changed(value: float) -> void:
|
||||
master_input.value = value
|
||||
Data.audio.master = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_music_spin_box_value_changed(value: float) -> void:
|
||||
music_slider.value = value
|
||||
Data.audio.music = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Music"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_music_h_slider_value_changed(value: float) -> void:
|
||||
music_input.value = value
|
||||
Data.audio.music = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Music"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_sfx_spin_box_value_changed(value: float) -> void:
|
||||
sfx_slider.value = value
|
||||
Data.audio.sfx = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), linear_to_db(value / 100.0))
|
||||
|
||||
|
||||
func _on_sfx_h_slider_value_changed(value: float) -> void:
|
||||
sfx_input.value = value
|
||||
Data.audio.sfx = value
|
||||
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), linear_to_db(value / 100.0))
|
||||
1
UI/Menus/OptionsMenu/audio_options.gd.uid
Normal file
1
UI/Menus/OptionsMenu/audio_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c4ljvgrb81du6
|
||||
110
UI/Menus/OptionsMenu/audio_options.tscn
Normal file
110
UI/Menus/OptionsMenu/audio_options.tscn
Normal file
@@ -0,0 +1,110 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bwc45ogto8thn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c4ljvgrb81du6" path="res://UI/Menus/OptionsMenu/audio_options.gd" id="1_avc0j"]
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_hvvdd"]
|
||||
|
||||
[node name="Audio" type="VBoxContainer" node_paths=PackedStringArray("master_input", "master_slider", "music_input", "music_slider", "sfx_input", "sfx_slider")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_avc0j")
|
||||
master_input = NodePath("Master/HBoxContainer/SpinBox")
|
||||
master_slider = NodePath("Master/HBoxContainer/HSlider")
|
||||
music_input = NodePath("Music/HBoxContainer/SpinBox")
|
||||
music_slider = NodePath("Music/HBoxContainer/HSlider")
|
||||
sfx_input = NodePath("SFX/HBoxContainer/SpinBox")
|
||||
sfx_slider = NodePath("SFX/HBoxContainer/HSlider")
|
||||
|
||||
[node name="Master" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Master"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_MASTER_AUDIO"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Master"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="Master/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_hvvdd")
|
||||
value = 100.0
|
||||
rounded = true
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="Master/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
value = 100.0
|
||||
|
||||
[node name="Music" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Music"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_MUSIC_AUDIO"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Music"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="Music/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_hvvdd")
|
||||
value = 100.0
|
||||
rounded = true
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="Music/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
value = 100.0
|
||||
|
||||
[node name="SFX" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="SFX"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_SFX_AUDIO"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="SFX"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="SFX/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_hvvdd")
|
||||
value = 100.0
|
||||
rounded = true
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="SFX/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
value = 100.0
|
||||
|
||||
[connection signal="value_changed" from="Master/HBoxContainer/SpinBox" to="." method="_on_master_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="Master/HBoxContainer/HSlider" to="." method="_on_master_h_slider_value_changed"]
|
||||
[connection signal="value_changed" from="Music/HBoxContainer/SpinBox" to="." method="_on_music_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="Music/HBoxContainer/HSlider" to="." method="_on_music_h_slider_value_changed"]
|
||||
[connection signal="value_changed" from="SFX/HBoxContainer/SpinBox" to="." method="_on_sfx_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="SFX/HBoxContainer/HSlider" to="." method="_on_sfx_h_slider_value_changed"]
|
||||
46
UI/Menus/OptionsMenu/gameplay_options.gd
Normal file
46
UI/Menus/OptionsMenu/gameplay_options.gd
Normal file
@@ -0,0 +1,46 @@
|
||||
class_name GameplayOptionsMenu
|
||||
extends VBoxContainer
|
||||
|
||||
@export var look_sens_slider: HSlider
|
||||
@export var look_sens_input: SpinBox
|
||||
@export var toggle_sprint_checkbox: CheckButton
|
||||
@export var invert_lookY: CheckButton
|
||||
@export var invert_lookX: CheckButton
|
||||
@export var fixed_minimap: CheckButton
|
||||
@export var tower_damage: Button
|
||||
@export var self_damage: Button
|
||||
@export var party_damage: Button
|
||||
@export var status_damage: Button
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
look_sens_slider.value = Data.preferences.mouse_sens
|
||||
look_sens_input.value = Data.preferences.mouse_sens
|
||||
toggle_sprint_checkbox.button_pressed = Data.preferences.toggle_sprint
|
||||
invert_lookY.button_pressed = Data.preferences.invert_lookY
|
||||
invert_lookX.button_pressed = Data.preferences.invert_lookX
|
||||
fixed_minimap.button_pressed = Data.preferences.fixed_minimap
|
||||
tower_damage.button_pressed = Data.preferences.display_tower_damage_indicators
|
||||
self_damage.button_pressed = Data.preferences.display_self_damage_indicators
|
||||
party_damage.button_pressed = Data.preferences.display_party_damage_indicators
|
||||
status_damage.button_pressed = Data.preferences.display_status_effect_damage_indicators
|
||||
|
||||
|
||||
func save() -> void:
|
||||
Data.preferences.mouse_sens = look_sens_slider.value
|
||||
Data.preferences.toggle_sprint = toggle_sprint_checkbox.button_pressed
|
||||
Data.preferences.invert_lookY = invert_lookY.button_pressed
|
||||
Data.preferences.invert_lookX = invert_lookX.button_pressed
|
||||
Data.preferences.fixed_minimap = fixed_minimap.button_pressed
|
||||
Data.preferences.display_tower_damage_indicators = tower_damage.button_pressed
|
||||
Data.preferences.display_self_damage_indicators = self_damage.button_pressed
|
||||
Data.preferences.display_party_damage_indicators = party_damage.button_pressed
|
||||
Data.preferences.display_status_effect_damage_indicators = status_damage.button_pressed
|
||||
|
||||
|
||||
func _on_mouse_sens_spin_box_value_changed(value: float) -> void:
|
||||
look_sens_slider.value = value
|
||||
|
||||
|
||||
func _on_mouse_sens_h_slider_value_changed(value: float) -> void:
|
||||
look_sens_input.value = value
|
||||
1
UI/Menus/OptionsMenu/gameplay_options.gd.uid
Normal file
1
UI/Menus/OptionsMenu/gameplay_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dtrjph756oq1f
|
||||
171
UI/Menus/OptionsMenu/gameplay_options.tscn
Normal file
171
UI/Menus/OptionsMenu/gameplay_options.tscn
Normal file
@@ -0,0 +1,171 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bjk7jf0bau5lv"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dtrjph756oq1f" path="res://UI/Menus/OptionsMenu/gameplay_options.gd" id="1_sy26f"]
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_03x6q"]
|
||||
|
||||
[node name="Gameplay" type="VBoxContainer" node_paths=PackedStringArray("look_sens_slider", "look_sens_input", "toggle_sprint_checkbox", "invert_lookY", "invert_lookX", "fixed_minimap", "tower_damage", "self_damage", "party_damage", "status_damage")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_sy26f")
|
||||
look_sens_slider = NodePath("MouseSens/HBoxContainer/HSlider")
|
||||
look_sens_input = NodePath("MouseSens/HBoxContainer/SpinBox")
|
||||
toggle_sprint_checkbox = NodePath("ToggleSprint/CenterContainer/CheckButton")
|
||||
invert_lookY = NodePath("InvertMouseY/CenterContainer/CheckButton")
|
||||
invert_lookX = NodePath("InvertMouseX/CenterContainer/CheckButton")
|
||||
fixed_minimap = NodePath("FixedMinimap/CenterContainer/CheckButton")
|
||||
tower_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/TowerDamage")
|
||||
self_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/SelfDamage")
|
||||
party_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/PartyDamage")
|
||||
status_damage = NodePath("FloatingDamageIndicators/CenterContainer/HBoxContainer/StatusDamage")
|
||||
|
||||
[node name="MouseSens" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="MouseSens"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_MOUSE_SENSITIVITY"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MouseSens"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="MouseSens/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_03x6q")
|
||||
step = 0.01
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="MouseSens/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
step = 0.01
|
||||
scrollable = false
|
||||
|
||||
[node name="ToggleSprint" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ToggleSprint"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_TOGGLE_SPRINT"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="ToggleSprint"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="ToggleSprint/CenterContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
flat = true
|
||||
|
||||
[node name="InvertMouseY" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="InvertMouseY"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_INVERT_MOUSE_Y"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="InvertMouseY"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="InvertMouseY/CenterContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
flat = true
|
||||
|
||||
[node name="InvertMouseX" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="InvertMouseX"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_INVERT_MOUSE_X"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="InvertMouseX"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="InvertMouseX/CenterContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
flat = true
|
||||
|
||||
[node name="FixedMinimap" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="FixedMinimap"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_FIXED_MINIMAP"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="FixedMinimap"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="FixedMinimap/CenterContainer"]
|
||||
layout_mode = 2
|
||||
flat = true
|
||||
|
||||
[node name="FloatingDamageIndicators" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="FloatingDamageIndicators"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_DISPLAY_DAMAGE_INDICATORS"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="FloatingDamageIndicators"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="FloatingDamageIndicators/CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TowerDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_TOWER_DAMAGE"
|
||||
|
||||
[node name="SelfDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_SELF_DAMAGE"
|
||||
|
||||
[node name="PartyDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_PARTY_DAMAGE"
|
||||
|
||||
[node name="StatusDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_STATUS_DAMAGE"
|
||||
|
||||
[connection signal="value_changed" from="MouseSens/HBoxContainer/SpinBox" to="." method="_on_mouse_sens_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="MouseSens/HBoxContainer/HSlider" to="." method="_on_mouse_sens_h_slider_value_changed"]
|
||||
36
UI/Menus/OptionsMenu/graphics_options.gd
Normal file
36
UI/Menus/OptionsMenu/graphics_options.gd
Normal file
@@ -0,0 +1,36 @@
|
||||
class_name GraphicsOptionsMenu
|
||||
extends VBoxContainer
|
||||
|
||||
@export var fov_input: SpinBox
|
||||
@export var fov_slider: HSlider
|
||||
@export var vsync_dropdown: OptionButton
|
||||
@export var aa_dropdown: OptionButton
|
||||
@export var window_dropdown: OptionButton
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
fov_input.value = Data.graphics.hfov
|
||||
fov_slider.value = Data.graphics.hfov
|
||||
vsync_dropdown.selected = Data.graphics.vsync_mode
|
||||
aa_dropdown.selected = Data.graphics.aa_mode
|
||||
|
||||
|
||||
func save() -> void:
|
||||
Data.graphics.hfov = fov_slider.value
|
||||
Data.graphics.vsync_mode = vsync_dropdown.selected
|
||||
Data.graphics.aa_mode = aa_dropdown.selected
|
||||
Data.graphics.windowed_mode = window_dropdown.selected
|
||||
|
||||
|
||||
func _on_fov_spin_box_value_changed(value: float) -> void:
|
||||
if value < 40.0:
|
||||
value = 40.0
|
||||
if value > 160.0:
|
||||
value = 160.0
|
||||
fov_slider.value = value
|
||||
Data.graphics.hfov = value
|
||||
|
||||
|
||||
func _on_fov_h_slider_value_changed(value: float) -> void:
|
||||
fov_input.value = value
|
||||
Data.graphics.hfov = value
|
||||
1
UI/Menus/OptionsMenu/graphics_options.gd.uid
Normal file
1
UI/Menus/OptionsMenu/graphics_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bpb5c5r1yi8um
|
||||
124
UI/Menus/OptionsMenu/graphics_options.tscn
Normal file
124
UI/Menus/OptionsMenu/graphics_options.tscn
Normal file
@@ -0,0 +1,124 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bmd4mawasoc11"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpb5c5r1yi8um" path="res://UI/Menus/OptionsMenu/graphics_options.gd" id="1_85rh6"]
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_03x6q"]
|
||||
|
||||
[node name="Graphics" type="VBoxContainer" node_paths=PackedStringArray("fov_input", "fov_slider", "vsync_dropdown", "aa_dropdown", "window_dropdown")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_85rh6")
|
||||
fov_input = NodePath("FOV/HBoxContainer/SpinBox")
|
||||
fov_slider = NodePath("FOV/HBoxContainer/HSlider")
|
||||
vsync_dropdown = NodePath("VSync/OptionButton")
|
||||
aa_dropdown = NodePath("AntiAliasing/OptionButton")
|
||||
window_dropdown = NodePath("Windowed/OptionButton")
|
||||
|
||||
[node name="FOV" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="FOV"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_FOV"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="FOV"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="FOV/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_03x6q")
|
||||
min_value = 40.0
|
||||
max_value = 160.0
|
||||
value = 100.0
|
||||
allow_greater = true
|
||||
allow_lesser = true
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="FOV/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
min_value = 40.0
|
||||
max_value = 160.0
|
||||
value = 100.0
|
||||
scrollable = false
|
||||
|
||||
[node name="VSync" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VSync"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_VSYNC"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="VSync"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
selected = 1
|
||||
item_count = 4
|
||||
popup/item_0/text = "OPTION_OFF"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "OPTION_ON"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "OPTION_ADAPTIVE"
|
||||
popup/item_2/id = 2
|
||||
popup/item_3/text = "OPTION_TRIPLE_BUFFERED"
|
||||
popup/item_3/id = 3
|
||||
|
||||
[node name="AntiAliasing" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="AntiAliasing"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_AA"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="AntiAliasing"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
selected = 0
|
||||
item_count = 3
|
||||
popup/item_0/text = "OPTION_OFF"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "OPTION_FXAA"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "OPTION_TAA"
|
||||
popup/item_2/id = 2
|
||||
|
||||
[node name="Windowed" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Windowed"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_WINDOW_TYPE"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="Windowed"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
selected = 0
|
||||
item_count = 3
|
||||
popup/item_0/text = "OPTION_WINDOWED"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "OPTION_BORDERLESS"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "OPTION_FULLSCREEN"
|
||||
popup/item_2/id = 2
|
||||
|
||||
[connection signal="value_changed" from="FOV/HBoxContainer/SpinBox" to="." method="_on_fov_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="FOV/HBoxContainer/HSlider" to="." method="_on_fov_h_slider_value_changed"]
|
||||
125
UI/Menus/OptionsMenu/keybind_entry.gd
Normal file
125
UI/Menus/OptionsMenu/keybind_entry.gd
Normal file
@@ -0,0 +1,125 @@
|
||||
class_name KeybindEntry
|
||||
extends HBoxContainer
|
||||
|
||||
signal bind_button_pressed(button: Button)
|
||||
|
||||
var action_string: String
|
||||
var event_buttons: Array[BindButton]
|
||||
|
||||
|
||||
func to_array() -> Array:
|
||||
var binding_list: Array = []
|
||||
binding_list.append([action_string])
|
||||
for button: BindButton in event_buttons:
|
||||
var binding: Array = []
|
||||
if button.trigger_event is InputEventKey:
|
||||
binding.append("InputEventKey")
|
||||
binding.append(button.trigger_event.physical_keycode)
|
||||
if button.trigger_event is InputEventMouseButton:
|
||||
binding.append("InputEventMouseButton")
|
||||
binding.append(button.trigger_event.button_index)
|
||||
if button.trigger_event is InputEventJoypadButton:
|
||||
binding.append("InputEventJoypadButton")
|
||||
binding.append(button.trigger_event.button_index)
|
||||
binding_list.append(binding)
|
||||
return binding_list
|
||||
|
||||
|
||||
func populate_from_array(binding_list: Array) -> void:
|
||||
action_string = binding_list[0][0]
|
||||
for i: int in binding_list.size() - 1:
|
||||
if i == 0:
|
||||
continue
|
||||
for binding: Array in binding_list[i]:
|
||||
add_bind_button(KeymapData.event_from_array(binding))
|
||||
|
||||
|
||||
func set_action_name(action_name: String) -> void:
|
||||
action_string = action_name
|
||||
$ActionName.text = action_name
|
||||
|
||||
|
||||
func button_pressed(button: Button) -> void:
|
||||
bind_button_pressed.emit(button)
|
||||
|
||||
|
||||
func set_button_bind(event: InputEvent, button: BindButton) -> void:
|
||||
button.trigger_event = event
|
||||
button.text = ""
|
||||
if event is InputEventKey:
|
||||
if KeyIconMap.keys.has(str(event.physical_keycode)):
|
||||
button.icon = load(KeyIconMap.keys[str(event.physical_keycode)])
|
||||
elif event is InputEventMouseButton:
|
||||
if event.button_index == 4:
|
||||
button.icon = load(KeyIconMap.mouse_buttons[str(event.button_index)])
|
||||
elif event.button_index == 5:
|
||||
button.icon = load(KeyIconMap.mouse_buttons[str(event.button_index)])
|
||||
elif event.button_index == 6:
|
||||
button.text = "Mouse Wheel Left"
|
||||
elif event.button_index == 7:
|
||||
button.text = "Mouse Wheel Right"
|
||||
elif event.button_index == 8:
|
||||
button.text = "Mouse Button 4"
|
||||
elif event.button_index == 9:
|
||||
button.text = "Mouse Button 5"
|
||||
elif KeyIconMap.mouse_buttons.has(str(event.button_index)):
|
||||
button.icon = load(KeyIconMap.mouse_buttons[str(event.button_index)])
|
||||
elif event is InputEventJoypadButton:
|
||||
if Input.get_joy_name(event.device) == "Xbox 360 Controller":
|
||||
button.icon = load(KeyIconMap.xbox_360_keys[str(event.button_index)])
|
||||
elif Input.get_joy_name(event.device) == "Xbox Series Controller":
|
||||
button.icon = load(KeyIconMap.xbox_series_keys[str(event.button_index)])
|
||||
elif Input.get_joy_name(event.device).contains("Playstation"):
|
||||
button.icon = load(KeyIconMap.playstation_keys[str(event.button_index)])
|
||||
|
||||
|
||||
func set_cross_button_visibility(button: Button, visibility: bool) -> void:
|
||||
button.visible = visibility
|
||||
|
||||
|
||||
func add_bind_button(event: InputEvent) -> BindButton:
|
||||
#Create binding button
|
||||
var new_button: BindButton = BindButton.new()
|
||||
new_button.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
new_button.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
new_button.custom_minimum_size = Vector2(75.0, 75.0)
|
||||
new_button.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
new_button.expand_icon = true
|
||||
new_button.pressed.connect(button_pressed.bind(new_button))
|
||||
if event:
|
||||
set_button_bind(event, new_button)
|
||||
event_buttons.append(new_button)
|
||||
|
||||
#Create delete button
|
||||
var cross_button: Button = Button.new()
|
||||
cross_button.icon = load("res://Assets/Textures/flair_disabled_cross.png")
|
||||
cross_button.visible = false
|
||||
cross_button.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
cross_button.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
cross_button.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
cross_button.expand_icon = true
|
||||
cross_button.pressed.connect(remove_bind_button.bind(new_button))
|
||||
|
||||
#Create vbox to hold buttons
|
||||
var vbox: VBoxContainer = VBoxContainer.new()
|
||||
vbox.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
vbox.custom_minimum_size = Vector2(100.0, 100.0)
|
||||
vbox.mouse_entered.connect(set_cross_button_visibility.bind(cross_button, true))
|
||||
vbox.mouse_exited.connect(set_cross_button_visibility.bind(cross_button, false))
|
||||
|
||||
#Add buttons to vbox and add vbox to button grid
|
||||
vbox.add_child(new_button)
|
||||
vbox.add_child(cross_button)
|
||||
$Buttons.add_child(vbox)
|
||||
$Buttons.move_child(vbox, $Buttons.get_child_count() - 2)
|
||||
|
||||
return new_button
|
||||
|
||||
|
||||
func remove_bind_button(button: BindButton) -> void:
|
||||
event_buttons.erase(button)
|
||||
button.get_parent().queue_free()
|
||||
|
||||
|
||||
func _on_add_bind_button_pressed() -> void:
|
||||
add_bind_button(null).pressed.emit()
|
||||
1
UI/Menus/OptionsMenu/keybind_entry.gd.uid
Normal file
1
UI/Menus/OptionsMenu/keybind_entry.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://y2pxkfjn0wa2
|
||||
34
UI/Menus/OptionsMenu/keybind_entry.tscn
Normal file
34
UI/Menus/OptionsMenu/keybind_entry.tscn
Normal file
@@ -0,0 +1,34 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cb8irvp2y2p6g"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://y2pxkfjn0wa2" path="res://UI/Menus/OptionsMenu/keybind_entry.gd" id="1_it8q2"]
|
||||
|
||||
[node name="KeybindEntry" type="HBoxContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_it8q2")
|
||||
|
||||
[node name="ActionName" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Action Name"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Buttons" type="GridContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
columns = 4
|
||||
|
||||
[node name="AddBindButton" type="Button" parent="Buttons"]
|
||||
custom_minimum_size = Vector2(80, 80)
|
||||
layout_mode = 2
|
||||
text = "+"
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[connection signal="pressed" from="Buttons/AddBindButton" to="." method="_on_add_bind_button_pressed"]
|
||||
53
UI/Menus/OptionsMenu/keybind_options.gd
Normal file
53
UI/Menus/OptionsMenu/keybind_options.gd
Normal file
@@ -0,0 +1,53 @@
|
||||
extends VBoxContainer
|
||||
class_name KeybindsOptionsMenu
|
||||
|
||||
@export var keybind_entry_scene: PackedScene
|
||||
@export var keybind_popup: PackedScene
|
||||
var keybind_boxes: Array[KeybindEntry] = []
|
||||
var key_event: InputEvent
|
||||
var selected_entry: KeybindEntry
|
||||
var listening_for_key: bool = false
|
||||
var ui_layer: CanvasLayer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
#for index: int in Data.keymaps.size():
|
||||
# var map: PlayerKeymap = Data.keymaps[index]
|
||||
# var button: Button = Button.new()
|
||||
# button.text = map.title
|
||||
# button.pressed.connect(set_keymap.bind(index))
|
||||
# $HBoxContainer.add_child(button)
|
||||
load_keybind_labels()
|
||||
|
||||
|
||||
func set_keymap(keymap_index: int) -> void:
|
||||
Data.player_keymap = Data.keymaps[keymap_index]
|
||||
Data.player_keymap.apply()
|
||||
load_keybind_labels()
|
||||
|
||||
|
||||
func load_keybind_labels() -> void:
|
||||
for box: KeybindEntry in keybind_boxes:
|
||||
box.queue_free()
|
||||
keybind_boxes.clear()
|
||||
for action: StringName in InputMap.get_actions():
|
||||
if !action.begins_with("ui_"):
|
||||
var entry: KeybindEntry = keybind_entry_scene.instantiate() as KeybindEntry
|
||||
entry.set_action_name(action)
|
||||
if InputMap.action_get_events(action).size() > 0:
|
||||
for event: InputEvent in InputMap.action_get_events(action):
|
||||
entry.add_bind_button(event)
|
||||
keybind_boxes.append(entry)
|
||||
entry.bind_button_pressed.connect(_on_keybind_button_pressed.bind(entry))
|
||||
$ScrollContainer/VBoxContainer.add_child(entry)
|
||||
|
||||
|
||||
func _on_keybind_button_pressed(button: Button, keybind_entry: KeybindEntry) -> void:
|
||||
var popup: KeybindPopup = keybind_popup.instantiate()
|
||||
popup.event_detected.connect(keybind_entry.set_button_bind.bind(button))
|
||||
ui_layer.add_child(popup)
|
||||
|
||||
|
||||
func save() -> void:
|
||||
for entry: KeybindEntry in keybind_boxes:
|
||||
Data.keymap_data.add_binding(entry.to_array())
|
||||
1
UI/Menus/OptionsMenu/keybind_options.gd.uid
Normal file
1
UI/Menus/OptionsMenu/keybind_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cxm67e833baex
|
||||
26
UI/Menus/OptionsMenu/keybind_options.tscn
Normal file
26
UI/Menus/OptionsMenu/keybind_options.tscn
Normal file
@@ -0,0 +1,26 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bf2nosqt5f82e"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cxm67e833baex" path="res://UI/Menus/OptionsMenu/keybind_options.gd" id="1_oxg0p"]
|
||||
[ext_resource type="PackedScene" uid="uid://cb8irvp2y2p6g" path="res://UI/Menus/OptionsMenu/keybind_entry.tscn" id="2_ayiik"]
|
||||
[ext_resource type="PackedScene" uid="uid://clsdko6ttudu8" path="res://UI/Menus/OptionsMenu/keybind_popup.tscn" id="3_h1scm"]
|
||||
|
||||
[node name="Keybinds" type="VBoxContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_oxg0p")
|
||||
keybind_entry_scene = ExtResource("2_ayiik")
|
||||
keybind_popup = ExtResource("3_h1scm")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
15
UI/Menus/OptionsMenu/keybind_popup.gd
Normal file
15
UI/Menus/OptionsMenu/keybind_popup.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
class_name KeybindPopup
|
||||
extends Control
|
||||
|
||||
signal event_detected(event: InputEvent)
|
||||
|
||||
var found_event: bool = false
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if found_event:
|
||||
return
|
||||
if event is InputEventKey or event is InputEventMouseButton or event is InputEventJoypadButton:
|
||||
get_viewport().set_input_as_handled()
|
||||
found_event = true
|
||||
event_detected.emit(event)
|
||||
queue_free()
|
||||
1
UI/Menus/OptionsMenu/keybind_popup.gd.uid
Normal file
1
UI/Menus/OptionsMenu/keybind_popup.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d25hjwjdwv35i
|
||||
38
UI/Menus/OptionsMenu/keybind_popup.tscn
Normal file
38
UI/Menus/OptionsMenu/keybind_popup.tscn
Normal file
@@ -0,0 +1,38 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://clsdko6ttudu8"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d25hjwjdwv35i" path="res://UI/Menus/OptionsMenu/keybind_popup.gd" id="1_m5i0b"]
|
||||
|
||||
[node name="KeybindPopup" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_m5i0b")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 0.54902)
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -99.0
|
||||
offset_top = -13.0
|
||||
offset_right = 99.0
|
||||
offset_bottom = 13.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "LABEL_BIND_KEY"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
69
UI/Menus/OptionsMenu/keymap_data.gd
Normal file
69
UI/Menus/OptionsMenu/keymap_data.gd
Normal file
@@ -0,0 +1,69 @@
|
||||
class_name KeymapData
|
||||
extends RefCounted
|
||||
|
||||
var title: String = "default"
|
||||
var map: Dictionary[String, Array]
|
||||
|
||||
|
||||
func add_binding(bind_array: Array) -> void:
|
||||
var x: int = bind_array.size() - 1
|
||||
var arr: Array
|
||||
for i: int in x:
|
||||
arr.append(bind_array[i + 1])
|
||||
map[bind_array[0][0]] = arr
|
||||
|
||||
|
||||
static func event_from_array(array: Array) -> InputEvent:
|
||||
if array.size() < 2:
|
||||
return null
|
||||
if array[0] == "InputEventKey":
|
||||
var event: InputEventKey = InputEventKey.new()
|
||||
event.physical_keycode = array[1]
|
||||
return event
|
||||
if array[0] == "InputEventMouseButton":
|
||||
var event: InputEventMouseButton = InputEventMouseButton.new()
|
||||
event.button_index = array[1]
|
||||
return event
|
||||
if array[0] == "InputEventJoypadButton":
|
||||
var event: InputEventJoypadButton = InputEventJoypadButton.new()
|
||||
event.button_index = array[1]
|
||||
return event
|
||||
return null
|
||||
|
||||
|
||||
func apply() -> void:
|
||||
for action_string: String in map.keys():
|
||||
InputMap.action_erase_events(action_string)
|
||||
for binding: Array in map[action_string]:
|
||||
var event: InputEvent = event_from_array(binding)
|
||||
if event:
|
||||
InputMap.action_add_event(action_string, event)
|
||||
|
||||
|
||||
func save_to_disc() -> void:
|
||||
var dir: DirAccess = DirAccess.open("user://")
|
||||
if !dir.dir_exists("keymaps"):
|
||||
dir.make_dir("keymaps")
|
||||
var save_file: FileAccess = FileAccess.open("user://keymaps/default", FileAccess.WRITE)
|
||||
var dict: Dictionary = {
|
||||
"title" = title,
|
||||
"map" = map,
|
||||
}
|
||||
var json_string: String = JSON.stringify(dict)
|
||||
save_file.store_line(json_string)
|
||||
|
||||
|
||||
static func load_from_disk() -> KeymapData:
|
||||
if FileAccess.file_exists("user://keymaps/default"):
|
||||
var save_file: FileAccess = FileAccess.open("user://keymaps/default", FileAccess.READ)
|
||||
var json_string: String = save_file.get_line()
|
||||
var json: JSON = JSON.new()
|
||||
var parse_result: Error = json.parse(json_string)
|
||||
if parse_result == OK:
|
||||
var dict: Dictionary = json.data
|
||||
var keymap: KeymapData = KeymapData.new()
|
||||
keymap.title = dict["title"]
|
||||
for key: String in dict["map"].keys():
|
||||
keymap.map[key] = dict["map"][key]
|
||||
return keymap
|
||||
return KeymapData.new()
|
||||
1
UI/Menus/OptionsMenu/keymap_data.gd.uid
Normal file
1
UI/Menus/OptionsMenu/keymap_data.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dui1k2e4q6cl
|
||||
44
UI/Menus/OptionsMenu/options_menu.gd
Normal file
44
UI/Menus/OptionsMenu/options_menu.gd
Normal file
@@ -0,0 +1,44 @@
|
||||
class_name OptionsMenu
|
||||
extends Control
|
||||
|
||||
@export var gameplay: GameplayOptionsMenu
|
||||
@export var graphics: GraphicsOptionsMenu
|
||||
@export var keybinds: KeybindsOptionsMenu
|
||||
@export var audio: AudioOptionsMenu
|
||||
var game_manager: GameManager
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
set_tab_locale()
|
||||
keybinds.ui_layer = game_manager.UILayer
|
||||
|
||||
|
||||
func set_tab_locale() -> void:
|
||||
gameplay.name = tr("OPTIONS_TAB_GAMEPLAY")
|
||||
graphics.name = tr("OPTIONS_TAB_GRAPHICS")
|
||||
keybinds.name = tr("OPTIONS_TAB_KEYBINDS")
|
||||
audio.name = tr("OPTIONS_TAB_AUDIO")
|
||||
|
||||
|
||||
func _on_cancel_pressed() -> void:
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_confirm_pressed() -> void:
|
||||
gameplay.save()
|
||||
graphics.save()
|
||||
keybinds.save()
|
||||
Data.graphics.apply_graphical_settings(get_viewport())
|
||||
Data.graphics.save_profile_to_disk()
|
||||
Data.audio.apply_audio_settings()
|
||||
Data.audio.save_profile_to_disk()
|
||||
Data.preferences.save_profile_to_disk()
|
||||
Data.keymap_data.apply()
|
||||
Data.keymap_data.save_to_disc()
|
||||
#Data.player_keymap.save_profile_to_disk()
|
||||
#Data.player_controller_keymap.append_input_map()
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_button_hovered() -> void:
|
||||
$AudioStreamPlayer.play()
|
||||
1
UI/Menus/OptionsMenu/options_menu.gd.uid
Normal file
1
UI/Menus/OptionsMenu/options_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://48rvmybi18wj
|
||||
76
UI/Menus/OptionsMenu/options_menu.tscn
Normal file
76
UI/Menus/OptionsMenu/options_menu.tscn
Normal file
@@ -0,0 +1,76 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://clulh7v8c7h85"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://48rvmybi18wj" path="res://UI/Menus/OptionsMenu/options_menu.gd" id="1_bievw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjk7jf0bau5lv" path="res://UI/Menus/OptionsMenu/gameplay_options.tscn" id="3_25wuw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bmd4mawasoc11" path="res://UI/Menus/OptionsMenu/graphics_options.tscn" id="4_ckcvq"]
|
||||
[ext_resource type="PackedScene" uid="uid://bf2nosqt5f82e" path="res://UI/Menus/OptionsMenu/keybind_options.tscn" id="5_4k33c"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwc45ogto8thn" path="res://UI/Menus/OptionsMenu/audio_options.tscn" id="6_4vs8p"]
|
||||
[ext_resource type="AudioStream" uid="uid://cp6ph4ra7u5rk" path="res://UI/drop_003.ogg" id="6_hhyef"]
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_5otwj"]
|
||||
random_pitch = 1.1
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("6_hhyef")
|
||||
|
||||
[node name="OptionsMenu" type="PanelContainer" node_paths=PackedStringArray("gameplay", "graphics", "keybinds", "audio")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 30.0
|
||||
offset_top = 30.0
|
||||
offset_right = -30.0
|
||||
offset_bottom = -30.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_bievw")
|
||||
gameplay = NodePath("VBoxContainer/TabContainer/Gameplay")
|
||||
graphics = NodePath("VBoxContainer/TabContainer/Graphics")
|
||||
keybinds = NodePath("VBoxContainer/TabContainer/Keybinds")
|
||||
audio = NodePath("VBoxContainer/TabContainer/Audio")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
current_tab = 0
|
||||
|
||||
[node name="Gameplay" parent="VBoxContainer/TabContainer" instance=ExtResource("3_25wuw")]
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 0
|
||||
|
||||
[node name="Graphics" parent="VBoxContainer/TabContainer" instance=ExtResource("4_ckcvq")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 1
|
||||
|
||||
[node name="Keybinds" parent="VBoxContainer/TabContainer" instance=ExtResource("5_4k33c")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 2
|
||||
|
||||
[node name="Audio" parent="VBoxContainer/TabContainer" instance=ExtResource("6_4vs8p")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="Cancel" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_CANCEL"
|
||||
|
||||
[node name="Confirm" type="Button" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_CONFIRM"
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = SubResource("AudioStreamRandomizer_5otwj")
|
||||
|
||||
[connection signal="mouse_entered" from="VBoxContainer/HBoxContainer/Cancel" to="." method="_on_button_hovered"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Cancel" to="." method="_on_cancel_pressed"]
|
||||
[connection signal="mouse_entered" from="VBoxContainer/HBoxContainer/Confirm" to="." method="_on_button_hovered"]
|
||||
[connection signal="pressed" from="VBoxContainer/HBoxContainer/Confirm" to="." method="_on_confirm_pressed"]
|
||||
Reference in New Issue
Block a user