extends Control

@onready var tabs: Array[GameMenuTab] = [$%Tab1, $%Tab2, $%Tab3]
@onready var pages: Array[Control] = [$%Page1, $%Page2, $%Page3]

func _ready() -> void:
	for tab: GameMenuTab in tabs:
		tab.on_tab_selected.connect(_on_tab_pressed)
	
	tabs[0].select_without_animation()
	pages[0].show()

func _on_tab_pressed(index: int):
	for page in pages:
		page.hide()
		
	for tab in tabs:
		if tab.index == index:
			tab.select()
		else:
			tab.deselect()
		
	pages[index].show()
