1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-28 18:34:18 +00:00
swear-jar/main.gd

50 lines
895 B
GDScript3
Raw Normal View History

2023-10-01 13:12:00 +00:00
extends Node
2023-10-01 23:12:11 +00:00
class_name Main
@onready var tree: SceneTree = get_tree()
2023-10-02 03:31:31 +00:00
@onready var game_ui: GameUI = $CustomUI/SafeUI/GameUI
@onready var shop_ui: ShopUI = $CustomUI/SafeUI/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
2023-10-01 14:43:21 +00:00
func _on_shop_ui_purchase_begin(_what):
ui_state = UIState.GAME