diff --git a/gui/main_menu/main_menu.tscn b/gui/main_menu/main_menu.tscn index 8341bb1..df841e8 100644 --- a/gui/main_menu/main_menu.tscn +++ b/gui/main_menu/main_menu.tscn @@ -138,7 +138,7 @@ layout_mode = 2 [node name="LabelContainer" type="Control" parent="."] layout_mode = 2 -[node name="Label" type="Label" parent="LabelContainer"] +[node name="Label" type="RichTextLabel" parent="LabelContainer"] top_level = true layout_mode = 1 anchors_preset = 3 @@ -150,6 +150,12 @@ offset_left = -1.0 offset_top = -23.0 grow_horizontal = 0 grow_vertical = 0 +bbcode_enabled = true +fit_content = true +scroll_active = false +autowrap_mode = 0 +horizontal_alignment = 2 +vertical_alignment = 2 script = ExtResource("3_qy2xc") [connection signal="text_changed" from="MainMenu/VBoxContainer/NicknameEdit" to="." method="_on_nickname_edit_text_changed"] diff --git a/gui/main_menu/version_label.gd b/gui/main_menu/version_label.gd index 6d847c2..97199c6 100644 --- a/gui/main_menu/version_label.gd +++ b/gui/main_menu/version_label.gd @@ -1,5 +1,11 @@ -extends Label +extends RichTextLabel func _ready() -> void: - text = "Текущая версия игры: " + preload("res://version.tres").version + AutoUpdate.update_version_text.connect(update_version) + update_version("") + + +func update_version(version: StringName): + text = "Текущая версия игры: " + preload("res://version.tres").version + "\n" + version + print(text) diff --git a/systems/auto_update.gd b/systems/auto_update.gd index 2255f34..b5858e5 100644 --- a/systems/auto_update.gd +++ b/systems/auto_update.gd @@ -5,6 +5,8 @@ var popup_scene: PackedScene = preload("uid://5goo8fyxkv33") var new_version_avaiable: bool var popup: ConfirmationDialog +signal update_version_text(to: StringName) + func _ready() -> void: request_completed.connect(on_request_completed) popup = popup_scene.instantiate() @@ -18,16 +20,22 @@ func _ready() -> void: patch_request.download_file = exec_dir + "chelimbalo.pck" patch_request.request_completed.connect(patch_downloaded) + update_version_text.emit("Подгружаем данные с сервера...") request("https://2ndbeam.ru/durenije/chelimbalo/release/deploy_data") func on_request_completed(result: int, _response_code: int, _headers: PackedStringArray, body: PackedByteArray): if result != OK: + update_version_text.emit("[color=red]Ошибка загрузки данных:" + str(result) +"[/color]") return + var ver_hash = body.get_string_from_ascii().split("\n")[1] if ver_hash != load("res://version.tres").version: + update_version_text.emit("Доступна новая версия!") popup.popup_centered() + else: + update_version_text.emit("[color=green]У вас самая актуальная версия игры![/color]") func download_button_pressed() -> void: popup.get_node("HTTPRequest").request("https://2ndbeam.ru/durenije/chelimbalo/release/chelimbalo.pck") @@ -35,3 +43,5 @@ func download_button_pressed() -> void: func patch_downloaded(result: int, _response_code: int, _headers: PackedStringArray, _body: PackedByteArray) -> void: if result == OK: get_tree().quit() + else: + update_version_text.emit("[color=red]Ошибка загрузки новой версии:" + str(result) +"[/color]")