32 lines
699 B
GDScript
32 lines
699 B
GDScript
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)
|
|
|
|
on_tab_pressed(0, true)
|
|
|
|
func on_tab_pressed(index: int, disable_animation: bool = false) -> void:
|
|
for page in pages:
|
|
page.hide()
|
|
|
|
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()
|
|
|
|
func _on_resume_button_on_button_pressed() -> void:
|
|
hide()
|