fixes extra typos and lost references
This commit is contained in:
54
ui/menus/options_menu/audio_options.gd
Normal file
54
ui/menus/options_menu/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/options_menu/audio_options.gd.uid
Normal file
1
ui/menus/options_menu/audio_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c4ljvgrb81du6
|
||||
110
ui/menus/options_menu/audio_options.tscn
Normal file
110
ui/menus/options_menu/audio_options.tscn
Normal file
@@ -0,0 +1,110 @@
|
||||
[gd_scene format=3 uid="uid://bwc45ogto8thn"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c4ljvgrb81du6" path="res://ui/menus/options_menu/audio_options.gd" id="1_avc0j"]
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_hvvdd"]
|
||||
|
||||
[node name="Audio" type="VBoxContainer" unique_id=593801484 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="." unique_id=1142133925]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Master" unique_id=1552603842]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_MASTER_AUDIO"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Master" unique_id=1063013261]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="Master/HBoxContainer" unique_id=1380819438]
|
||||
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" unique_id=497952448]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
value = 100.0
|
||||
|
||||
[node name="Music" type="HBoxContainer" parent="." unique_id=812179024]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Music" unique_id=1525069107]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_MUSIC_AUDIO"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Music" unique_id=1819073536]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="Music/HBoxContainer" unique_id=1382680787]
|
||||
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" unique_id=441308549]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
value = 100.0
|
||||
|
||||
[node name="SFX" type="HBoxContainer" parent="." unique_id=640927754]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="SFX" unique_id=645474174]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_SFX_AUDIO"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="SFX" unique_id=315581570]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="SFX/HBoxContainer" unique_id=1649673461]
|
||||
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" unique_id=2086377224]
|
||||
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"]
|
||||
74
ui/menus/options_menu/gameplay_options.gd
Normal file
74
ui/menus/options_menu/gameplay_options.gd
Normal file
@@ -0,0 +1,74 @@
|
||||
class_name GameplayOptionsMenu
|
||||
extends VBoxContainer
|
||||
|
||||
@export var resolution_drop_down: OptionButton
|
||||
@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
|
||||
@export var show_shield: Button
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
#resolution_drop_down.add_item("320x240")
|
||||
#resolution_drop_down.add_item("1920x1080")
|
||||
#$MouseSens2/HBoxContainer/SpinBox.value = get_window().content_scale_factor
|
||||
#$MouseSens2/HBoxContainer/HSlider.value = get_window().content_scale_factor
|
||||
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
|
||||
show_shield.button_pressed = Data.preferences.always_show_shield_ui
|
||||
|
||||
|
||||
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
|
||||
Data.preferences.always_show_shield_ui = show_shield.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
|
||||
|
||||
|
||||
func _on_option_button_item_selected(index: int) -> void:
|
||||
#print(index)
|
||||
if index == 0:
|
||||
get_tree().root.size = Vector2i(320, 240)
|
||||
#DisplayServer.window_set_size(Vector2i(320, 240))
|
||||
#print(get_tree().root.size)
|
||||
if index == 1:
|
||||
get_tree().root.size = Vector2i(1920, 1080)
|
||||
#DisplayServer.window_set_size(Vector2i(1920, 1080))
|
||||
#print(get_tree().root.size)
|
||||
|
||||
|
||||
func _on_spin_box_value_changed(value: float) -> void:
|
||||
get_window().content_scale_factor = value
|
||||
|
||||
|
||||
func _on_h_slider_value_changed(value: float) -> void:
|
||||
get_window().content_scale_factor = value
|
||||
1
ui/menus/options_menu/gameplay_options.gd.uid
Normal file
1
ui/menus/options_menu/gameplay_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dtrjph756oq1f
|
||||
210
ui/menus/options_menu/gameplay_options.tscn
Normal file
210
ui/menus/options_menu/gameplay_options.tscn
Normal file
@@ -0,0 +1,210 @@
|
||||
[gd_scene format=3 uid="uid://bjk7jf0bau5lv"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dtrjph756oq1f" path="res://ui/menus/options_menu/gameplay_options.gd" id="1_sy26f"]
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_03x6q"]
|
||||
|
||||
[node name="Gameplay" type="VBoxContainer" unique_id=9533751 node_paths=PackedStringArray("resolution_drop_down", "look_sens_slider", "look_sens_input", "toggle_sprint_checkbox", "invert_lookY", "invert_lookX", "fixed_minimap", "tower_damage", "self_damage", "party_damage", "status_damage", "show_shield")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_sy26f")
|
||||
resolution_drop_down = NodePath("Resolution/HBoxContainer/OptionButton")
|
||||
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")
|
||||
show_shield = NodePath("AlwaysShowShield/CenterContainer/CheckButton")
|
||||
|
||||
[node name="Resolution" type="HBoxContainer" parent="." unique_id=1996706644]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Resolution" unique_id=1300086140]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_RESOLUTION"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Resolution" unique_id=681886116]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="Resolution/HBoxContainer" unique_id=796953193]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 6
|
||||
|
||||
[node name="MouseSens" type="HBoxContainer" parent="." unique_id=94044285]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="MouseSens" unique_id=121857514]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_MOUSE_SENSITIVITY"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MouseSens" unique_id=1900220297]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="MouseSens/HBoxContainer" unique_id=1624869113]
|
||||
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" unique_id=1975350654]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
step = 0.01
|
||||
scrollable = false
|
||||
|
||||
[node name="ToggleSprint" type="HBoxContainer" parent="." unique_id=978539197]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ToggleSprint" unique_id=1283392954]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_TOGGLE_SPRINT"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="ToggleSprint" unique_id=376741059]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="ToggleSprint/CenterContainer" unique_id=2022295218]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
flat = true
|
||||
|
||||
[node name="InvertMouseY" type="HBoxContainer" parent="." unique_id=1444600243]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="InvertMouseY" unique_id=1572398345]
|
||||
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" unique_id=374128785]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="InvertMouseY/CenterContainer" unique_id=2044173913]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
flat = true
|
||||
|
||||
[node name="InvertMouseX" type="HBoxContainer" parent="." unique_id=461905582]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="InvertMouseX" unique_id=372744415]
|
||||
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" unique_id=2040531812]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="InvertMouseX/CenterContainer" unique_id=1411305788]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
flat = true
|
||||
|
||||
[node name="FixedMinimap" type="HBoxContainer" parent="." unique_id=1354501751]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="FixedMinimap" unique_id=1118779722]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_FIXED_MINIMAP"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="FixedMinimap" unique_id=32064831]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="FixedMinimap/CenterContainer" unique_id=290069283]
|
||||
layout_mode = 2
|
||||
flat = true
|
||||
|
||||
[node name="FloatingDamageIndicators" type="HBoxContainer" parent="." unique_id=259538885]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="FloatingDamageIndicators" unique_id=1583027587]
|
||||
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" unique_id=599427541]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="FloatingDamageIndicators/CenterContainer" unique_id=1975754983]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TowerDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer" unique_id=241424148]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_TOWER_DAMAGE"
|
||||
|
||||
[node name="SelfDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer" unique_id=924745895]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_SELF_DAMAGE"
|
||||
|
||||
[node name="PartyDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer" unique_id=852777437]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_PARTY_DAMAGE"
|
||||
|
||||
[node name="StatusDamage" type="Button" parent="FloatingDamageIndicators/CenterContainer/HBoxContainer" unique_id=764996434]
|
||||
layout_mode = 2
|
||||
toggle_mode = true
|
||||
button_pressed = true
|
||||
text = "OPTION_STATUS_DAMAGE"
|
||||
|
||||
[node name="AlwaysShowShield" type="HBoxContainer" parent="." unique_id=745573840]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="AlwaysShowShield" unique_id=856331565]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_ALWAYS_SHOW_SHIELD"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="AlwaysShowShield" unique_id=726349358]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CheckButton" type="CheckButton" parent="AlwaysShowShield/CenterContainer" unique_id=263220323]
|
||||
layout_mode = 2
|
||||
flat = true
|
||||
|
||||
[connection signal="item_selected" from="Resolution/HBoxContainer/OptionButton" to="." method="_on_option_button_item_selected"]
|
||||
[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"]
|
||||
94
ui/menus/options_menu/graphics_options.gd
Normal file
94
ui/menus/options_menu/graphics_options.gd
Normal file
@@ -0,0 +1,94 @@
|
||||
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
|
||||
@export var vertex_jitter_input: SpinBox
|
||||
@export var vertex_jitter_slider: HSlider
|
||||
@export var affine_warping_input: SpinBox
|
||||
@export var affine_warping_slider: HSlider
|
||||
@export var resolution_scaling_input: SpinBox
|
||||
@export var resolution_scaling_slider: HSlider
|
||||
|
||||
|
||||
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
|
||||
window_dropdown.selected = Data.graphics.windowed_mode
|
||||
vertex_jitter_input.value = Data.graphics.vertex_jitter
|
||||
vertex_jitter_slider.value = Data.graphics.vertex_jitter
|
||||
affine_warping_input.value = Data.graphics.affine_warping
|
||||
affine_warping_slider.value = Data.graphics.affine_warping
|
||||
resolution_scaling_slider.value = Data.graphics.resolution_scaling
|
||||
resolution_scaling_input.value = Data.graphics.resolution_scaling
|
||||
|
||||
|
||||
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
|
||||
Data.graphics.vertex_jitter = vertex_jitter_slider.value
|
||||
Data.graphics.affine_warping = affine_warping_slider.value
|
||||
Data.graphics.resolution_scaling = resolution_scaling_slider.value
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
func _on_vertex_jitter_spin_box_value_changed(value: float) -> void:
|
||||
if value < 0.0:
|
||||
value = 0.0
|
||||
if value > 1.0:
|
||||
value = 1.0
|
||||
vertex_jitter_slider.value = value
|
||||
Data.graphics.vertex_jitter = value
|
||||
|
||||
|
||||
func _on_vertex_jitter_h_slider_value_changed(value: float) -> void:
|
||||
vertex_jitter_input.value = value
|
||||
Data.graphics.vertex_jitter = value
|
||||
|
||||
|
||||
func _on_affine_warping_spin_box_value_changed(value: float) -> void:
|
||||
if value < 0.0:
|
||||
value = 0.0
|
||||
if value > 1.0:
|
||||
value = 1.0
|
||||
affine_warping_slider.value = value
|
||||
Data.graphics.affine_warping = value
|
||||
|
||||
|
||||
func _on_affine_warping_h_slider_value_changed(value: float) -> void:
|
||||
affine_warping_input.value = value
|
||||
Data.graphics.affine_warping = value
|
||||
|
||||
|
||||
func _on_resolution_scaling_spin_box_value_changed(value: float) -> void:
|
||||
if value < 0.0:
|
||||
value = 0.0
|
||||
if value > 1.0:
|
||||
value = 1.0
|
||||
resolution_scaling_slider.value = value
|
||||
Data.resolution_changed.emit(Vector2(1920, 1080) * value)
|
||||
|
||||
|
||||
func _on_resolution_scaling_h_slider_value_changed(value: float) -> void:
|
||||
resolution_scaling_input.value = value
|
||||
Data.resolution_changed.emit(Vector2(1920, 1080) * value)
|
||||
1
ui/menus/options_menu/graphics_options.gd.uid
Normal file
1
ui/menus/options_menu/graphics_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bpb5c5r1yi8um
|
||||
241
ui/menus/options_menu/graphics_options.tscn
Normal file
241
ui/menus/options_menu/graphics_options.tscn
Normal file
@@ -0,0 +1,241 @@
|
||||
[gd_scene format=3 uid="uid://bmd4mawasoc11"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpb5c5r1yi8um" path="res://ui/menus/options_menu/graphics_options.gd" id="1_85rh6"]
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_03x6q"]
|
||||
|
||||
[node name="Graphics" type="VBoxContainer" unique_id=1842224615 node_paths=PackedStringArray("fov_input", "fov_slider", "vsync_dropdown", "aa_dropdown", "window_dropdown", "vertex_jitter_input", "vertex_jitter_slider", "affine_warping_input", "affine_warping_slider", "resolution_scaling_input", "resolution_scaling_slider")]
|
||||
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")
|
||||
vertex_jitter_input = NodePath("VextexJitter/HBoxContainer/SpinBox")
|
||||
vertex_jitter_slider = NodePath("VextexJitter/HBoxContainer/HSlider")
|
||||
affine_warping_input = NodePath("AffineWarping/HBoxContainer/SpinBox")
|
||||
affine_warping_slider = NodePath("AffineWarping/HBoxContainer/HSlider")
|
||||
resolution_scaling_input = NodePath("ResolutionScaling/HBoxContainer/SpinBox")
|
||||
resolution_scaling_slider = NodePath("ResolutionScaling/HBoxContainer/HSlider")
|
||||
|
||||
[node name="ResolutionScaling" type="HBoxContainer" parent="." unique_id=1230619872]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="ResolutionScaling" unique_id=550655132]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_RESOLUTION_SCALING"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="ResolutionScaling" unique_id=1042104415]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="ResolutionScaling/HBoxContainer" unique_id=3787654]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_03x6q")
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 0.2
|
||||
allow_greater = true
|
||||
allow_lesser = true
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="ResolutionScaling/HBoxContainer" unique_id=608837003]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 0.2
|
||||
scrollable = false
|
||||
|
||||
[node name="FOV" type="HBoxContainer" parent="." unique_id=693078328]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="FOV" unique_id=1333460491]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_FOV"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="FOV" unique_id=100259182]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="FOV/HBoxContainer" unique_id=1868915881]
|
||||
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" unique_id=1915723315]
|
||||
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="." unique_id=394348081]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VSync" unique_id=2134636415]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_VSYNC"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="VSync" unique_id=1949378825]
|
||||
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="." unique_id=370267058]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="AntiAliasing" unique_id=927045887]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_AA"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="AntiAliasing" unique_id=945853339]
|
||||
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="." unique_id=588218761]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Windowed" unique_id=128071246]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_WINDOW_TYPE"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="Windowed" unique_id=1949707304]
|
||||
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
|
||||
|
||||
[node name="VextexJitter" type="HBoxContainer" parent="." unique_id=624638999]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="VextexJitter" unique_id=890349126]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_VERTEX_JITTER"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VextexJitter" unique_id=857909591]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="VextexJitter/HBoxContainer" unique_id=319711346]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_03x6q")
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 0.2
|
||||
allow_greater = true
|
||||
allow_lesser = true
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="VextexJitter/HBoxContainer" unique_id=451280678]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 0.2
|
||||
scrollable = false
|
||||
|
||||
[node name="AffineWarping" type="HBoxContainer" parent="." unique_id=962591793]
|
||||
layout_mode = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="AffineWarping" unique_id=206915184]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "OPTION_AFFINE_WARPING"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="AffineWarping" unique_id=1780949636]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="AffineWarping/HBoxContainer" unique_id=1434191726]
|
||||
layout_mode = 2
|
||||
theme_override_icons/updown = SubResource("ImageTexture_03x6q")
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 1.0
|
||||
allow_greater = true
|
||||
allow_lesser = true
|
||||
alignment = 1
|
||||
update_on_text_changed = true
|
||||
|
||||
[node name="HSlider" type="HSlider" parent="AffineWarping/HBoxContainer" unique_id=2037498715]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
value = 1.0
|
||||
scrollable = false
|
||||
|
||||
[connection signal="value_changed" from="ResolutionScaling/HBoxContainer/SpinBox" to="." method="_on_resolution_scaling_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="ResolutionScaling/HBoxContainer/HSlider" to="." method="_on_resolution_scaling_h_slider_value_changed"]
|
||||
[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"]
|
||||
[connection signal="value_changed" from="VextexJitter/HBoxContainer/SpinBox" to="." method="_on_vertex_jitter_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="VextexJitter/HBoxContainer/HSlider" to="." method="_on_vertex_jitter_h_slider_value_changed"]
|
||||
[connection signal="value_changed" from="AffineWarping/HBoxContainer/SpinBox" to="." method="_on_affine_warping_spin_box_value_changed"]
|
||||
[connection signal="value_changed" from="AffineWarping/HBoxContainer/HSlider" to="." method="_on_affine_warping_h_slider_value_changed"]
|
||||
125
ui/menus/options_menu/keybind_entry.gd
Normal file
125
ui/menus/options_menu/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/options_menu/keybind_entry.gd.uid
Normal file
1
ui/menus/options_menu/keybind_entry.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://y2pxkfjn0wa2
|
||||
34
ui/menus/options_menu/keybind_entry.tscn
Normal file
34
ui/menus/options_menu/keybind_entry.tscn
Normal file
@@ -0,0 +1,34 @@
|
||||
[gd_scene format=3 uid="uid://cb8irvp2y2p6g"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://y2pxkfjn0wa2" path="res://ui/menus/options_menu/keybind_entry.gd" id="1_it8q2"]
|
||||
|
||||
[node name="KeybindEntry" type="HBoxContainer" unique_id=2041313667]
|
||||
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="." unique_id=1413481849]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Action Name"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Buttons" type="GridContainer" parent="." unique_id=312221019]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
columns = 4
|
||||
|
||||
[node name="AddBindButton" type="Button" parent="Buttons" unique_id=329539958]
|
||||
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/options_menu/keybind_options.gd
Normal file
53
ui/menus/options_menu/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/options_menu/keybind_options.gd.uid
Normal file
1
ui/menus/options_menu/keybind_options.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cxm67e833baex
|
||||
26
ui/menus/options_menu/keybind_options.tscn
Normal file
26
ui/menus/options_menu/keybind_options.tscn
Normal file
@@ -0,0 +1,26 @@
|
||||
[gd_scene format=3 uid="uid://bf2nosqt5f82e"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cxm67e833baex" path="res://ui/menus/options_menu/keybind_options.gd" id="1_oxg0p"]
|
||||
[ext_resource type="PackedScene" uid="uid://cb8irvp2y2p6g" path="res://ui/menus/options_menu/keybind_entry.tscn" id="2_ayiik"]
|
||||
[ext_resource type="PackedScene" uid="uid://clsdko6ttudu8" path="res://ui/menus/options_menu/keybind_popup.tscn" id="3_h1scm"]
|
||||
|
||||
[node name="Keybinds" type="VBoxContainer" unique_id=52837668]
|
||||
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="." unique_id=606716856]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="." unique_id=1857275092]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer" unique_id=851587234]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
15
ui/menus/options_menu/keybind_popup.gd
Normal file
15
ui/menus/options_menu/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/options_menu/keybind_popup.gd.uid
Normal file
1
ui/menus/options_menu/keybind_popup.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d25hjwjdwv35i
|
||||
38
ui/menus/options_menu/keybind_popup.tscn
Normal file
38
ui/menus/options_menu/keybind_popup.tscn
Normal file
@@ -0,0 +1,38 @@
|
||||
[gd_scene format=3 uid="uid://clsdko6ttudu8"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d25hjwjdwv35i" path="res://ui/menus/options_menu/keybind_popup.gd" id="1_m5i0b"]
|
||||
|
||||
[node name="KeybindPopup" type="Control" unique_id=439413596]
|
||||
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="." unique_id=122093359]
|
||||
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="." unique_id=658884725]
|
||||
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/options_menu/keymap_data.gd
Normal file
69
ui/menus/options_menu/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/options_menu/keymap_data.gd.uid
Normal file
1
ui/menus/options_menu/keymap_data.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dui1k2e4q6cl
|
||||
49
ui/menus/options_menu/options_menu.gd
Normal file
49
ui/menus/options_menu/options_menu.gd
Normal file
@@ -0,0 +1,49 @@
|
||||
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 _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("Pause"):
|
||||
queue_free()
|
||||
|
||||
|
||||
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/options_menu/options_menu.gd.uid
Normal file
1
ui/menus/options_menu/options_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://48rvmybi18wj
|
||||
78
ui/menus/options_menu/options_menu.tscn
Normal file
78
ui/menus/options_menu/options_menu.tscn
Normal file
@@ -0,0 +1,78 @@
|
||||
[gd_scene format=3 uid="uid://clulh7v8c7h85"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://48rvmybi18wj" path="res://ui/menus/options_menu/options_menu.gd" id="1_bievw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjk7jf0bau5lv" path="res://ui/menus/options_menu/gameplay_options.tscn" id="3_25wuw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bmd4mawasoc11" path="res://ui/menus/options_menu/graphics_options.tscn" id="4_ckcvq"]
|
||||
[ext_resource type="PackedScene" uid="uid://bf2nosqt5f82e" path="res://ui/menus/options_menu/keybind_options.tscn" id="5_4k33c"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwc45ogto8thn" path="res://ui/menus/options_menu/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" unique_id=891478447 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="." unique_id=1706117892]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="VBoxContainer" unique_id=1945339047]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
current_tab = 0
|
||||
|
||||
[node name="Gameplay" parent="VBoxContainer/TabContainer" unique_id=1603835818 instance=ExtResource("3_25wuw")]
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 0
|
||||
|
||||
[node name="Graphics" parent="VBoxContainer/TabContainer" unique_id=1564378673 instance=ExtResource("4_ckcvq")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 1
|
||||
|
||||
[node name="Keybinds" parent="VBoxContainer/TabContainer" unique_id=854093688 instance=ExtResource("5_4k33c")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 2
|
||||
|
||||
[node name="Audio" parent="VBoxContainer/TabContainer" unique_id=783102281 instance=ExtResource("6_4vs8p")]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 3
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer" unique_id=481503461]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="Cancel" type="Button" parent="VBoxContainer/HBoxContainer" unique_id=1274004537]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_CANCEL"
|
||||
|
||||
[node name="Confirm" type="Button" parent="VBoxContainer/HBoxContainer" unique_id=716108741]
|
||||
layout_mode = 2
|
||||
text = "BUTTON_CONFIRM"
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="." unique_id=103920719]
|
||||
stream = SubResource("AudioStreamRandomizer_5otwj")
|
||||
volume_db = -9.937
|
||||
bus = &"SFX"
|
||||
|
||||
[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