2026-01-06 08:12:57 +08:00
|
|
|
extends Node2D
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2026-02-13 20:04:49 +08:00
|
|
|
init_sources()
|
|
|
|
|
init_text()
|
|
|
|
|
|
|
|
|
|
func init_text() -> void:
|
2026-01-06 08:12:57 +08:00
|
|
|
$DataSetting/LineEdit.text = GameManager.data_origin
|
2026-01-06 08:27:35 +08:00
|
|
|
$IPBeginSetting/LineEdit.text = GameManager.ip_begin
|
2026-01-15 20:12:20 +08:00
|
|
|
$UsernameSetting/LineEdit.text = GameManager.username
|
2026-02-13 20:04:49 +08:00
|
|
|
$LoadSource/ChooseSource.select(GameManager.source)
|
|
|
|
|
|
|
|
|
|
func init_sources() -> void:
|
|
|
|
|
DownloadManager.get_sources()
|
|
|
|
|
for source_name in GameManager.sources:
|
2026-02-14 10:24:16 +08:00
|
|
|
$LoadSource/ChooseSource.add_item(source_name)
|
2026-01-06 08:12:57 +08:00
|
|
|
|
|
|
|
|
func _on_save_button_pressed() -> void:
|
|
|
|
|
GameManager.data_origin = $DataSetting/LineEdit.text
|
2026-01-06 08:27:35 +08:00
|
|
|
GameManager.ip_begin = $IPBeginSetting/LineEdit.text
|
2026-01-15 20:12:20 +08:00
|
|
|
GameManager.username = $UsernameSetting/LineEdit.text
|
2026-02-13 20:04:49 +08:00
|
|
|
GameManager.source = $LoadSource/ChooseSource.get_selected()
|
2026-03-31 19:54:11 +08:00
|
|
|
$Tips.text = "提示:保存设置成功"
|
2026-01-06 08:12:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_cancel_button_pressed() -> void:
|
|
|
|
|
SceneManager.goto_scene("main_menu")
|
2026-01-21 08:14:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_download_button_pressed() -> void:
|
2026-01-21 11:42:57 +08:00
|
|
|
$Tips.text = "提示:已开始下载,请勿关闭设置页面"
|
2026-02-13 09:46:27 +08:00
|
|
|
var result: int = await DownloadManager.download_from_origin()
|
2026-01-21 11:42:57 +08:00
|
|
|
if result == 1:
|
|
|
|
|
$Tips.text = "提示:下载失败。数据源路径错误"
|
2026-01-21 11:50:43 +08:00
|
|
|
return
|
|
|
|
|
elif result == 2:
|
|
|
|
|
$Tips.text = "提示:下载失败。创建请求失败"
|
|
|
|
|
return
|
2026-01-21 11:42:57 +08:00
|
|
|
$Tips.text = "提示:正在加载资源,请勿关闭设置页面"
|
|
|
|
|
DownloadManager.load_resource()
|
|
|
|
|
$Tips.text = "提示:完成加载"
|
2026-02-12 23:18:55 +08:00
|
|
|
|
2026-02-13 20:04:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_load_button_pressed() -> void:
|
2026-02-14 12:47:52 +08:00
|
|
|
if GameManager.sources.size() == 0 or GameManager.source == -1:
|
|
|
|
|
$Tips.text = "提示:无本地数据或未选择,无法加载"
|
|
|
|
|
return;
|
2026-02-13 20:04:49 +08:00
|
|
|
DownloadManager.uuid = GameManager.sources[$LoadSource/ChooseSource.text]
|
|
|
|
|
DownloadManager.load_resource()
|
|
|
|
|
$Tips.text = "提示:完成加载"
|