feat: 实现下载检查功能
This commit is contained in:
@@ -7,11 +7,16 @@ func download_file(server_path: String, local_path: String) -> void:
|
||||
|
||||
func download_from_origin() -> int:
|
||||
var origin = GameManager.data_origin
|
||||
var http = HTTPRequest.new()
|
||||
|
||||
if origin.substr(0, 4) != "http":
|
||||
return 1
|
||||
|
||||
|
||||
if http.request(origin) != OK:
|
||||
return 2
|
||||
|
||||
if origin[-1] != "/":
|
||||
origin = origin + "/"
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ func _on_download_button_pressed() -> void:
|
||||
var result: int = DownloadManager.download_from_origin()
|
||||
if result == 1:
|
||||
$Tips.text = "提示:下载失败。数据源路径错误"
|
||||
return
|
||||
elif result == 2:
|
||||
$Tips.text = "提示:下载失败。创建请求失败"
|
||||
return
|
||||
$Tips.text = "提示:正在加载资源,请勿关闭设置页面"
|
||||
DownloadManager.load_resource()
|
||||
$Tips.text = "提示:完成加载"
|
||||
|
||||
Reference in New Issue
Block a user