浏览代码

more downloader fixes

Malf 2 年之前
父节点
当前提交
569f34f5be
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 1 1
      Main.gd
  2. 4 1
      downloader.gd

+ 1 - 1
Main.gd

@@ -16,7 +16,7 @@ extends Spatial
 
 #var resolution = 512
 var radius = 1737.4*1000
-var startPos = Vector3(0,90,radius)
+var startPos = Vector3(0,354,radius)
 
 #var curlat = 0
 #var curlon = 0

+ 4 - 1
downloader.gd

@@ -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)