mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-20 21:07:17 +01:00
Now tab containers are also navigable with keys in the menu.
This commit is contained in:
parent
dca4ea1cb4
commit
b3c7c142c5
@ -1,4 +1,3 @@
|
||||
|
||||
extends Control
|
||||
class_name Menu
|
||||
|
||||
|
@ -713,6 +713,26 @@ jump={
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_prev_page={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777244,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_next_page={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777245,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_prev_page_2={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777254,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_next_page_2={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777255,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
@ -63,7 +63,7 @@ Broken Seals
|
||||
|
||||
[wave]LOADING[/wave]
|
||||
[/center]"
|
||||
text = "[center]
|
||||
text = "
|
||||
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ Broken Seals
|
||||
|
||||
|
||||
|
||||
[wave]LOADING[/wave]
|
||||
[/center]"
|
||||
LOADING
|
||||
"
|
||||
|
||||
[node name="DebugInfo" parent="." instance=ExtResource( 5 )]
|
||||
|
60
game/ui/KeyboardTabContainer.gd
Normal file
60
game/ui/KeyboardTabContainer.gd
Normal file
@ -0,0 +1,60 @@
|
||||
extends TabContainer
|
||||
|
||||
# Copyright (c) 2019-2021 Péter Magyar
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
export(NodePath) var focus_control_on_tab_change_path : NodePath
|
||||
|
||||
export(String) var prev_tab_action : String = "ui_prev_page"
|
||||
export(String) var next_tab_action : String = "ui_next_page"
|
||||
|
||||
var _focus_control_on_tab_change : Control = null
|
||||
|
||||
func _ready():
|
||||
_focus_control_on_tab_change = get_node(focus_control_on_tab_change_path) as Control
|
||||
|
||||
connect("visibility_changed", self, "on_visibility_changed")
|
||||
on_visibility_changed()
|
||||
|
||||
func _input(event : InputEvent) -> void:
|
||||
if event.is_action_pressed(next_tab_action, false):
|
||||
var oct : int = current_tab
|
||||
|
||||
current_tab += 1
|
||||
|
||||
if current_tab != oct:
|
||||
_focus_control_on_tab_change.grab_focus()
|
||||
|
||||
get_tree().set_input_as_handled()
|
||||
elif event.is_action_pressed(prev_tab_action, false):
|
||||
var oct : int = current_tab
|
||||
|
||||
current_tab -= 1
|
||||
|
||||
if current_tab != oct:
|
||||
_focus_control_on_tab_change.grab_focus()
|
||||
|
||||
get_tree().set_input_as_handled()
|
||||
|
||||
func on_visibility_changed() -> void:
|
||||
if is_visible_in_tree():
|
||||
set_process_input(true)
|
||||
else:
|
||||
set_process_input(false)
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=9 format=2]
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://ui/about/GodotAuthors.gd" type="Script" id=1]
|
||||
[ext_resource path="res://ui/about/GodotDonors.gd" type="Script" id=2]
|
||||
@ -8,6 +8,7 @@
|
||||
[ext_resource path="res://ui/about/Authors.gd" type="Script" id=6]
|
||||
[ext_resource path="res://ui/about/Third-Party Licenses.gd" type="Script" id=7]
|
||||
[ext_resource path="res://ui/Window.gd" type="Script" id=8]
|
||||
[ext_resource path="res://ui/KeyboardTabContainer.gd" type="Script" id=9]
|
||||
|
||||
[node name="About" type="Control"]
|
||||
anchor_right = 1.0
|
||||
@ -45,6 +46,8 @@ margin_bottom = 431.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tab_align = 0
|
||||
script = ExtResource( 9 )
|
||||
focus_control_on_tab_change_path = NodePath("../Close")
|
||||
|
||||
[node name="Authors" type="ScrollContainer" parent="PanelContainer/VBoxContainer/TabContainer"]
|
||||
anchor_right = 1.0
|
||||
@ -155,6 +158,10 @@ margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 9 )
|
||||
focus_control_on_tab_change_path = NodePath("../../Close")
|
||||
prev_tab_action = "ui_prev_page_2"
|
||||
next_tab_action = "ui_next_page_2"
|
||||
|
||||
[node name="Authors" type="ScrollContainer" parent="PanelContainer/VBoxContainer/TabContainer/Godot"]
|
||||
anchor_right = 1.0
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=9 format=2]
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://ui/theme/ui_theme.tres" type="Theme" id=1]
|
||||
[ext_resource path="res://ui/player_ui/RemoveProfile.gd" type="Script" id=2]
|
||||
@ -8,6 +8,7 @@
|
||||
[ext_resource path="res://ui/options/OptionEnumRow.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://ui/Window.gd" type="Script" id=7]
|
||||
[ext_resource path="res://ui/options/OptionsSpinboxRow.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://ui/KeyboardTabContainer.gd" type="Script" id=9]
|
||||
|
||||
[node name="Options" type="Control"]
|
||||
anchor_right = 1.0
|
||||
@ -45,6 +46,8 @@ margin_bottom = 431.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tab_align = 0
|
||||
script = ExtResource( 9 )
|
||||
focus_control_on_tab_change_path = NodePath("../Close")
|
||||
|
||||
[node name="Video" type="VBoxContainer" parent="PanelContainer/VBoxContainer/TabContainer"]
|
||||
anchor_right = 1.0
|
||||
|
Loading…
Reference in New Issue
Block a user