revo-jailbreak/objects/hud/options_screen.gd

27 lines
725 B
GDScript

extends Control
export (StyleBox) var tab_selected_style
onready var tabs = $Tabs
func focus():
visible = true
grab_focus()
func _gui_input(event):
if event.is_action_pressed("ui_left"):
tabs.current_tab = posmod(tabs.current_tab - 1, tabs.get_child_count())
elif event.is_action_pressed("ui_right"):
tabs.current_tab = posmod(tabs.current_tab + 1, tabs.get_child_count())
elif event.is_action_pressed("ui_down"):
var current_tab = tabs.get_current_tab_control()
current_tab.get_node(current_tab.focus_neighbour_bottom).grab_focus()
accept_event()
func _on_tabs_focus_entered():
tabs.set("custom_styles/tab_fg", tab_selected_style)
func _on_tabs_focus_exited():
tabs.set("custom_styles/tab_fg", null)