提交
This commit is contained in:
@@ -44,13 +44,14 @@ namespace SGModule.ConfigLoader
|
||||
|
||||
public void CopyStreamingAssetsToPersistentDataPath(Action<bool> onComplete = null)
|
||||
{
|
||||
Debug.Log("0000000000000000000000000000001");
|
||||
// 如果目标文件夹不存在,创建它
|
||||
if (!Directory.Exists(_configFolderPath))
|
||||
{
|
||||
Directory.CreateDirectory(_configFolderPath);
|
||||
}
|
||||
|
||||
StartCoroutine(CopyFile(onComplete));
|
||||
Debug.Log("0000000000000000000000000000002");
|
||||
CopyFile(onComplete);
|
||||
}
|
||||
|
||||
private void HandleInitializationError()
|
||||
@@ -68,7 +69,7 @@ namespace SGModule.ConfigLoader
|
||||
// 比如:显示弹窗或退出程序
|
||||
}
|
||||
|
||||
private IEnumerator CopyFile(Action<bool> onComplete = null)
|
||||
private void CopyFile(Action<bool> onComplete = null)
|
||||
{
|
||||
|
||||
|
||||
@@ -80,6 +81,7 @@ namespace SGModule.ConfigLoader
|
||||
// var jsonFileName = Path.GetFileName(jsonLocation.PrimaryKey);
|
||||
// 加载 JSON 文件
|
||||
// var textAssetAsync = Addressables.LoadAssetAsync<TextAsset>(jsonLocation);
|
||||
Debug.Log("0000000000000000000000000000003");
|
||||
TextAsset[] files = Resources.LoadAll<TextAsset>("Configs");
|
||||
// yield return textAssetAsync;
|
||||
|
||||
@@ -89,11 +91,10 @@ namespace SGModule.ConfigLoader
|
||||
string jsonFileName = jsonFile.name;
|
||||
Log.ConfigLoader.Info($"Loaded JSON Name:{jsonFileName} content: " + jsonFile.text);
|
||||
|
||||
|
||||
Debug.Log("0000000000000000000000000000001");
|
||||
var destFilePath = Path.Combine(_configFolderPath, jsonFileName);
|
||||
File.WriteAllBytes(destFilePath, jsonFile.bytes);
|
||||
onComplete?.Invoke(true);
|
||||
yield return null;
|
||||
// }
|
||||
// else {
|
||||
// Log.ConfigLoader.Error("Failed to load JSON file");
|
||||
|
||||
Reference in New Issue
Block a user