extends CanvasLayer @onready var progress_bar = $Panel/VBoxContainer/ProgressBar @onready var status_label = $Panel/VBoxContainer/StatusLabel @onready var file_label = $Panel/VBoxContainer/FileLabel var debug: bool = false; func _ready(): print("[LoadingScreen] _ready called") # Connect to UpdateManager signals if UpdateManager: UpdateManager.update_check_started.connect(_on_update_check_started) UpdateManager.update_progress.connect(_on_update_progress) UpdateManager.update_completed.connect(_on_update_completed) UpdateManager.update_failed.connect(_on_update_failed) progress_bar.value = 0 func _on_update_check_started(): status_label.text = "Checking for updates..." progress_bar.value = 0 func _on_update_progress(downloaded: int, total: int, current_file: String): if total > 0: progress_bar.value = (float(downloaded) / float(total)) * 100.0 status_label.text = "Downloading assets... (%d/%d)" % [downloaded, total] file_label.text = "This wont take long..."#current_file if debug: file_label.text = current_file else: progress_bar.value = 100.0 status_label.text = "No updates needed" file_label.text = "" func _on_update_completed(updated_count: int): progress_bar.value = 100.0 if updated_count > 0: status_label.text = "Downloaded %d assets" % updated_count else: status_label.text = "All assets up to date" file_label.text = "" # Avoid forcing AUTH when background downloads complete while hidden. if not visible: return # Wait a moment then proceed to auth screen await get_tree().create_timer(0.5).timeout GameState.set_state(0) func _on_update_failed(error: String): status_label.text = "Update failed: " + error file_label.text = "Click to continue anyway" progress_bar.value = 0 # Avoid forcing AUTH when background downloads fail while hidden. if not visible: return # Allow continuing anyway after 2 seconds await get_tree().create_timer(2.0).timeout GameState.set_state(0)