adding gamepad controls and improving focus handling
This commit is contained in:
parent
4b906e0fe4
commit
61d0c1fb76
|
|
@ -22,12 +22,47 @@ TabContainer/styles/panel = SubResource("StyleBoxEmpty_67ngq")
|
||||||
[sub_resource type="GDScript" id="GDScript_8885d"]
|
[sub_resource type="GDScript" id="GDScript_8885d"]
|
||||||
script/source = "extends TabContainer
|
script/source = "extends TabContainer
|
||||||
|
|
||||||
|
var focus_list: Array
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
for child in get_children():
|
||||||
|
focus_list.append(_find_selectable_in(child))
|
||||||
|
|
||||||
|
func _find_selectable_in(parent:Control):
|
||||||
|
if parent.focus_mode != FOCUS_NONE:
|
||||||
|
return parent
|
||||||
|
if parent.get_child_count() == 0:
|
||||||
|
return self
|
||||||
|
else:
|
||||||
|
for child in parent.get_children():
|
||||||
|
var ret = _find_selectable_in(child)
|
||||||
|
if not ret == self:
|
||||||
|
return ret
|
||||||
|
|
||||||
|
func _unhandled_input(event):
|
||||||
|
|
||||||
|
if event.is_action_type():
|
||||||
|
if event.is_action_pressed(\"ui_left\"): previous()
|
||||||
|
elif event.is_action_pressed(\"ui_right\"): next()
|
||||||
|
|
||||||
func next():
|
func next():
|
||||||
if current_tab < get_tab_count()-1:
|
if current_tab < get_tab_count()-1:
|
||||||
|
if !Input.is_action_just_released(\"mouse_left\"):
|
||||||
|
if not get_viewport().gui_get_focus_owner() == null:
|
||||||
|
focus_list[current_tab] = get_viewport().gui_get_focus_owner()
|
||||||
|
current_tab += 1
|
||||||
|
focus_list[current_tab].grab_focus()
|
||||||
|
else:
|
||||||
current_tab += 1
|
current_tab += 1
|
||||||
|
|
||||||
func previous():
|
func previous():
|
||||||
if current_tab > 0:
|
if current_tab > 0:
|
||||||
|
if !Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
||||||
|
if not get_viewport().gui_get_focus_owner() == null:
|
||||||
|
focus_list[current_tab] = get_viewport().gui_get_focus_owner()
|
||||||
|
current_tab -= 1
|
||||||
|
focus_list[current_tab].grab_focus()
|
||||||
|
else:
|
||||||
current_tab -= 1
|
current_tab -= 1
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
@ -155,20 +190,20 @@ popup/item_1/id = 1
|
||||||
popup/item_2/text = "text and audio"
|
popup/item_2/text = "text and audio"
|
||||||
popup/item_2/id = 2
|
popup/item_2/id = 2
|
||||||
|
|
||||||
[node name="navbuttons" type="HSplitContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility"]
|
[node name="navbuttons" type="VSplitContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 10
|
size_flags_vertical = 10
|
||||||
|
|
||||||
|
[node name="Next" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/navbuttons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "okay"
|
||||||
|
|
||||||
[node name="previous" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/navbuttons"]
|
[node name="previous" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/navbuttons"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
disabled = true
|
disabled = true
|
||||||
text = "go back"
|
text = "go back"
|
||||||
|
|
||||||
[node name="Next" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/navbuttons"]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "okay"
|
|
||||||
|
|
||||||
[node name="Audio Settings" type="VBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer"]
|
[node name="Audio Settings" type="VBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
@ -248,19 +283,19 @@ layout_mode = 2
|
||||||
[node name="Speech" type="HBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings/VBoxContainer"]
|
[node name="Speech" type="HBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="navbuttons" type="HSplitContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings"]
|
[node name="navbuttons" type="VSplitContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 10
|
size_flags_vertical = 10
|
||||||
|
|
||||||
[node name="previous" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings/navbuttons"]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "go back"
|
|
||||||
|
|
||||||
[node name="Next" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings/navbuttons"]
|
[node name="Next" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings/navbuttons"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "okay"
|
text = "okay"
|
||||||
|
|
||||||
|
[node name="previous" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings/navbuttons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "go back"
|
||||||
|
|
||||||
[node name="Content Notes" type="VBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer"]
|
[node name="Content Notes" type="VBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
custom_minimum_size = Vector2(512, 0)
|
custom_minimum_size = Vector2(512, 0)
|
||||||
|
|
@ -276,12 +311,13 @@ layout_mode = 2
|
||||||
text = "I would like to know more."
|
text = "I would like to know more."
|
||||||
|
|
||||||
[node name="ScrollContainer" type="ScrollContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes"]
|
[node name="ScrollContainer" type="ScrollContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes"]
|
||||||
custom_minimum_size = Vector2(0, 512)
|
custom_minimum_size = Vector2(0, 400)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
follow_focus = true
|
follow_focus = true
|
||||||
horizontal_scroll_mode = 0
|
horizontal_scroll_mode = 0
|
||||||
|
|
||||||
[node name="Content Notes" type="VBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/ScrollContainer"]
|
[node name="Content Notes" type="VBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/ScrollContainer"]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
|
@ -368,7 +404,7 @@ layout_mode = 2
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
text = "[ul]
|
text = "[ul]
|
||||||
You can always Pause using Escape or Spacebar
|
You can always Pause using Escape or Spacebar
|
||||||
You can choose to skip scenes that may be difficult for you entirely or to get a neutral description.
|
You can always choose to just get a neutral summary of scenes or skip them entirely
|
||||||
[/ul]"
|
[/ul]"
|
||||||
fit_content = true
|
fit_content = true
|
||||||
|
|
||||||
|
|
@ -380,19 +416,19 @@ text = "show content notes relevant to the current context"
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "prompt me with content notes before playing a scene"
|
text = "prompt me with content notes before playing a scene"
|
||||||
|
|
||||||
[node name="navbuttons" type="HSplitContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes"]
|
[node name="navbuttons" type="VSplitContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 10
|
size_flags_vertical = 10
|
||||||
|
|
||||||
[node name="previous" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/navbuttons"]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "go back"
|
|
||||||
|
|
||||||
[node name="Next" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/navbuttons"]
|
[node name="Next" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/navbuttons"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "okay"
|
text = "okay"
|
||||||
|
|
||||||
|
[node name="previous" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/navbuttons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "go back"
|
||||||
|
|
||||||
[node name="Managing Expectations" type="VBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer"]
|
[node name="Managing Expectations" type="VBoxContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
@ -412,19 +448,19 @@ fit_content = true
|
||||||
custom_minimum_size = Vector2(0, 25)
|
custom_minimum_size = Vector2(0, 25)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="navbuttons" type="HSplitContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Managing Expectations"]
|
[node name="navbuttons" type="VSplitContainer" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Managing Expectations"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 10
|
size_flags_vertical = 10
|
||||||
|
|
||||||
[node name="previous" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Managing Expectations/navbuttons"]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "go back"
|
|
||||||
|
|
||||||
[node name="Next" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Managing Expectations/navbuttons"]
|
[node name="Next" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Managing Expectations/navbuttons"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "okay"
|
text = "okay"
|
||||||
|
|
||||||
|
[node name="previous" type="Button" parent="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Managing Expectations/navbuttons"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "go back"
|
||||||
|
|
||||||
[node name="StartBottom" type="TextureRect" parent="CenterContainer/PanelContainer/VBoxContainer"]
|
[node name="StartBottom" type="TextureRect" parent="CenterContainer/PanelContainer/VBoxContainer"]
|
||||||
custom_minimum_size = Vector2(0, 32)
|
custom_minimum_size = Vector2(0, 32)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
@ -464,13 +500,13 @@ grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
text = "I stream this game, please show content notes."
|
text = "I stream this game, please show content notes."
|
||||||
|
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/navbuttons/previous" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="previous"]
|
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/navbuttons/Next" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="next"]
|
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/navbuttons/Next" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="next"]
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings/navbuttons/previous" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="previous"]
|
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/physical Accessibility/navbuttons/previous" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="previous"]
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings/navbuttons/Next" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="next"]
|
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings/navbuttons/Next" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="next"]
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/show content Notes" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/show content Notes" method="hide"]
|
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Audio Settings/navbuttons/previous" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="previous"]
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/show content Notes" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/ScrollContainer/Content Notes" method="show"]
|
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/show content Notes" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/ScrollContainer/Content Notes" method="show"]
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/navbuttons/previous" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="previous"]
|
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/show content Notes" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/show content Notes" method="set_disabled" binds= [true]]
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/navbuttons/Next" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="next"]
|
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/navbuttons/Next" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="next"]
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Managing Expectations/navbuttons/previous" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="previous"]
|
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Content Notes/navbuttons/previous" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="previous"]
|
||||||
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Managing Expectations/navbuttons/Next" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="next"]
|
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Managing Expectations/navbuttons/Next" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="next"]
|
||||||
|
[connection signal="pressed" from="CenterContainer/PanelContainer/VBoxContainer/TabContainer/Managing Expectations/navbuttons/previous" to="CenterContainer/PanelContainer/VBoxContainer/TabContainer" method="previous"]
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,27 @@ player_backwards={
|
||||||
"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":83,"key_label":0,"unicode":115,"echo":false,"script":null)
|
"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":83,"key_label":0,"unicode":115,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
mouse_left={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"pressed":false,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
look_right={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": []
|
||||||
|
}
|
||||||
|
look_left={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": []
|
||||||
|
}
|
||||||
|
look_up={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": []
|
||||||
|
}
|
||||||
|
look_down={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": []
|
||||||
|
}
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue