Ui Rebuild and Full Controller Support #59
4 changed files with 69 additions and 2 deletions
|
@ -4,8 +4,13 @@
|
||||||
[ext_resource type="Script" path="res://Scripts/UI/Remaping/RemapController.gd" id="2_2f8ap"]
|
[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"]
|
[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")]
|
[node name="SettingsMenu" type="Node" node_paths=PackedStringArray("back_button", "tab_container", "bottom_item_video", "bottom_item_audio", "bottom_item_controls", "display_options_button", "vsync_toggle", "resolutions_options_button", "master_volume_slider", "music_volume_slider", "sfx_volume_slider")]
|
||||||
script = ExtResource("1_2rgd2")
|
script = ExtResource("1_2rgd2")
|
||||||
|
back_button = NodePath("Back Button")
|
||||||
|
tab_container = NodePath("CenterContainer/SettingsTabs")
|
||||||
|
bottom_item_video = NodePath("CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/ResolutionsOptions")
|
||||||
|
bottom_item_audio = NodePath("CenterContainer/SettingsTabs/Audio/MarginContainer/AudioSettings/SFXVolSlider")
|
||||||
|
bottom_item_controls = NodePath("CenterContainer/SettingsTabs/Controls/MarginContainer/ControlSettings/MoveRightRemapButton")
|
||||||
display_options_button = NodePath("CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/DisplayModeOptions")
|
display_options_button = NodePath("CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/DisplayModeOptions")
|
||||||
vsync_toggle = NodePath("CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/VsyncButton")
|
vsync_toggle = NodePath("CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/VsyncButton")
|
||||||
resolutions_options_button = NodePath("CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/ResolutionsOptions")
|
resolutions_options_button = NodePath("CenterContainer/SettingsTabs/Video/MarginContainer/VideoSettings/ResolutionsOptions")
|
||||||
|
@ -113,6 +118,7 @@ vertical_alignment = 1
|
||||||
custom_minimum_size = Vector2(500, 40)
|
custom_minimum_size = Vector2(500, 40)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 10
|
size_flags_horizontal = 10
|
||||||
|
focus_neighbor_bottom = NodePath("../../../../../../Back Button")
|
||||||
fit_to_longest_item = false
|
fit_to_longest_item = false
|
||||||
|
|
||||||
[node name="Audio" type="VBoxContainer" parent="CenterContainer/SettingsTabs"]
|
[node name="Audio" type="VBoxContainer" parent="CenterContainer/SettingsTabs"]
|
||||||
|
@ -175,6 +181,7 @@ vertical_alignment = 1
|
||||||
custom_minimum_size = Vector2(500, 40)
|
custom_minimum_size = Vector2(500, 40)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 10
|
size_flags_horizontal = 10
|
||||||
|
focus_neighbor_bottom = NodePath("../../../../../../Back Button")
|
||||||
min_value = -72.0
|
min_value = -72.0
|
||||||
max_value = 0.0
|
max_value = 0.0
|
||||||
|
|
||||||
|
@ -261,6 +268,7 @@ vertical_alignment = 1
|
||||||
custom_minimum_size = Vector2(500, 40)
|
custom_minimum_size = Vector2(500, 40)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 10
|
size_flags_horizontal = 10
|
||||||
|
focus_neighbor_bottom = NodePath("../../../../../../Back Button")
|
||||||
toggle_mode = true
|
toggle_mode = true
|
||||||
script = ExtResource("2_4asaa")
|
script = ExtResource("2_4asaa")
|
||||||
input_action_name = "move_right"
|
input_action_name = "move_right"
|
||||||
|
|
|
@ -22,6 +22,7 @@ func _on_play_button_pressed():
|
||||||
|
|
||||||
func _on_settings_button_pressed():
|
func _on_settings_button_pressed():
|
||||||
var settings_scene_instance = load(settings_scene.resource_path).instantiate()
|
var settings_scene_instance = load(settings_scene.resource_path).instantiate()
|
||||||
|
settings_scene_instance.on_back = Callable(func(): default_focus.grab_focus())
|
||||||
get_tree().current_scene.add_child(settings_scene_instance)
|
get_tree().current_scene.add_child(settings_scene_instance)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
# Video Settings UI References
|
# Video Settings UI References
|
||||||
|
@export var back_button : Control
|
||||||
|
@export var tab_container : TabContainer
|
||||||
|
@export var bottom_item_video : Control
|
||||||
|
@export var bottom_item_audio : Control
|
||||||
|
@export var bottom_item_controls : Control
|
||||||
|
|
||||||
@export var display_options_button : OptionButton
|
@export var display_options_button : OptionButton
|
||||||
@export var vsync_toggle : CheckButton
|
@export var vsync_toggle : CheckButton
|
||||||
@export var resolutions_options_button : OptionButton
|
@export var resolutions_options_button : OptionButton
|
||||||
|
|
||||||
|
var on_back : Callable
|
||||||
|
|
||||||
# Audio Settings UI References
|
# Audio Settings UI References
|
||||||
@export var master_volume_slider : Slider
|
@export var master_volume_slider : Slider
|
||||||
@export var music_volume_slider : Slider
|
@export var music_volume_slider : Slider
|
||||||
|
@ -12,6 +20,9 @@ extends Node
|
||||||
|
|
||||||
# Engine Callbacks
|
# Engine Callbacks
|
||||||
func _ready():
|
func _ready():
|
||||||
|
back_button.grab_focus()
|
||||||
|
back_button.focus_neighbor_top = bottom_item_video.get_path()
|
||||||
|
|
||||||
add_resolution_items()
|
add_resolution_items()
|
||||||
display_options_button.select(Save.game_data.display_mode)
|
display_options_button.select(Save.game_data.display_mode)
|
||||||
GlobalSettings.set_display_mode(Save.game_data.display_mode)
|
GlobalSettings.set_display_mode(Save.game_data.display_mode)
|
||||||
|
@ -27,12 +38,36 @@ func _ready():
|
||||||
GlobalSettings.update_sfx_volume(Save.game_data.sfx_volume)
|
GlobalSettings.update_sfx_volume(Save.game_data.sfx_volume)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
update_change_tab()
|
||||||
|
pass
|
||||||
|
|
||||||
|
func update_change_tab():
|
||||||
|
var do_left = Input.is_action_just_pressed("ui_tab_left")
|
||||||
|
var do_right = Input.is_action_just_pressed("ui_tab_right")
|
||||||
|
|
||||||
|
if do_left:
|
||||||
|
var new_rab = tab_container.current_tab - 1
|
||||||
|
tab_container.current_tab = new_rab if new_rab >= 0 else tab_container.get_tab_count() - 1
|
||||||
|
if do_right:
|
||||||
|
var new_rab = tab_container.current_tab + 1
|
||||||
|
tab_container.current_tab = new_rab if new_rab < tab_container.get_tab_count() else 0
|
||||||
|
|
||||||
|
if do_left or do_right:
|
||||||
|
match tab_container.current_tab:
|
||||||
|
0: back_button.focus_neighbor_top = bottom_item_video.get_path()
|
||||||
|
1: back_button.focus_neighbor_top = bottom_item_audio.get_path()
|
||||||
|
2: back_button.focus_neighbor_top = bottom_item_controls.get_path()
|
||||||
|
back_button.grab_focus()
|
||||||
|
pass
|
||||||
|
|
||||||
func add_resolution_items():
|
func add_resolution_items():
|
||||||
for key in GlobalSettings.resolutions_dictionary.keys():
|
for key in GlobalSettings.resolutions_dictionary.keys():
|
||||||
resolutions_options_button.add_item(key)
|
resolutions_options_button.add_item(key)
|
||||||
|
|
||||||
# Other Buttons
|
# Other Buttons
|
||||||
func _on_back_pressed():
|
func _on_back_pressed():
|
||||||
|
on_back.call()
|
||||||
queue_free()
|
queue_free()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,12 @@ ui_accept={
|
||||||
ui_select={
|
ui_select={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"echo":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":true,"script":null)
|
]
|
||||||
|
}
|
||||||
|
ui_cancel={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194305,"physical_keycode":0,"key_label":0,"unicode":4194305,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":true,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
ui_left={
|
ui_left={
|
||||||
|
@ -60,6 +65,7 @@ ui_left={
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":4194319,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194319,"physical_keycode":0,"key_label":0,"unicode":4194319,"echo":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
ui_right={
|
ui_right={
|
||||||
|
@ -67,6 +73,7 @@ ui_right={
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":4194321,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194321,"physical_keycode":0,"key_label":0,"unicode":4194321,"echo":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
ui_up={
|
ui_up={
|
||||||
|
@ -74,6 +81,7 @@ ui_up={
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":4194320,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194320,"physical_keycode":0,"key_label":0,"unicode":4194320,"echo":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
ui_down={
|
ui_down={
|
||||||
|
@ -81,6 +89,7 @@ ui_down={
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":4194322,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194322,"physical_keycode":0,"key_label":0,"unicode":4194322,"echo":false,"script":null)
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
move_left={
|
move_left={
|
||||||
|
@ -157,6 +166,20 @@ aim_down_controller={
|
||||||
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
|
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
ui_tab_left={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ui_tab_right={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":true,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
|
Reference in a new issue