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)
|
|
|
|
|
pass_to_actor = get_child(current_tab)
|
|
|
|
|
|
|
|
|
|
func _on_tab_changed(tab_id: int):
|
|
|
|
|
var child_has_stage:bool = false
|
|
|
|
|
for child in get_children():
|
|
|
|
|
if "has_stage" in child:
|
|
|
|
|
if child.has_stage:
|
|
|
|
|
child_has_stage = true
|
|
|
|
|
if child_has_stage:
|
2025-10-29 21:37:17 +00:00
|
|
|
State.transition_stage_to(get_child(tab_id))
|
2024-10-07 09:16:18 +00:00
|
|
|
|
|
|
|
|
pass_to_actor = get_child(tab_id)
|
2025-10-07 22:33:15 +00:00
|
|
|
|
|
|
|
|
func _on_stage_left():
|
|
|
|
|
await get_tree().process_frame
|
|
|
|
|
if not pass_to_actor.has_stage:
|
2025-10-29 21:37:17 +00:00
|
|
|
get_parent().vanish()
|