Fixed version label not translating
This commit is contained in:
parent
49589d84d6
commit
88bbe56467
5 changed files with 20 additions and 12 deletions
|
|
@ -1,7 +1,7 @@
|
|||
key,ru,en,ikg
|
||||
au_loading,Подгружаем данные с сервера…,Loading data from server…,
|
||||
au_err_load,Ошибка загрузки данных: ,Error while loading data: ,
|
||||
au_err_install,Ошибка загрузки новой версии: ,Error while downloading new version: ,
|
||||
au_err_load,[color=red]Ошибка загрузки данных: {error}[/color] ,[color=red]Error while loading data: {error}[/color],
|
||||
au_err_install,[color=red]Ошибка загрузки новой версии: {error}[/color],[color=red]Error while downloading new version: {error}[/color],
|
||||
au_new_version,Доступна новая версия!,New version available!,
|
||||
au_current_version,У вас самая актуальная версия игры!,Your version is the current version!,
|
||||
au_current_version,[color=green]У вас самая актуальная версия игры! [/color],[color=green]Your version is the current version! [/color],
|
||||
vr_version,Текущая версия игры: ,Game version: ,
|
||||
|
|
|
|||
|
Binary file not shown.
Binary file not shown.
|
|
@ -1,10 +1,18 @@
|
|||
extends RichTextLabel
|
||||
|
||||
var status: StringName = "au_loading"
|
||||
var error: int
|
||||
|
||||
func _ready() -> void:
|
||||
AutoUpdate.update_version_text.connect(update_version)
|
||||
update_version(tr("au_loading"))
|
||||
update_version("au_loading")
|
||||
|
||||
|
||||
func update_version(version: StringName):
|
||||
text = tr("vr_version") + preload("res://version.tres").version + "\n" + version
|
||||
func update_version(version: StringName, new_error = -1):
|
||||
status = version
|
||||
error = new_error
|
||||
text = tr("vr_version") + preload("res://version.tres").version + "\n" + tr(version).format({"error":error})
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
if what == NOTIFICATION_TRANSLATION_CHANGED:
|
||||
text = tr("vr_version") + preload("res://version.tres").version + "\n" + tr(status).format({"error":error})
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ var popup_scene: PackedScene = preload("uid://5goo8fyxkv33")
|
|||
var new_version_avaiable: bool
|
||||
var popup: ConfirmationDialog
|
||||
|
||||
signal update_version_text(to: StringName)
|
||||
signal update_version_text(to: StringName,error: int)
|
||||
|
||||
func _ready() -> void:
|
||||
request_completed.connect(on_request_completed)
|
||||
|
|
@ -18,22 +18,22 @@ func _ready() -> void:
|
|||
patch_request.download_file = exec_dir.path_join("chelimbalo.pck")
|
||||
patch_request.request_completed.connect(patch_downloaded)
|
||||
|
||||
update_version_text.emit(tr("au_loading"))
|
||||
update_version_text.emit("au_loading")
|
||||
|
||||
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]" + tr("au_err_load") + str(result) +"[/color]")
|
||||
update_version_text.emit("au_err_load",result)
|
||||
return
|
||||
|
||||
|
||||
var ver_hash = body.get_string_from_ascii().split("\n")[1]
|
||||
if ver_hash != load("res://version.tres").version:
|
||||
update_version_text.emit(tr("au_new_version"))
|
||||
update_version_text.emit("au_new_version")
|
||||
popup.popup_centered()
|
||||
else:
|
||||
update_version_text.emit("[color=green]"+tr("au_current_version")+"[/color]")
|
||||
update_version_text.emit("au_current_version")
|
||||
|
||||
func download_button_pressed() -> void:
|
||||
popup.get_node("HTTPRequest").request("https://2ndbeam.ru/durenije/chelimbalo/release/chelimbalo.pck")
|
||||
|
|
@ -43,4 +43,4 @@ func patch_downloaded(result: int, _response_code: int, _headers: PackedStringAr
|
|||
OS.create_process(OS.get_executable_path(),OS.get_cmdline_args())
|
||||
get_tree().quit()
|
||||
else:
|
||||
update_version_text.emit("[color=red]" + tr("au_err_install") + str(result) +"[/color]")
|
||||
update_version_text.emit("au_err_install",result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue