更新小组件SDK

This commit is contained in:
玉峰 2025-10-16 10:35:37 +08:00
parent dd15489b43
commit a38a9ef29e
1 changed files with 11 additions and 3 deletions

View File

@ -52,7 +52,7 @@ namespace EFSDK
if (File.Exists(aarPath)) File.Delete(aarPath);
IOCompression.ZipFile.CreateFromDirectory(TempDir, aarPath, IOCompression.CompressionLevel.Optimal, false);
Debug.Log($"✅ AAR built: {aarPath}");
Debug.Log($"✅ AAR built:"+aarPath);
// 生成压缩 JSON (key 只保留文件名)
Dictionary<string, string> simpleMapping = new Dictionary<string, string>();
@ -68,6 +68,7 @@ namespace EFSDK
// 映射文件
string mappingPath = Path.Combine(TempDir, "res_mapping.json");
File.WriteAllText(mappingPath, mappingJson);
Debug.Log($"✅ AAR 资源文件构建成功! mappingJson:"+mappingJson);
// 清理临时目录
Directory.Delete(TempDir, true);
@ -95,8 +96,8 @@ namespace EFSDK
string key = Path.GetFileNameWithoutExtension(relativePath); // 可以保留目录信息
string value = string.IsNullOrEmpty(relativeDir) ? newName : $"{relativeDir}/{newName}";
string fileNameWithoutExt = Path.GetFileNameWithoutExtension(value);
mapping[key] = fileNameWithoutExt;
// mapping[key] = fileNameWithoutExt;
mapping.Add(key, fileNameWithoutExt);
// 目标路径
string dstPath = Path.Combine(dstDir, value.Replace("/", Path.DirectorySeparatorChar.ToString()));
@ -140,7 +141,14 @@ namespace EFSDK
{
string ext = Path.GetExtension(filePath);
string oriFileName = Path.GetFileNameWithoutExtension(filePath);
if (filePath.EndsWith(".9.png"))
{
ext = ".9.png";
oriFileName = Path.GetFileName(filePath).Replace(".9.png","");
}
string md5Str = GetFirstEightWithUnderscore(GetMD5Hash(Application.identifier + oriFileName + oriFileName));
Debug.Log($"原名:{oriFileName} 后缀:{ext} 生成文件名:{md5Str + ext}");
return md5Str + ext;
}