loading status

This commit is contained in:
Nordup 2024-12-05 11:15:43 +04:00
parent f9d773e940
commit ebd3b049e0
10 changed files with 146 additions and 45 deletions

View file

@ -1,22 +1,21 @@
extends ConfigBase
class_name ConfigGate
const SECTION = "gate"
var title: String
var description: String
var image_url: String
var resource_pack_url: String
var libraries: PackedStringArray
const section = "gate"
const libs_section = "libraries"
func _init(path: String, base_url: String) -> void:
super._init(path)
title = get_string(section, "title")
description = get_string(section, "description")
image_url = Url.join(base_url, get_string(section, "image"))
resource_pack_url = Url.join(base_url, get_string(section, "resource_pack"))
title = get_string(SECTION, "title")
description = get_string(SECTION, "description")
image_url = Url.join(base_url, get_string(SECTION, "image"))
resource_pack_url = Url.join(base_url, get_string(SECTION, "resource_pack"))
libraries = get_libraries(base_url)

View file

@ -1,5 +1,7 @@
extends Node
signal progress(url: String, body_size: int, downloaded_bytes: int)
class DownloadRequest:
var save_path: String
var http: HTTPRequest
@ -11,9 +13,7 @@ class DownloadRequest:
timer = _timer
const DOWNLOAD_FOLDER := "user://gates_data"
const PROGRESS_DELAY := 0.3
signal progress(url: String, body_size: int, downloaded_bytes: int)
const PROGRESS_DELAY := 0.1
var download_requests: Array[DownloadRequest]
@ -97,7 +97,6 @@ func create_request(url: String, save_path: String, timeout: float = 0) -> int:
if err != OK: return err
var code = (await http.request_completed)[1]
progress.emit(url, http.get_body_size(), http.get_downloaded_bytes())
timer.stop()
remove_child(timer)
remove_child(http)