|
@@ -36,6 +36,8 @@ class Download:
|
|
|
func _init() -> void:
|
|
|
set_process(false)
|
|
|
connect("request_completed", self, "_on_request_completed")
|
|
|
+
|
|
|
+func _ready():
|
|
|
connect("stats_updated", Messenger, "_on_statusUpdate")
|
|
|
|
|
|
func get_stats() -> Download:
|
|
@@ -99,7 +101,7 @@ func download(file, kind):
|
|
|
download._file_name = "user://%s/%s"%[kind, file]
|
|
|
download._current_url = make_filename(kind, file)
|
|
|
download._kind = kind
|
|
|
- downloads[kind][file] = download
|
|
|
+ downloads[kind][download._file_name] = download
|
|
|
|
|
|
func make_filename(kind, file):
|
|
|
return kinds[kind]%file
|
|
@@ -143,6 +145,7 @@ func _on_request_completed(p_result,
|
|
|
_file.close()
|
|
|
emit_signal("file_downloaded", currentDownload)
|
|
|
Messenger._on_file_downloaded(currentDownload)
|
|
|
+ downloading = false
|
|
|
downloads[currentDownload._kind].erase(currentDownload._file_name)
|
|
|
if len(downloads[currentDownload._kind]) == 0:
|
|
|
downloads.erase(currentDownload._kind)
|