extends Node # these two signals come from the MainMenu and start / continue the game # gets sent to the main.gd scene signal on_new_game_started signal on_game_continued @onready var root: CanvasLayer = $/root/Game/UI @onready var main_menu: Control = $/root/Game/UI/MainMenu @onready var ingame_controls: MarginContainer = $/root/Game/UI/IngameControls @onready var ingame_menu: Control = $/root/Game/UI/IngameMenu @onready var camera_control_area : Control = $/root/Game/UI/CameraControlArea @onready var save_ui : Control = $/root/Game/UI/SaveUI func _ready() -> void: main_menu.connect("on_game_continued", _on_main_menu_on_game_continued) main_menu.connect("on_new_game_started", _on_main_menu_on_new_game_started) ingame_controls.connect("menu_button_clicked", _on_ingame_controls_menu_button_clicked) ingame_controls.connect("save_button_clicked", _on_ingame_controls_save_button_clicked) ingame_controls.connect("save_button_released", _on_ingame_controls_save_button_released) ingame_controls.connect("save_timer_incremented", _on_ingame_controls_save_timer_incremented) ingame_controls.connect("save_timer_reached", _on_ingame_controls_save_timer_reached) pass func show_main_menu(p_visible = true) -> void: main_menu.visible = p_visible func show_ingame_controls(p_visible = true) -> void: ingame_controls.visible = p_visible func _on_ingame_controls_menu_button_clicked() -> void: ingame_menu.visible = true # Updates the whole UI func update() -> void: # Updating the player info ingame_menu._update_player_info() # Updating the monster list ingame_menu._update_monster_list() func _on_ingame_controls_save_button_clicked() -> void: save_ui.visible = true func _on_ingame_controls_save_button_released() -> void: save_ui.visible = false func _on_ingame_controls_save_timer_incremented(value) -> void: save_ui.get_node("SavePercentage").text = str(value) func _on_ingame_controls_save_timer_reached() -> void: save_ui.get_node("SavePercentage").text = "Saved!" ingame_controls.disable_save_button() await get_tree().create_timer(1.0).timeout ingame_controls.enable_save_button() save_ui.visible = false save_ui.get_node("SavePercentage").text = "0%" # sends the signal from the MainMenu node up to the main.gd scene func _on_main_menu_on_new_game_started() -> void: on_new_game_started.emit() # sends the signal from the MainMenu node up to the main.gd scene func _on_main_menu_on_game_continued() -> void: on_game_continued.emit()