extends Control @onready var tabs: Array[GameMenuTab] = [$%Tab1, $%Tab2, $%Tab3] @onready var pages: Array[GameMenuPage] = [$%Page1, $%Page2, $%Page3] func _ready() -> void: for tab: GameMenuTab in tabs: tab.on_tab_selected.connect(on_tab_pressed) on_tab_pressed(0, true) func on_tab_pressed(index: int, disable_animation: bool = false) -> void: for page in pages: page.hide_page() for tab in tabs: if tab.index == index: if disable_animation: tab.select_without_animation() else: tab.select() else: if disable_animation: tab.deselect_without_animation() else: tab.deselect() pages[index].show_page()