Files
tgcc/core/game_menu/game_menu.gd
2026-06-30 20:01:13 +00:00

30 lines
612 B
GDScript

extends Control
@onready var tabs: Array[GameMenuTab] = [$%Tab1, $%Tab2, $%Tab3]
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:
if BookAPI.is_busy() and not disable_animation:
return
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()
BookAPI.go_to_page((index + 1) * 2)