add game menu
This commit was merged in pull request #19.
This commit is contained in:
23
core/game_menu/game_menu.gd
Normal file
23
core/game_menu/game_menu.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user