parent
4031e1384f
commit
72319b04ac
1 changed files with 6 additions and 6 deletions
|
|
@ -4,7 +4,6 @@ var popup_scene: PackedScene = preload("uid://5goo8fyxkv33")
|
|||
|
||||
var new_version_avaiable: bool
|
||||
var popup: ConfirmationDialog
|
||||
var pack_file: String
|
||||
|
||||
signal update_version_text(to: StringName)
|
||||
|
||||
|
|
@ -15,9 +14,10 @@ func _ready() -> void:
|
|||
|
||||
popup.confirmed.connect(download_button_pressed)
|
||||
var patch_request: HTTPRequest = popup.get_node("HTTPRequest")
|
||||
var exec_dir = OS.get_executable_path().get_base_dir()
|
||||
pack_file = exec_dir.path_join("chelimbalo.pck")
|
||||
patch_request.download_file = pack_file
|
||||
var exec_path = OS.get_executable_path()
|
||||
var splitted = exec_path.split("/")
|
||||
var exec_dir = exec_path.replace(splitted[len(splitted)-1],"")
|
||||
patch_request.download_file = exec_dir + "chelimbalo.pck"
|
||||
patch_request.request_completed.connect(patch_downloaded)
|
||||
|
||||
update_version_text.emit("Подгружаем данные с сервера...")
|
||||
|
|
@ -42,7 +42,7 @@ func download_button_pressed() -> void:
|
|||
|
||||
func patch_downloaded(result: int, _response_code: int, _headers: PackedStringArray, _body: PackedByteArray) -> void:
|
||||
if result == OK:
|
||||
ProjectSettings.load_resource_pack(pack_file)
|
||||
get_tree().reload_current_scene()
|
||||
OS.create_process(OS.get_executable_path(),OS.get_cmdline_args())
|
||||
get_tree().quit()
|
||||
else:
|
||||
update_version_text.emit("[color=red]Ошибка загрузки новой версии:" + str(result) +"[/color]")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue