This commit is contained in:
2026-06-12 15:22:57 +08:00
parent ad69c6d733
commit 0b64703422
4 changed files with 21 additions and 6 deletions
@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7ba7c6a75110f483683dc4885aee0758 guid: f8c67570025fefa448706dadc37c5988
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
@@ -44,13 +44,14 @@ namespace SGModule.ConfigLoader
public void CopyStreamingAssetsToPersistentDataPath(Action<bool> onComplete = null) public void CopyStreamingAssetsToPersistentDataPath(Action<bool> onComplete = null)
{ {
Debug.Log("0000000000000000000000000000001");
// 如果目标文件夹不存在,创建它 // 如果目标文件夹不存在,创建它
if (!Directory.Exists(_configFolderPath)) if (!Directory.Exists(_configFolderPath))
{ {
Directory.CreateDirectory(_configFolderPath); Directory.CreateDirectory(_configFolderPath);
} }
Debug.Log("0000000000000000000000000000002");
StartCoroutine(CopyFile(onComplete)); CopyFile(onComplete);
} }
private void HandleInitializationError() 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); // var jsonFileName = Path.GetFileName(jsonLocation.PrimaryKey);
// 加载 JSON 文件 // 加载 JSON 文件
// var textAssetAsync = Addressables.LoadAssetAsync<TextAsset>(jsonLocation); // var textAssetAsync = Addressables.LoadAssetAsync<TextAsset>(jsonLocation);
Debug.Log("0000000000000000000000000000003");
TextAsset[] files = Resources.LoadAll<TextAsset>("Configs"); TextAsset[] files = Resources.LoadAll<TextAsset>("Configs");
// yield return textAssetAsync; // yield return textAssetAsync;
@@ -89,11 +91,10 @@ namespace SGModule.ConfigLoader
string jsonFileName = jsonFile.name; string jsonFileName = jsonFile.name;
Log.ConfigLoader.Info($"Loaded JSON Name:{jsonFileName} content: " + jsonFile.text); Log.ConfigLoader.Info($"Loaded JSON Name:{jsonFileName} content: " + jsonFile.text);
Debug.Log("0000000000000000000000000000001");
var destFilePath = Path.Combine(_configFolderPath, jsonFileName); var destFilePath = Path.Combine(_configFolderPath, jsonFileName);
File.WriteAllBytes(destFilePath, jsonFile.bytes); File.WriteAllBytes(destFilePath, jsonFile.bytes);
onComplete?.Invoke(true); onComplete?.Invoke(true);
yield return null;
// } // }
// else { // else {
// Log.ConfigLoader.Error("Failed to load JSON file"); // Log.ConfigLoader.Error("Failed to load JSON file");
+14
View File
@@ -1,5 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<projectSettings> <projectSettings>
<projectSetting name="com.google.external-dependency-managerAnalyticsCookie" value="500b4bfa68f242ecbf2b37e490522e50" />
<projectSetting name="com.google.external-dependency-managerAnalyticsEnabled" value="True" />
<projectSetting name="Google.IOSResolver.AutoPodToolInstallInEditor" value="False" />
<projectSetting name="Google.IOSResolver.CocoapodsIntegrationMethod" value="2" />
<projectSetting name="Google.IOSResolver.PodfileAddUseFrameworks" value="True" />
<projectSetting name="Google.IOSResolver.PodfileAllowPodsInMultipleTargets" value="True" />
<projectSetting name="Google.IOSResolver.PodfileAlwaysAddMainTarget" value="True" />
<projectSetting name="Google.IOSResolver.PodfileEnabled" value="True" />
<projectSetting name="Google.IOSResolver.PodfileStaticLinkFrameworks" value="True" />
<projectSetting name="Google.IOSResolver.PodToolExecutionViaShellEnabled" value="True" />
<projectSetting name="Google.IOSResolver.PodToolShellExecutionSetLang" value="True" />
<projectSetting name="Google.IOSResolver.SwiftFrameworkSupportWorkaroundEnabled" value="True" />
<projectSetting name="Google.IOSResolver.SwiftLanguageVersion" value="5.0" />
<projectSetting name="Google.IOSResolver.VerboseLoggingEnabled" value="False" />
<projectSetting name="GooglePlayServices.PromptBeforeAutoResolution" value="False" /> <projectSetting name="GooglePlayServices.PromptBeforeAutoResolution" value="False" />
<projectSetting name="GooglePlayServices.UseJetifier" value="True" /> <projectSetting name="GooglePlayServices.UseJetifier" value="True" />
</projectSettings> </projectSettings>