diff --git a/Prefabs/Settings Menu.tscn b/Prefabs/Settings Menu.tscn index 715b749..2a5ae6f 100644 --- a/Prefabs/Settings Menu.tscn +++ b/Prefabs/Settings Menu.tscn @@ -1,17 +1,17 @@ -[gd_scene load_steps=4 format=3 uid="uid://bbog8pmtkefhq"] +[gd_scene load_steps=4 format=3 uid="uid://cbfcolm6mjolp"] [ext_resource type="Script" path="res://Scripts/UI/SettingsMenu.gd" id="1_2rgd2"] -[ext_resource type="Theme" uid="uid://o3vg845para" path="res://Assets/UI_Theme.tres" id="2_swcn6"] -[ext_resource type="Script" path="res://Scripts/UI/RemapButton.gd" id="3_gktg3"] +[ext_resource type="Script" path="res://Scripts/UI/Remaping/RemapController.gd" id="2_2f8ap"] +[ext_resource type="Script" path="res://Scripts/UI/Remaping/RemapButton.gd" id="2_4asaa"] [node name="SettingsMenu" type="Node" node_paths=PackedStringArray("display_options_button", "vsync_toggle", "resolutions_options_button", "master_volume_slider", "music_volume_slider", "sfx_volume_slider")] script = ExtResource("1_2rgd2") -display_options_button = NodePath("MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings/DisplayModeOptions") -vsync_toggle = NodePath("MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings/VsyncButton") -resolutions_options_button = NodePath("MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings/ResolutionsOptions") -master_volume_slider = NodePath("MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MasterVolumeSlider") -music_volume_slider = NodePath("MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MusicVolSlider") -sfx_volume_slider = NodePath("MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/SFXVolSlider") +display_options_button = NodePath("CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/DisplayModeOptions") +vsync_toggle = NodePath("CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/VsyncButton") +resolutions_options_button = NodePath("CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/ResolutionsOptions") +master_volume_slider = NodePath("CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MasterVolumeSlider") +music_volume_slider = NodePath("CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MusicVolSlider") +sfx_volume_slider = NodePath("CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/SFXVolSlider") [node name="ColorRect" type="ColorRect" parent="."] anchors_preset = 15 @@ -21,39 +21,34 @@ grow_horizontal = 2 grow_vertical = 2 color = Color(0.576471, 0.831373, 0.709804, 1) -[node name="MainVBox" type="VBoxContainer" parent="."] +[node name="Label" type="Label" parent="."] +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 95.0 +grow_horizontal = 2 +theme_override_font_sizes/font_size = 35 +text = "SETTINGS MENU" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="CenterContainer" type="CenterContainer" parent="."] +custom_minimum_size = Vector2(0, 475) anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -theme = ExtResource("2_swcn6") -theme_override_constants/separation = 0 -[node name="TitleContainer" type="CenterContainer" parent="MainVBox"] -custom_minimum_size = Vector2(0, 100) -layout_mode = 2 - -[node name="Label" type="Label" parent="MainVBox/TitleContainer"] -layout_mode = 2 -theme_override_font_sizes/font_size = 35 -text = "SETTINGS MENU" - -[node name="TabsContainer" type="CenterContainer" parent="MainVBox"] -custom_minimum_size = Vector2(0, 475) -layout_mode = 2 - -[node name="SettingsTabs" type="TabContainer" parent="MainVBox/TabsContainer"] +[node name="SettingsTabs" type="TabContainer" parent="CenterContainer"] custom_minimum_size = Vector2(1050, 475) layout_mode = 2 theme_override_font_sizes/font_size = 29 -[node name="Video" type="VBoxContainer" parent="MainVBox/TabsContainer/SettingsTabs"] +[node name="Video" type="VBoxContainer" parent="CenterContainer/SettingsTabs"] layout_mode = 2 focus_neighbor_left = NodePath("../Controls") -focus_neighbor_right = NodePath("../Audio") -[node name="MarginContainer" type="MarginContainer" parent="MainVBox/TabsContainer/SettingsTabs/Video"] +[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/SettingsTabs/Video"] custom_minimum_size = Vector2(0, 425) layout_mode = 2 theme_override_constants/margin_left = 25 @@ -61,11 +56,11 @@ theme_override_constants/margin_top = 25 theme_override_constants/margin_right = 25 theme_override_constants/margin_bottom = 25 -[node name="VideoSettings" type="GridContainer" parent="MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer"] +[node name="VideoSettings" type="GridContainer" parent="CenterContainer/SettingsTabs/Video/MarginContainer"] layout_mode = 2 columns = 2 -[node name="DisplayModeLabel" type="Label" parent="MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] +[node name="DisplayModeLabel" type="Label" parent="CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] custom_minimum_size = Vector2(400, 40) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) @@ -73,7 +68,7 @@ theme_override_font_sizes/font_size = 20 text = "Display Mode" vertical_alignment = 1 -[node name="DisplayModeOptions" type="OptionButton" parent="MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] +[node name="DisplayModeOptions" type="OptionButton" parent="CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] custom_minimum_size = Vector2(500, 40) layout_mode = 2 size_flags_horizontal = 10 @@ -90,7 +85,7 @@ popup/item_3/id = 3 popup/item_4/text = "Exclusive Full-Screen" popup/item_4/id = 4 -[node name="VSync Label" type="Label" parent="MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] +[node name="VSync Label" type="Label" parent="CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] custom_minimum_size = Vector2(400, 40) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) @@ -99,13 +94,13 @@ text = "VSync " vertical_alignment = 1 -[node name="VsyncButton" type="CheckButton" parent="MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] +[node name="VsyncButton" type="CheckButton" parent="CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] custom_minimum_size = Vector2(500, 40) layout_mode = 2 size_flags_horizontal = 10 text = "Vsync" -[node name="ResolutionsLabel" type="Label" parent="MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] +[node name="ResolutionsLabel" type="Label" parent="CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] custom_minimum_size = Vector2(400, 40) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) @@ -114,19 +109,17 @@ text = "Resolutions " vertical_alignment = 1 -[node name="ResolutionsOptions" type="OptionButton" parent="MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] +[node name="ResolutionsOptions" type="OptionButton" parent="CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings"] custom_minimum_size = Vector2(500, 40) layout_mode = 2 size_flags_horizontal = 10 fit_to_longest_item = false -[node name="Audio" type="VBoxContainer" parent="MainVBox/TabsContainer/SettingsTabs"] +[node name="Audio" type="VBoxContainer" parent="CenterContainer/SettingsTabs"] visible = false layout_mode = 2 -focus_neighbor_left = NodePath("../Video") -focus_neighbor_right = NodePath("../Controls") -[node name="MarginContainer" type="MarginContainer" parent="MainVBox/TabsContainer/SettingsTabs/Audio"] +[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/SettingsTabs/Audio"] custom_minimum_size = Vector2(0, 425) layout_mode = 2 theme_override_constants/margin_left = 25 @@ -134,11 +127,11 @@ theme_override_constants/margin_top = 25 theme_override_constants/margin_right = 25 theme_override_constants/margin_bottom = 25 -[node name="AudioSettings" type="GridContainer" parent="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer"] +[node name="AudioSettings" type="GridContainer" parent="CenterContainer/SettingsTabs/Audio/MarginContainer"] layout_mode = 2 columns = 2 -[node name="MasterVolLabel" type="Label" parent="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] +[node name="MasterVolLabel" type="Label" parent="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] custom_minimum_size = Vector2(400, 40) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) @@ -147,14 +140,14 @@ text = "Master Volume " vertical_alignment = 1 -[node name="MasterVolumeSlider" type="HSlider" parent="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] +[node name="MasterVolumeSlider" type="HSlider" parent="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] custom_minimum_size = Vector2(500, 40) layout_mode = 2 size_flags_horizontal = 10 min_value = -72.0 max_value = 0.0 -[node name="MusicVolLabel" type="Label" parent="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] +[node name="MusicVolLabel" type="Label" parent="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] custom_minimum_size = Vector2(400, 40) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) @@ -163,14 +156,14 @@ text = "Music Volume " vertical_alignment = 1 -[node name="MusicVolSlider" type="HSlider" parent="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] +[node name="MusicVolSlider" type="HSlider" parent="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] custom_minimum_size = Vector2(500, 40) layout_mode = 2 size_flags_horizontal = 10 min_value = -72.0 max_value = 0.0 -[node name="SFXVolLabel" type="Label" parent="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] +[node name="SFXVolLabel" type="Label" parent="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] custom_minimum_size = Vector2(400, 40) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) @@ -178,20 +171,22 @@ theme_override_font_sizes/font_size = 20 text = "SFX Volume" vertical_alignment = 1 -[node name="SFXVolSlider" type="HSlider" parent="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] +[node name="SFXVolSlider" type="HSlider" parent="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings"] custom_minimum_size = Vector2(500, 40) layout_mode = 2 size_flags_horizontal = 10 min_value = -72.0 max_value = 0.0 -[node name="Controls" type="VBoxContainer" parent="MainVBox/TabsContainer/SettingsTabs"] +[node name="Controls" type="VBoxContainer" parent="CenterContainer/SettingsTabs"] visible = false layout_mode = 2 -focus_neighbor_left = NodePath("../Audio") -focus_neighbor_right = NodePath("../Video") -[node name="MarginContainer" type="MarginContainer" parent="MainVBox/TabsContainer/SettingsTabs/Controls"] +[node name="Remap Controller" type="Control" parent="CenterContainer/SettingsTabs/Controls"] +layout_mode = 2 +script = ExtResource("2_2f8ap") + +[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/SettingsTabs/Controls"] custom_minimum_size = Vector2(0, 425) layout_mode = 2 theme_override_constants/margin_left = 25 @@ -199,11 +194,11 @@ theme_override_constants/margin_top = 25 theme_override_constants/margin_right = 25 theme_override_constants/margin_bottom = 25 -[node name="ControlSettings" type="GridContainer" parent="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer"] +[node name="ControlSettings" type="GridContainer" parent="CenterContainer/SettingsTabs/Controls/MarginContainer"] layout_mode = 2 columns = 2 -[node name="MoveUpLabel" type="Label" parent="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] +[node name="MoveUpLabel" type="Label" parent="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] custom_minimum_size = Vector2(400, 40) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) @@ -211,15 +206,16 @@ theme_override_font_sizes/font_size = 20 text = "Move Up" vertical_alignment = 1 -[node name="MoveUpRemapButton" type="Button" parent="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] +[node name="MoveUpRemapButton" type="Button" parent="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings" node_paths=PackedStringArray("remap_controller")] custom_minimum_size = Vector2(500, 40) layout_mode = 2 size_flags_horizontal = 10 toggle_mode = true -script = ExtResource("3_gktg3") +script = ExtResource("2_4asaa") input_action_name = "move_up" +remap_controller = NodePath("../../../Remap Controller") -[node name="MoveLeftLabel" type="Label" parent="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] +[node name="MoveLeftLabel" type="Label" parent="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] custom_minimum_size = Vector2(400, 40) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) @@ -227,15 +223,16 @@ theme_override_font_sizes/font_size = 20 text = "Move Left" vertical_alignment = 1 -[node name="MoveLeftRemapButton" type="Button" parent="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] +[node name="MoveLeftRemapButton" type="Button" parent="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings" node_paths=PackedStringArray("remap_controller")] custom_minimum_size = Vector2(500, 40) layout_mode = 2 size_flags_horizontal = 10 toggle_mode = true -script = ExtResource("3_gktg3") +script = ExtResource("2_4asaa") input_action_name = "move_left" +remap_controller = NodePath("../../../Remap Controller") -[node name="MoveDownLabel" type="Label" parent="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] +[node name="MoveDownLabel" type="Label" parent="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] custom_minimum_size = Vector2(400, 40) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) @@ -243,15 +240,16 @@ theme_override_font_sizes/font_size = 20 text = "Move Down" vertical_alignment = 1 -[node name="MoveDownRemapButton" type="Button" parent="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] +[node name="MoveDownRemapButton" type="Button" parent="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings" node_paths=PackedStringArray("remap_controller")] custom_minimum_size = Vector2(500, 40) layout_mode = 2 size_flags_horizontal = 10 toggle_mode = true -script = ExtResource("3_gktg3") +script = ExtResource("2_4asaa") input_action_name = "move_down" +remap_controller = NodePath("../../../Remap Controller") -[node name="MoveRightLabel" type="Label" parent="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] +[node name="MoveRightLabel" type="Label" parent="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] custom_minimum_size = Vector2(400, 40) layout_mode = 2 theme_override_colors/font_color = Color(0, 0, 0, 1) @@ -259,38 +257,42 @@ theme_override_font_sizes/font_size = 20 text = "Move RIght" vertical_alignment = 1 -[node name="MoveRightRemapButton" type="Button" parent="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings"] +[node name="MoveRightRemapButton" type="Button" parent="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings" node_paths=PackedStringArray("remap_controller")] custom_minimum_size = Vector2(500, 40) layout_mode = 2 size_flags_horizontal = 10 toggle_mode = true -script = ExtResource("3_gktg3") +script = ExtResource("2_4asaa") input_action_name = "move_right" +remap_controller = NodePath("../../../Remap Controller") -[node name="ButtonContainer" type="CenterContainer" parent="MainVBox"] -custom_minimum_size = Vector2(0, 73) -layout_mode = 2 - -[node name="Back" type="Button" parent="MainVBox/ButtonContainer"] +[node name="Back Button" type="Button" parent="."] custom_minimum_size = Vector2(500, 40) -layout_mode = 2 +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -250.0 +offset_top = -80.0 +offset_right = 250.0 +offset_bottom = -40.0 +grow_horizontal = 2 +grow_vertical = 0 theme_override_font_sizes/font_size = 23 text = "Back" -[connection signal="item_selected" from="MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings/DisplayModeOptions" to="." method="_on_display_mode_options_item_selected"] -[connection signal="toggled" from="MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings/VsyncButton" to="." method="_on_vsync_button_toggled"] -[connection signal="item_selected" from="MainVBox/TabsContainer/SettingsTabs/Video/MarginContainer/VideoSettings/ResolutionsOptions" to="." method="_on_resolutions_options_item_selected"] -[connection signal="drag_ended" from="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MasterVolumeSlider" to="." method="_on_master_volume_slider_drag_ended"] -[connection signal="value_changed" from="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MasterVolumeSlider" to="." method="_on_master_volume_slider_value_changed"] -[connection signal="drag_ended" from="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MusicVolSlider" to="." method="_on_music_vol_slider_drag_ended"] -[connection signal="value_changed" from="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MusicVolSlider" to="." method="_on_music_vol_slider_value_changed"] -[connection signal="drag_ended" from="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/SFXVolSlider" to="." method="_on_sfx_vol_slider_drag_ended"] -[connection signal="value_changed" from="MainVBox/TabsContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/SFXVolSlider" to="." method="_on_sfx_vol_slider_value_changed"] -[connection signal="toggled" from="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveUpRemapButton" to="." method="_on_move_up_remap_button_toggled"] -[connection signal="toggled" from="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveUpRemapButton" to="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings" method="_on_move_up_remap_button_toggled"] -[connection signal="toggled" from="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveUpRemapButton" to="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveUpRemapButton" method="_on_toggled"] -[connection signal="toggled" from="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveLeftRemapButton" to="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings" method="_on_move_left_remap_button_toggled"] -[connection signal="toggled" from="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveDownRemapButton" to="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings" method="_on_move_down_remap_button_toggled"] -[connection signal="toggled" from="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveRightRemapButton" to="MainVBox/TabsContainer/SettingsTabs/Controls/MarginContainer/ControlSettings" method="_on_move_right_remap_button_toggled"] -[connection signal="pressed" from="MainVBox/ButtonContainer/Back" to="." method="_on_back_pressed"] -[connection signal="pressed" from="MainVBox/ButtonContainer/Back" to="." method="_on_button_pressed"] +[connection signal="item_selected" from="CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/DisplayModeOptions" to="." method="_on_display_mode_options_item_selected"] +[connection signal="toggled" from="CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/VsyncButton" to="." method="_on_vsync_button_toggled"] +[connection signal="item_selected" from="CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/ResolutionsOptions" to="." method="_on_resolutions_options_item_selected"] +[connection signal="drag_ended" from="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MasterVolumeSlider" to="." method="_on_master_volume_slider_drag_ended"] +[connection signal="value_changed" from="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MasterVolumeSlider" to="." method="_on_master_volume_slider_value_changed"] +[connection signal="drag_ended" from="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MusicVolSlider" to="." method="_on_music_vol_slider_drag_ended"] +[connection signal="value_changed" from="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/MusicVolSlider" to="." method="_on_music_vol_slider_value_changed"] +[connection signal="drag_ended" from="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/SFXVolSlider" to="." method="_on_sfx_vol_slider_drag_ended"] +[connection signal="value_changed" from="CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/SFXVolSlider" to="." method="_on_sfx_vol_slider_value_changed"] +[connection signal="pressed" from="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveUpRemapButton" to="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveUpRemapButton" method="_on_pressed"] +[connection signal="pressed" from="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveLeftRemapButton" to="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveLeftRemapButton" method="_on_pressed"] +[connection signal="pressed" from="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveDownRemapButton" to="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveDownRemapButton" method="_on_pressed"] +[connection signal="pressed" from="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveRightRemapButton" to="CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveRightRemapButton" method="_on_pressed"] +[connection signal="pressed" from="Back Button" to="." method="_on_back_pressed"] diff --git a/Scenes/Main Menu.tscn b/Scenes/Main Menu.tscn index 96333fa..be1520a 100644 --- a/Scenes/Main Menu.tscn +++ b/Scenes/Main Menu.tscn @@ -4,7 +4,7 @@ [ext_resource type="Texture2D" uid="uid://tjxkew3m4v8m" path="res://Assets/Sprites/Easter Egg/Shadow.png" id="2_8o6th"] [ext_resource type="PackedScene" uid="uid://c4btepmue6d7p" path="res://Scenes/Game.tscn" id="2_28004"] [ext_resource type="Texture2D" uid="uid://daat37cyg0go5" path="res://Assets/Sprites/Easter Egg/Egg 3.png" id="3_1e3fe"] -[ext_resource type="PackedScene" uid="uid://bbog8pmtkefhq" path="res://Prefabs/Settings Menu.tscn" id="3_r3r61"] +[ext_resource type="PackedScene" uid="uid://cbfcolm6mjolp" path="res://Prefabs/Settings Menu.tscn" id="3_r3r61"] [ext_resource type="Texture2D" uid="uid://dhvvw4yckl8x7" path="res://Assets/Sprites/Props/Cake.png" id="5_7ull8"] [ext_resource type="Texture2D" uid="uid://c3yg6u8yncau3" path="res://Assets/Sprites/Easter Egg/Egg 2.png" id="6_45o7d"] [ext_resource type="Texture2D" uid="uid://cp84ssaqs3pmp" path="res://Assets/Sprites/UI Elements/Jesus.png" id="6_wnx18"] diff --git a/Scripts/UI/RemapButton.gd b/Scripts/UI/RemapButton.gd deleted file mode 100644 index 570927a..0000000 --- a/Scripts/UI/RemapButton.gd +++ /dev/null @@ -1,29 +0,0 @@ -extends Button - -@export var input_action_name : String - -# Called when the node enters the scene tree for the first timde.d -func _ready(): - set_process_unhandled_key_input(false) - pass - -func _unhandled_key_input(event): - remap_key(event) - pass - -func display_key (): - text = "%s" % InputMap.action_get_events(input_action_name)[0].as_text() - pass - -func remap_key(event): - InputMap.action_erase_events(input_action_name) - InputMap.action_add_event(input_action_name, event) - - text = "%s" % event.as_text() - pass - -func _on_toggled(is_button_pressed): - set_process_unhandled_key_input(is_button_pressed) - if is_button_pressed: text = "..." - else: display_key() - pass diff --git a/Scripts/UI/Remaping/RemapButton.gd b/Scripts/UI/Remaping/RemapButton.gd new file mode 100644 index 0000000..b35bba2 --- /dev/null +++ b/Scripts/UI/Remaping/RemapButton.gd @@ -0,0 +1,15 @@ +extends Button + +@export var input_action_name : String +@export var remap_controller : Node + +func _ready(): + display_key() + +func display_key (): + text = "%s" % InputMap.action_get_events(input_action_name)[0].as_text() + pass + +func _on_pressed(): + remap_controller.start_remap(self, input_action_name) + pass # Replace with function body. diff --git a/Scripts/UI/Remaping/RemapController.gd b/Scripts/UI/Remaping/RemapController.gd new file mode 100644 index 0000000..a75eb2d --- /dev/null +++ b/Scripts/UI/Remaping/RemapController.gd @@ -0,0 +1,34 @@ +extends Control + +var remap_button : Button +var remap_action : String + +func _unhandled_key_input(event): + if remap_button != null and event.pressed: + remap_key(event) + pass + +func _ready(): + set_process_unhandled_key_input(false) + remap_button = null + pass + +func start_remap(button : Button, action : String): + if(remap_button != null): + remap_button.display_key() + remap_button = button + remap_action = action + remap_button.text = "..." + set_process_unhandled_key_input(true) + pass + +func remap_key(event): + print(event) + # Do Actual Rebinding + for key in InputMap.action_get_events(remap_action): + InputMap.action_erase_event(remap_action, key) + InputMap.action_add_event(remap_action, event) + remap_button.display_key() + remap_button = null + set_process_unhandled_key_input(false) + pass