diff --git a/README.md b/README.md index acfb067..9203525 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Circle Shot Launcher -Исходный код лаунчера Circle Shot. Исходный код самой игры находится [здесь](https://github.com/Diamond-Studio-GAMES/circle-shot). +Исходный код лаунчера Circle Shot. Исходный код самой игры находится [здесь](https://github.com/DiamondStudioGAMES/circle-shot). +Если хотите помочь проекту, обратитесь к [этому документу](https://github.com/DiamondStudioGAMES/circle-shot/blob/master/docs/CONTRIBUTING.md). +Некоторые инструкции, специфичные для лаунчера, доступны для ознакомления в папке `docs`. -Версия Godot: 4.4.dev3+ +Версия Godot: 4.4.dev4+ diff --git a/docs/CONFIGURING_SERVER.md b/docs/configuring_server.md similarity index 100% rename from docs/CONFIGURING_SERVER.md rename to docs/configuring_server.md diff --git a/docs/CREATING_ZIP_VERSION.md b/docs/creating_zip_version.md similarity index 100% rename from docs/CREATING_ZIP_VERSION.md rename to docs/creating_zip_version.md diff --git a/downloader/downloader.gd b/downloader/downloader.gd index 532d47a..d5779c7 100644 --- a/downloader/downloader.gd +++ b/downloader/downloader.gd @@ -6,7 +6,8 @@ enum Status { IDLE = 0, DOWNLOADING_ENGINE = 1, DOWNLOADING_PACK = 2, - UNZIPPING = 3, + UNZIPPING_PACK = 3, + UNZIPPING_ENGINE = 4, } var status := Status.IDLE @@ -48,9 +49,12 @@ func _process(_delta: float) -> void: else: _progress_bar.value = 0.0 _status_label.text = "Скачиваю ресурсы..." - Status.UNZIPPING: + Status.UNZIPPING_PACK: _progress_bar.value = 1.0 - _status_label.text = "Распаковка файлов..." + _status_label.text = "Распаковка ресурсов..." + Status.UNZIPPING_ENGINE: + _progress_bar.value = 1.0 + _status_label.text = "Распаковка движка..." func download_version(version_code: String, engine_version: String) -> void: @@ -82,7 +86,7 @@ func _download_engine() -> void: ] engine_name = engine_name.to_lower() var url: String = _launcher.get_server_url().path_join("engines").path_join(engine_name) - print("Downloading engine from %s" % url) + print("Downloading engine from %s..." % url) status = Status.DOWNLOADING_ENGINE var err: Error = _engine_http.request(url) if err != OK: @@ -99,7 +103,7 @@ func _download_pack() -> void: ] pack_name = pack_name.to_lower() var url: String = _launcher.get_server_url().path_join("packs").path_join(pack_name) - print("Downloading pack from %s" % url) + print("Downloading pack from %s..." % url) status = Status.DOWNLOADING_PACK var err: Error = _pack_http.request(url) if err != OK: @@ -109,9 +113,10 @@ func _download_pack() -> void: func _unzip_and_install() -> void: - status = Status.UNZIPPING + status = Status.UNZIPPING_PACK await get_tree().process_frame await get_tree().process_frame + var zip := ZIPReader.new() var err: Error = zip.open(_launcher.data_path.path_join("tmp.pack.zip")) @@ -141,6 +146,9 @@ func _unzip_and_install() -> void: zip.close() if FileAccess.file_exists(_launcher.data_path.path_join("tmp.engine.zip")): + status = Status.UNZIPPING_ENGINE + await get_tree().process_frame + err = zip.open(_launcher.data_path.path_join("tmp.engine.zip")) if err != OK: push_error("Error unzipping tmp.engine.zip: %s." % error_string(err)) diff --git a/export_presets.cfg b/export_presets.cfg index aeec59e..664971f 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -9,7 +9,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="*.md, *.ico" -export_path="../../../../../media/ADATA HDD330/Проекты/Circle Shot/Launcher/circle_shot_launcher_v1.0.0-linux.x86_64" +export_path="../../../../../media/ADATA HDD330/Проекты/Circle Shot/Launcher/circle_shot_launcher_v1.0.1-linux.x86_64" patches=PackedStringArray() encryption_include_filters="" encryption_exclude_filters="" @@ -50,7 +50,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="*.md" -export_path="../../../../../media/ADATA HDD330/Проекты/Circle Shot/Launcher/circle_shot_launcher_v1.0.0-windows.x86_64.exe" +export_path="../../../../../media/ADATA HDD330/Проекты/Circle Shot/Launcher/circle_shot_launcher_v1.0.1-windows.x86_64.exe" patches=PackedStringArray() encryption_include_filters="" encryption_exclude_filters="" diff --git a/launcher/launcher.gd b/launcher/launcher.gd index 660964e..766be50 100644 --- a/launcher/launcher.gd +++ b/launcher/launcher.gd @@ -77,13 +77,13 @@ func list_local_versions() -> void: if versions_file.get_value(version_code, "beta"): version_name += " (БЕТА)" (version_node.get_node(^"%VersionName") as Label).text = version_name - (version_node.get_node(^"%Run") as Button).pressed.connect( + (version_node.get_node(^"%Run") as BaseButton).pressed.connect( run_version.bind(version_code) ) - (version_node.get_node(^"%Export") as Button).pressed.connect( + (version_node.get_node(^"%Export") as BaseButton).pressed.connect( export_version.bind(version_code) ) - (version_node.get_node(^"%Remove") as Button).pressed.connect( + (version_node.get_node(^"%Remove") as BaseButton).pressed.connect( remove_version.bind(version_code) ) version_nodes.append(version_node) @@ -125,7 +125,7 @@ func run_version(version_code: String) -> void: arguments.append(i) var pid: int = OS.create_process(executable_path, arguments) if pid == -1: - push_error("Can't start game with executable path %s and pack path %s!" % [ + push_error("Run: can't start executable at path %s with pack at path %s!" % [ executable_path, pack_path ]) @@ -177,7 +177,7 @@ func show_update(version_code: String, engine_version: String, beta: bool) -> vo func get_server_url() -> String: - return settings_file.get_value("settings", "server") + return settings_file.get_value("settings", "server_url") func get_version_engine_path(version_code: String, engine_version := "") -> String: @@ -202,7 +202,7 @@ func _export_version(path: String, version_code: String) -> void: return print("Exporting to %s." % path) - _status.text = "Выполняется экспорт..." + _status.text = "Экспорт: создание архива..." ($MouseBlock as CanvasItem).show() await get_tree().process_frame await get_tree().process_frame @@ -210,8 +210,8 @@ func _export_version(path: String, version_code: String) -> void: var zip := ZIPPacker.new() var err: Error = zip.open(path) if err != OK: - _status.text = "Ошибка создания ZIP-файла!" - push_error("Creating ZIP failed with error %s." % error_string(err)) + _status.text = "Экспорт: ошибка создания ZIP-файла!" + push_error("Export: creating ZIP failed with error %s." % error_string(err)) _reset_status_timer.start() ($MouseBlock as CanvasItem).hide() return @@ -229,10 +229,16 @@ func _export_version(path: String, version_code: String) -> void: zip.write_file(config.encode_to_text().to_utf8_buffer()) zip.close_file() + _status.text = "Экспорт: сжатие движка..." + await get_tree().process_frame + zip.start_file("engine") zip.write_file(FileAccess.get_file_as_bytes(get_version_engine_path(version_code))) zip.close_file() + _status.text = "Экспорт: сжатие ресурсов..." + await get_tree().process_frame + zip.start_file("pack") zip.write_file(FileAccess.get_file_as_bytes(get_version_pack_path(version_code))) zip.close_file() @@ -247,7 +253,7 @@ func _export_version(path: String, version_code: String) -> void: func _import_version(path: String) -> void: print("Importing from %s." % path) - _status.text = "Выполняется импорт..." + _status.text = "Импорт: открытие архива..." ($MouseBlock as CanvasItem).show() await get_tree().process_frame await get_tree().process_frame @@ -255,7 +261,8 @@ func _import_version(path: String) -> void: var zip := ZIPReader.new() var err: Error = zip.open(path) if err != OK: - _status.text = "Ошибка открытия ZIP-файла!" + push_error("Import: can't open ZIP file. Error: %s." % error_string(err)) + _status.text = "Импорт: ошибка открытия ZIP-файла!" _reset_status_timer.start() ($MouseBlock as CanvasItem).hide() return @@ -265,8 +272,8 @@ func _import_version(path: String) -> void: and zip.file_exists("pack") and zip.file_exists("version.cfg") ): - _status.text = "В этом ZIP-файле нет нужных файлов." - push_error("ZIP file is missing some files (engine, pack, versions.cfg)") + _status.text = "Импорт: в ZIP-файле нет нужных файлов." + push_error("Import: ZIP file is missing some files (engine, pack, versions.cfg)") _reset_status_timer.start() ($MouseBlock as CanvasItem).hide() return @@ -274,8 +281,8 @@ func _import_version(path: String) -> void: var config := ConfigFile.new() err = config.parse(zip.read_file("version.cfg").get_string_from_utf8()) if err != OK: - _status.text = "Не могу открыть файл конфигурации в этом архиве!" - push_error("versions.cfg can't be parsed.") + _status.text = "Импорт: не могу открыть файл конфигурации в этом архиве!" + push_error("Import: versions.cfg can't be parsed.") _reset_status_timer.start() ($MouseBlock as CanvasItem).hide() return @@ -294,8 +301,8 @@ func _import_version(path: String) -> void: and config.has_section_key("config", "beta") and typeof(config.get_value("config", "beta")) == TYPE_BOOL ): - _status.text = "Файл конфигурации в этом архиве содержит не всю информацию!" - push_error("versions.cfg don't have all needed information.") + _status.text = "Импорт: файл конфигурации в этом архиве содержит не всю информацию!" + push_error("Import: versions.cfg don't have all needed information.") _reset_status_timer.start() ($MouseBlock as CanvasItem).hide() return @@ -304,15 +311,17 @@ func _import_version(path: String) -> void: var engine_version: String = config.get_value("config", "engine_version") if new_version_code in versions_file.get_sections(): - _status.text = "Эта версия (%s) уже установлена!" % _get_version_name(new_version_code) - push_error("This version (%s) is already installed." % _get_version_name(new_version_code)) + _status.text = "Импорт: эта версия (%s) уже установлена!" \ + % _get_version_name(new_version_code) + push_error("Import: this version (%s) is already installed." \ + % _get_version_name(new_version_code)) _reset_status_timer.start() ($MouseBlock as CanvasItem).hide() return if config.get_value("config", "platform") != OS.get_name(): - _status.text = "Эта версия несовместима с вашей операционной системой!" - push_error("Incompatible platforms.") + _status.text = "Импорт: эта версия несовместима с вашей операционной системой!" + push_error("Import: incompatible platforms.") _reset_status_timer.start() ($MouseBlock as CanvasItem).hide() return @@ -325,17 +334,20 @@ func _import_version(path: String) -> void: if not engine_already_installed \ and config.get_value("config", "arch") != Engine.get_architecture_name(): - _status.text = "Эта версия несовместима с вашей архитектурой процессора!" - push_error("Engine this needed version not found. Engine in archive uses different arch.") + _status.text = "Импорт: эта версия несовместима с вашей архитектурой процессора!" + push_error("Import: engine in archive uses different arch.") _reset_status_timer.start() ($MouseBlock as CanvasItem).hide() return # Всё наконец-то ОК, распаковываем! + _status.text = "Импорт: распаковка ресурсов..." + await get_tree().process_frame + var pack_file := FileAccess.open(get_version_pack_path(new_version_code), FileAccess.WRITE) if not pack_file: - _status.text = "Ошибка распаковки файла с ресурсами!" - push_error("Error creating pack file at path %s. Error: %s" % [ + _status.text = "Импорт: ошибка распаковки файла с ресурсами!" + push_error("Import: error creating pack file at path %s. Error: %s" % [ get_version_pack_path(new_version_code), error_string(FileAccess.get_open_error()) ]) @@ -346,12 +358,14 @@ func _import_version(path: String) -> void: pack_file.close() if not engine_already_installed: + _status.text = "Импорт: распаковка движка..." + await get_tree().process_frame var engine_file := FileAccess.open( get_version_engine_path("", engine_version), FileAccess.WRITE ) if not engine_file: - _status.text = "Ошибка распаковки файла движка!" - push_error("Error creating engine file at path %s. Error: %s" % [ + _status.text = "Импорт: ошибка распаковки файла движка!" + push_error("Import: error creating engine file at path %s. Error: %s" % [ get_version_engine_path("", engine_version), error_string(FileAccess.get_open_error()) ]) @@ -382,6 +396,7 @@ func _remove_version(version_code: String, show_message := false) -> void: for section: String in versions_file.get_sections(): if version_code == section: continue + # есть значения по умолчанию так как versions.cfg может быть некорректным if versions_file.get_value(version_code, "engine_version", "-1.0") == \ versions_file.get_value(section, "engine_version", "-2.0"): delete_engine = false diff --git a/misc/boot_splash.png b/misc/boot_splash.png index 7fa2026..b1dbe18 100644 Binary files a/misc/boot_splash.png and b/misc/boot_splash.png differ diff --git a/misc/icon.png b/misc/icon.png index 7b4fe93..310cef9 100644 Binary files a/misc/icon.png and b/misc/icon.png differ diff --git a/misc/windows_icon.ico b/misc/windows_icon.ico index 094e026..312d710 100644 Binary files a/misc/windows_icon.ico and b/misc/windows_icon.ico differ diff --git a/project.godot b/project.godot index 0fedd2d..ffdffca 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="Circle Shot Launcher" -config/version="1.0.0.0" +config/version="1.0.1" run/main_scene="res://launcher/launcher.tscn" config/use_custom_user_dir=true config/custom_user_dir_name="circle-shot-launcher" diff --git a/remote_manager/remote_manager.gd b/remote_manager/remote_manager.gd index f84bead..618e9bd 100644 --- a/remote_manager/remote_manager.gd +++ b/remote_manager/remote_manager.gd @@ -48,12 +48,12 @@ func list_remote_versions() -> void: var editions: Array = remote_engine_versions.get_value(engine_version, "editions") if my_edition in editions: supported_engines.append(engine_version) - prints("Supported remote engines:", supported_engines) + print("Supported remote engines: ", supported_engines, '.') var installed_engines: Array[String] for version_code: String in _launcher.versions_file.get_sections(): installed_engines.append(_launcher.versions_file.get_value(version_code, "engine_version")) - prints("Installed engines:", supported_engines) + print("Installed engines: ", supported_engines, '.') var version_nodes: Array[Node] var highest_version: int = -1 @@ -150,10 +150,14 @@ func _on_versions_http_request_request_completed(result: HTTPRequest.Result, response_code: HTTPClient.ResponseCode, _headers: PackedStringArray, body: PackedByteArray) -> void: if result != HTTPRequest.RESULT_SUCCESS: + _status.text = "Ошибка скачивания списка версий! Код ошибки: %d" % result push_error("Get versions: result (%d) is not Success!" % result) + _update_button.disabled = false return if response_code != HTTPClient.RESPONSE_OK: + _status.text = "Ошибка скачивания списка версий! Код ошибки: %d" % response_code push_error("Get versions: response code (%d) is not 200!" % response_code) + _update_button.disabled = false return var err: Error = remote_versions.parse(body.get_string_from_utf8()) @@ -192,10 +196,14 @@ func _on_engine_versions_http_request_request_completed(result: HTTPRequest.Resu response_code: HTTPClient.ResponseCode, _headers: PackedStringArray, body: PackedByteArray) -> void: if result != HTTPRequest.RESULT_SUCCESS: + _status.text = "Ошибка скачивания списка версий движка! Код ошибки: %d" % result push_error("Get engine versions: result (%d) is not Success!" % result) + _update_button.disabled = false return if response_code != HTTPClient.RESPONSE_OK: + _status.text = "Ошибка скачивания списка версий движка! Код ошибки: %d" % response_code push_error("Get engine versions: response code (%d) is not 200!" % response_code) + _update_button.disabled = false return var err: Error = remote_engine_versions.parse(body.get_string_from_utf8()) diff --git a/settings/settings.gd b/settings/settings.gd index a19bc06..09550d4 100644 --- a/settings/settings.gd +++ b/settings/settings.gd @@ -2,7 +2,7 @@ class_name Settings extends Window const DEFAULT_ARGUMENTS := "--disable-update-check" -const DEFAULT_SERVER := "https://diamond-studio-games.github.io/circle-shot" +const DEFAULT_SERVER := "https://diamondstudiogames.github.io/circle-shot" @onready var _launcher: Launcher = get_parent() func _ready() -> void: @@ -19,9 +19,9 @@ func _ready() -> void: var arguments: String = \ _launcher.settings_file.get_value("settings", "arguments", DEFAULT_ARGUMENTS) - var server: String = _launcher.settings_file.get_value("settings", "server", DEFAULT_SERVER) + var server: String = _launcher.settings_file.get_value("settings", "server_url", DEFAULT_SERVER) _launcher.settings_file.set_value("settings", "arguments", arguments) - _launcher.settings_file.set_value("settings", "server", server) + _launcher.settings_file.set_value("settings", "server_url", server) (%ArgumentsEdit as LineEdit).text = arguments (%ServerEdit as LineEdit).text = server @@ -58,7 +58,7 @@ func _on_arguments_edit_text_changed(new_text: String) -> void: func _on_server_edit_text_changed(new_text: String) -> void: - _launcher.settings_file.set_value("settings", "server", new_text) + _launcher.settings_file.set_value("settings", "server_url", new_text) _launcher.save_files()