update network

This commit is contained in:
2026-02-04 16:31:18 +08:00
parent 4ccf789421
commit 08b0493c06
10 changed files with 203 additions and 22 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
extends Node
class_name Config
## Global configuration for the Tekton Launcher
# itch.io Configuration
+7 -1
View File
@@ -1,6 +1,12 @@
extends Control
## Main launcher scene script - orchestrates all launcher functionality
const Config = preload("config.gd")
const VersionChecker = preload("version_checker.gd")
const DownloadManager = preload("download_manager.gd")
const UpdateApplier = preload("update_applier.gd")
const NewsFetcher = preload("news_fetcher.gd")
# Child nodes (will be set up in _ready)
@onready var version_checker := $VersionChecker as VersionChecker
@onready var download_manager := $DownloadManager as DownloadManager
@@ -36,7 +42,7 @@ func _ready() -> void:
_set_state(LauncherState.CHECKING)
# Start checking for updates
await get_tree().create_timer(0.5).timeout # Small delay for UI to initialize
await get_tree().create_timer(0.5).timeout # Small delay for UI to initialize
version_checker.check_for_updates()
news_fetcher.fetch_news()
+3 -1
View File
@@ -1,5 +1,7 @@
extends Node
class_name NewsFetcher
const Config = preload("config.gd")
## Fetches news/devlog entries from itch.io
signal news_fetched(news_items: Array)
@@ -65,4 +67,4 @@ func _format_changelog(changelog: Array) -> String:
func _sort_by_date(a: Dictionary, b: Dictionary) -> bool:
var date_a: String = a.get("date", "")
var date_b: String = b.get("date", "")
return date_a > date_b # Descending order
return date_a > date_b # Descending order
+2
View File
@@ -1,5 +1,7 @@
extends Node
class_name UpdateApplier
const Config = preload("config.gd")
## Handles applying downloaded updates: backup, replace, rollback
signal update_started
+4 -2
View File
@@ -1,5 +1,7 @@
extends Node
class_name VersionChecker
const Config = preload("config.gd")
## Handles checking for game updates from the version manifest
signal version_check_started
@@ -96,7 +98,7 @@ func _get_changelog_since(since_version: String) -> Array:
func get_download_info() -> Dictionary:
## Returns info needed to download the latest version (platform-specific)
var platform := Config.get_platform_name() # "windows", "linux", or "macos"
var platform := Config.get_platform_name() # "windows", "linux", or "macos"
var releases: Array = manifest_data.get("releases", [])
for release in releases:
@@ -108,7 +110,7 @@ func get_download_info() -> Dictionary:
var checksum_sha256: String = ""
# Check for platform-specific fields
var platform_key := "pck_" + platform # e.g., "pck_windows", "pck_linux", "pck_macos"
var platform_key := "pck_" + platform # e.g., "pck_windows", "pck_linux", "pck_macos"
if release.has(platform_key):
var platform_data: Dictionary = release.get(platform_key, {})
pck_url = platform_data.get("url", "")