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-04-01 09:25:22 +08:00
|
|
|
TranslationServer.set_locale($ChooseLanguage/ChooseLanguage.text)
|
|
|
|
|
$Tips.text = "SETTINGS_TIP_SAVESETTINGS"
|
2026-01-06 08:12:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_cancel_button_pressed() -> void:
|
2026-04-02 09:15:43 +08:00
|
|
|
SceneManager.goto_scene("menus/main_menu")
|
2026-01-21 08:14:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_download_button_pressed() -> void:
|
2026-04-01 09:25:22 +08:00
|
|
|
$Tips.text = "SETTINGS_TIP_STARTDOWNLOAD"
|
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:
|
2026-04-01 09:25:22 +08:00
|
|
|
$Tips.text = "SETTINGS_TIP_SOURCEERROR"
|
2026-01-21 11:50:43 +08:00
|
|
|
return
|
|
|
|
|
elif result == 2:
|
2026-04-01 09:25:22 +08:00
|
|
|
$Tips.text = "SETTINGS_TIP_REQUESTERROR"
|
2026-01-21 11:50:43 +08:00
|
|
|
return
|
2026-04-01 09:25:22 +08:00
|
|
|
$Tips.text = "SETTINGS_TIP_LOADING"
|
2026-01-21 11:42:57 +08:00
|
|
|
DownloadManager.load_resource()
|
2026-04-01 09:25:22 +08:00
|
|
|
$Tips.text = "SETTINGS_TIP_LOADED"
|
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:
|
2026-04-01 09:25:22 +08:00
|
|
|
$Tips.text = "SETTINGS_TIP_NOLOCALSOURCE"
|
2026-02-14 12:47:52 +08:00
|
|
|
return;
|
2026-02-13 20:04:49 +08:00
|
|
|
DownloadManager.uuid = GameManager.sources[$LoadSource/ChooseSource.text]
|
|
|
|
|
DownloadManager.load_resource()
|
2026-04-01 09:25:22 +08:00
|
|
|
$Tips.text = "SETTINGS_TIP_LOADED"
|