| | |
| | | public static readonly string versionsFilePath = Application.dataPath + "/Editor/VersionConfigs/Versions.txt";
|
| | | public static readonly string[] baseLevels = new string[] { "Assets/Resources/Scenes/Launch.unity" };
|
| | | private static readonly string[] LaunchRequiredYooPackages = { "Builtin", "Dll" };
|
| | | private static readonly string[] YooAssetNoCompressExtensions = { ".unity3d", ".bundle", ".bytes", ".hash", ".version", ".json", ".txt" };
|
| | |
|
| | | public static string auditOutTime = string.Empty;
|
| | |
|
| | |
| | | // ---- HalfAsset(中包):剔除部分 Package ----
|
| | | if (halfPackages.Count > 0)
|
| | | {
|
| | | // 按旧逻辑映射:hero→Battle, audio→Audio, video→Video, uieffect→UIEffect
|
| | | var removePackages = new List<string> { "Battle", "Audio", "Video", "UIEffect" };
|
| | | if (!includeUI) removePackages.Add("UI");
|
| | | var removePackages = CreateHalfAssetRemovePackages();
|
| | |
|
| | | foreach (var pkgName in removePackages)
|
| | | {
|
| | |
| | | // File.Copy(copySdkFile, File_google_services);
|
| | | copySdkFile = StringUtility.Concat(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/gradleTemplate.properties");
|
| | | File.Copy(copySdkFile, File_gradleTemplate);
|
| | | EnsureYooAssetNoCompressExtensions(File_gradleTemplate);
|
| | | copySdkFile = StringUtility.Concat(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/LauncherManifest.xml");
|
| | | File.Copy(copySdkFile, File_LauncherManifest);
|
| | | copySdkFile = StringUtility.Concat(_sdkPath, "/Channel/Android/", versionConfig.sdkFileName, "/launcherTemplate.gradle");
|
| | |
| | | Debug.Log("[ClientPackage] NullAsset Export: 已清空 StreamingAssets/yoo");
|
| | | break;
|
| | | case InstalledAsset.HalfAsset:
|
| | | var removePackages = new List<string> { "Battle", "Audio", "Video", "UIEffect" };
|
| | | if (!includeUI) removePackages.Add("UI");
|
| | | var removePackages = CreateHalfAssetRemovePackages();
|
| | | foreach (var pkgName in removePackages)
|
| | | {
|
| | | string pkgDir = Path.Combine(yooRoot, pkgName);
|
| | |
| | |
|
| | | File.Copy(item.FullName, to, true);
|
| | | }
|
| | | }
|
| | |
|
| | | static bool IsOPConfigFile(FileInfo file)
|
| | | {
|
| | | return file.Name.EndsWith("OPConfig.txt", StringComparison.OrdinalIgnoreCase);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | |
|
| | | foreach (var item in fromFiles)
|
| | | {
|
| | | if (IsOPConfigFile(item))
|
| | | if (AssetVersionUtility.IsOPConfigFileName(item.Name))
|
| | | continue;
|
| | |
|
| | | var extension = Path.GetExtension(item.FullName);
|
| | |
| | | FileExtersion.GetAllDirectoryFileInfos(_assetBundlePath, files);
|
| | | foreach (var file in files)
|
| | | {
|
| | | if (IsOPConfigFile(file))
|
| | | if (AssetVersionUtility.IsOPConfigFileName(file.Name))
|
| | | continue;
|
| | |
|
| | | var extension = Path.GetExtension(file.FullName);
|
| | |
| | | {
|
| | | Debug.Log("[ClientPackage] 恢复 YooAsset StreamingAssets 到完整状态...");
|
| | | YooAssetBuildTool.RestoreBuildOutputToStreamingAssets();
|
| | | }
|
| | |
|
| | | private static List<string> CreateHalfAssetRemovePackages()
|
| | | {
|
| | | var removePackages = new List<string> { "Battle", "Hero", "Audio", "Video", "UIEffect" };
|
| | | if (!includeUI)
|
| | | {
|
| | | removePackages.Add("UI");
|
| | | removePackages.Add("UIComp");
|
| | | removePackages.Add("Sprite");
|
| | | removePackages.Add("Texture");
|
| | | removePackages.Add("Font");
|
| | | }
|
| | |
|
| | | return removePackages;
|
| | | }
|
| | |
|
| | | //随包安装的资源不同平台不一定可以获取FileInfo,所以需要下载一个文件来获取资源的MD5信息
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | static void EnsureYooAssetNoCompressExtensions(string gradleTemplatePath)
|
| | | {
|
| | | if (!File.Exists(gradleTemplatePath))
|
| | | {
|
| | | Debug.LogWarning($"[ClientPackage] gradleTemplate.properties not found: {gradleTemplatePath}");
|
| | | return;
|
| | | }
|
| | |
|
| | | string text = File.ReadAllText(gradleTemplatePath);
|
| | | var lineRegex = new Regex(@"(?m)^unityStreamingAssets\s*=\s*(.*)$");
|
| | | var match = lineRegex.Match(text);
|
| | | var extensions = new List<string>();
|
| | | var extensionSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
| | |
|
| | | if (match.Success)
|
| | | {
|
| | | foreach (var value in match.Groups[1].Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
| | | {
|
| | | var extension = value.Trim();
|
| | | if (extension.Length > 0 && extensionSet.Add(extension))
|
| | | extensions.Add(extension);
|
| | | }
|
| | | }
|
| | |
|
| | | foreach (var extension in YooAssetNoCompressExtensions)
|
| | | {
|
| | | if (extensionSet.Add(extension))
|
| | | extensions.Add(extension);
|
| | | }
|
| | |
|
| | | string newLine = "unityStreamingAssets=" + string.Join(",", extensions);
|
| | | text = match.Success
|
| | | ? lineRegex.Replace(text, newLine, 1)
|
| | | : text.TrimEnd() + Environment.NewLine + newLine + Environment.NewLine;
|
| | |
|
| | | File.WriteAllText(gradleTemplatePath, text, new UTF8Encoding(false));
|
| | | Debug.Log($"[ClientPackage] Ensured Android noCompress extensions: {newLine}");
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 导出 Gradle 工程前清理 Assets/Plugins/Android(保留 libs 目录)
|
| | | /// </summary>
|