2023-10-01 13:12:00 +00:00
|
|
|
extends Node
|
2023-10-01 23:12:11 +00:00
|
|
|
class_name Main
|
2023-10-01 13:31:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
@onready var tree: SceneTree = get_tree()
|
2023-10-02 13:12:08 +00:00
|
|
|
@onready var game_safe_ui: MarginContainer = $CustomUI/GameSafeUI
|
|
|
|
@onready var game_ui: GameUI = $CustomUI/GameSafeUI/GameUI
|
|
|
|
@onready var shop_safe_ui: MarginContainer = $CustomUI/ShopSafeUI
|
|
|
|
@onready var shop_ui: ShopUI = $CustomUI/ShopSafeUI/ShopUI
|
2023-10-03 23:01:36 +00:00
|
|
|
@onready var score_safe_ui: MarginContainer = $CustomUI/ScoreSafeUI
|
|
|
|
@onready var score_ui: ScoreUI = $CustomUI/ScoreSafeUI/ScoreUI
|
2023-10-01 13:31:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
enum UIState {
|
|
|
|
GAME,
|
|
|
|
SHOP,
|
|
|
|
SCORE,
|
|
|
|
}
|
|
|
|
|
|
|
|
@export var ui_state: UIState:
|
|
|
|
get:
|
|
|
|
return ui_state
|
|
|
|
set(value):
|
|
|
|
match value:
|
|
|
|
UIState.GAME:
|
|
|
|
tree.paused = false
|
2023-10-02 13:12:08 +00:00
|
|
|
game_safe_ui.show()
|
|
|
|
shop_safe_ui.hide()
|
2023-10-03 23:01:36 +00:00
|
|
|
score_safe_ui.hide()
|
2023-10-02 13:12:08 +00:00
|
|
|
shop_safe_ui.process_mode = Node.PROCESS_MODE_DISABLED
|
2023-10-03 23:01:36 +00:00
|
|
|
score_safe_ui.process_mode = Node.PROCESS_MODE_DISABLED
|
2023-10-01 13:31:49 +00:00
|
|
|
UIState.SHOP:
|
|
|
|
tree.paused = true
|
2023-10-02 13:12:08 +00:00
|
|
|
game_safe_ui.hide()
|
|
|
|
shop_safe_ui.show()
|
2023-10-03 23:01:36 +00:00
|
|
|
score_safe_ui.hide()
|
2023-10-02 13:12:08 +00:00
|
|
|
shop_safe_ui.process_mode = Node.PROCESS_MODE_ALWAYS
|
2023-10-03 23:01:36 +00:00
|
|
|
score_safe_ui.process_mode = Node.PROCESS_MODE_DISABLED
|
2023-10-01 13:31:49 +00:00
|
|
|
UIState.SCORE:
|
2023-10-03 23:01:36 +00:00
|
|
|
tree.paused = true
|
|
|
|
game_safe_ui.hide()
|
|
|
|
shop_safe_ui.hide()
|
|
|
|
score_safe_ui.show()
|
|
|
|
shop_safe_ui.process_mode = Node.PROCESS_MODE_DISABLED
|
|
|
|
score_safe_ui.process_mode = Node.PROCESS_MODE_ALWAYS
|
2023-10-01 13:31:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
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_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
|
2023-10-02 18:06:28 +00:00
|
|
|
|
2023-10-02 21:24:01 +00:00
|
|
|
func _on_shop_ui_purchase_cancel(_what):
|
|
|
|
ui_state = UIState.GAME
|
|
|
|
|
2023-10-02 18:06:28 +00:00
|
|
|
func _on_shop_ui_delete_begin():
|
|
|
|
ui_state = UIState.GAME
|
|
|
|
|
|
|
|
func _on_shop_ui_delete_cancel():
|
|
|
|
ui_state = UIState.GAME
|
2023-10-03 23:01:36 +00:00
|
|
|
|
|
|
|
func _on_score_ui_score_button_pressed():
|
|
|
|
ui_state = UIState.GAME
|
|
|
|
|
|
|
|
func _on_score_ui_score_submission_success():
|
|
|
|
ui_state = UIState.GAME
|