update game menu
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
extends Control
|
||||
|
||||
@onready var tabs: Array[GameMenuTab] = [$%Tab1, $%Tab2, $%Tab3]
|
||||
@onready var pages: Array[GameMenuPage] = [$%Page1, $%Page2, $%Page3]
|
||||
var current_index = 0
|
||||
|
||||
func _ready() -> void:
|
||||
for tab: GameMenuTab in tabs:
|
||||
@@ -10,13 +8,12 @@ func _ready() -> void:
|
||||
|
||||
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 page in pages:
|
||||
page.hide_page()
|
||||
|
||||
|
||||
for tab in tabs:
|
||||
if tab.index == index:
|
||||
if disable_animation:
|
||||
@@ -28,10 +25,5 @@ func on_tab_pressed(index: int, disable_animation: bool = false) -> void:
|
||||
tab.deselect_without_animation()
|
||||
else:
|
||||
tab.deselect()
|
||||
|
||||
pages[index].show_page()
|
||||
current_index = index
|
||||
BookAPI.go_to_page((index + 1) * 2)
|
||||
|
||||
func open() -> void:
|
||||
pages[current_index].show_page()
|
||||
BookAPI.go_to_page((index + 1) * 2)
|
||||
|
||||
Reference in New Issue
Block a user