mirror of
https://github.com/Steffo99/swear-jar.git
synced 2024-11-22 15:44:21 +00:00
49 lines
841 B
GDScript
49 lines
841 B
GDScript
extends Node
|
|
class_name Main
|
|
|
|
|
|
@onready var tree: SceneTree = get_tree()
|
|
@export var game_ui: GameUI
|
|
@export var shop_ui: ShopUI
|
|
|
|
|
|
enum UIState {
|
|
GAME,
|
|
SHOP,
|
|
SCORE,
|
|
}
|
|
|
|
@export var ui_state: UIState:
|
|
get:
|
|
return ui_state
|
|
set(value):
|
|
match value:
|
|
UIState.GAME:
|
|
tree.paused = false
|
|
game_ui.show()
|
|
shop_ui.hide()
|
|
UIState.SHOP:
|
|
tree.paused = true
|
|
game_ui.hide()
|
|
shop_ui.show()
|
|
UIState.SCORE:
|
|
pass
|
|
|
|
|
|
func _on_game_ui_score_button_pressed():
|
|
ui_state = UIState.SCORE
|
|
|
|
func _on_shop_ui_back_button_pressed():
|
|
ui_state = UIState.GAME
|
|
|
|
func _on_shop_ui_delete_button_pressed():
|
|
ui_state = UIState.GAME
|
|
|
|
func _on_shop_ui_score_button_pressed():
|
|
ui_state = UIState.SCORE
|
|
|
|
func _on_game_ui_shop_button_pressed():
|
|
ui_state = UIState.SHOP
|
|
|
|
func _on_shop_ui_purchase_begin(_what):
|
|
ui_state = UIState.GAME
|