2024-10-07 09:16:18 +00:00
|
|
|
extends TabContainer
|
|
|
|
|
|
|
|
|
|
var pass_to_actor
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
|
for child in get_children():
|
|
|
|
|
if "leave_stage" in child:
|
2025-10-07 22:33:15 +00:00
|
|
|
child.leave_stage.connect(_on_stage_left)
|
2024-10-07 09:16:18 +00:00
|
|
|
tab_changed.connect(_on_tab_changed)
|
2026-01-16 20:26:23 +00:00
|
|
|
|
|
|
|
|
# Initialize the first tab's focus state
|
|
|
|
|
var initial_child = get_child(current_tab)
|
|
|
|
|
if "focused" in initial_child:
|
|
|
|
|
initial_child.focused = true
|
|
|
|
|
pass_to_actor = initial_child
|
2024-10-07 09:16:18 +00:00
|
|
|
|
|
|
|
|
func _on_tab_changed(tab_id: int):
|
2026-01-12 17:39:34 +00:00
|
|
|
# Transfer focused to the new tab's child
|
2024-10-07 09:16:18 +00:00
|
|
|
for child in get_children():
|
2026-01-12 17:39:34 +00:00
|
|
|
if "focused" in child:
|
|
|
|
|
child.focused = false
|
2024-10-07 09:16:18 +00:00
|
|
|
|
2026-01-05 15:28:45 +00:00
|
|
|
var new_child = get_child(tab_id)
|
2026-01-12 17:39:34 +00:00
|
|
|
if "focused" in new_child:
|
|
|
|
|
new_child.focused = true
|
2026-01-05 15:28:45 +00:00
|
|
|
|
|
|
|
|
pass_to_actor = new_child
|
2025-10-07 22:33:15 +00:00
|
|
|
|
|
|
|
|
func _on_stage_left():
|
|
|
|
|
await get_tree().process_frame
|
2026-01-16 20:26:23 +00:00
|
|
|
get_parent().vanish()
|