2026-01-21 08:14:35 +08:00
|
|
|
extends Node
|
|
|
|
|
|
2026-01-21 11:42:57 +08:00
|
|
|
func download_file(server_path: String, local_path: String) -> void:
|
|
|
|
|
var http = HTTPRequest.new()
|
|
|
|
|
http.download_file = local_path
|
|
|
|
|
http.request(server_path)
|
2026-01-21 08:14:35 +08:00
|
|
|
|
2026-01-21 11:42:57 +08:00
|
|
|
func download_from_origin() -> int:
|
|
|
|
|
var origin = GameManager.data_origin
|
2026-01-21 11:50:43 +08:00
|
|
|
var http = HTTPRequest.new()
|
2026-01-21 08:14:35 +08:00
|
|
|
|
2026-01-21 11:42:57 +08:00
|
|
|
if origin.substr(0, 4) != "http":
|
|
|
|
|
return 1
|
2026-01-21 08:14:35 +08:00
|
|
|
|
2026-01-21 11:50:43 +08:00
|
|
|
if http.request(origin) != OK:
|
|
|
|
|
return 2
|
|
|
|
|
|
|
|
|
|
if origin[-1] != "/":
|
|
|
|
|
origin = origin + "/"
|
2026-01-21 08:14:35 +08:00
|
|
|
|
2026-01-21 11:42:57 +08:00
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
func load_resource():
|
|
|
|
|
pass
|