public static void ExportScene() { string[] scenes = MarkTool.GetSceneArray(); string content = string.Join("\n", scenes); FileUtilTool.WriteFile(sceneConfigPath, content); }
/// <summary> /// 获得不同的资源,包括新增和修改 /// </summary> /// <returns></returns> public static string GetDiffRes() { string rescontent = ""; //遍历所有的Resource目录 Analysis.Analysing(); List <string> files = new List <string>(); MarkTool.FitterRecord(files); //差异化打包 List <MarkTool.RecordInfo> localRecords = MarkTool.LoadRecordFile(MarkTool.recordPath); List <MarkTool.RecordInfo> newRecords = MarkTool.GenRecords(files.ToArray()); List <MarkTool.RecordInfo> rets = MarkTool.CompareRecord(newRecords, localRecords); List <string> resfiles = new List <string>(); foreach (var k in rets) { resfiles.Add(k.fileName); } rescontent = string.Join("\n", resfiles.ToArray()); return(rescontent); }
static void ShowScriptDiff(List <string> datas) { string content = "程序差异清单:\r\n"; foreach (string s in datas) { content += s + "\r\n"; } content += "资源清单:\r\n"; string rescontent = GetDiffRes(); content += rescontent; CustomDialog.Show("打包", content, "继续", "取消", () => { UpgradeAPKVer(); Version.SaveVersion2StreamingAsset(versionRes); BuildAPK(); SaveLastBuildLog(); MarkTool.SaveLog(); }, () => { }); }
//[MenuItem("Package/测试/生成场景文件", false, 4)] public static void BuildSceneAssetBundle() { MarkTool.ClearMarkDir("Assets"); //场景 string[] scenes = MarkTool.GetSceneConfig(); //List<string> marks = new List<string>(); //foreach (var k in scenes) //{ // marks.AddRange(AssetDatabase.GetDependencies(k)); //} //foreach(var k in marks) //{ // if(!k.EndsWith(".cs")) // MarkTool.MarkForFile(k, "scenes/" + new FileInfo(k).Name); //} foreach (var k in scenes) { if (!k.EndsWith(".cs")) { MarkTool.MarkForFile(k, "scenes/" + new FileInfo(k).Name); } } BuildPipeline.BuildAssetBundles("test/", BuildAssetBundleOptions.UncompressedAssetBundle, EditorUserBuildSettings.activeBuildTarget); GenMD5(); //BuildPipeline.BuildStreamedSceneAssetBundle(new string[1] { file }, outname, BuildTarget.Android, BuildOptions.BuildAdditionalStreamedScenes); }
static void BuildQuietResources() { UpgradeResVer(); Version.SaveVersion2StreamingAsset(versionRes); BuildAPK(); SaveLastBuildLog(); MarkTool.SaveLog(); }
static void BuildQuietScriptDiff() { UpgradeAPKVer(); Version.SaveVersion2StreamingAsset(versionRes); BuildAPK(); SaveLastBuildLog(); MarkTool.SaveLog(); }
/// <summary> /// 生成本地资源不包括加密 /// </summary> public static void BuildLocalRes() { try { BuildTool.buildLog.First(); MarkTool.ClearMarkForce(); BuildTool.buildLog.Next(); MarkTool.GenRecord(); BuildTool.buildLog.Next(); MarkTool.MarkAutoFromRecord(); BuildTool.buildLog.Next(); BuildAssetBundleTool.BuildAssetBundles(); BuildTool.buildLog.Next(); MarkTool.ClearAutoFromRecord(); BuildTool.buildLog.Next(); //BuildAssetBundleTool.DeleteMainfestFile(); BuildTool.buildLog.Next(); ResTool.CompressAssetBundle(); BuildTool.buildLog.Next(); ResTool.CopyStreamingToRes(); BuildTool.buildLog.End(); BuildTool.SaveBuildLog(BuildTool.buildLog); } catch (System.Exception e) { BuildTool.buildLog.errorLog = e.ToString(); BuildTool.SaveBuildLog(BuildTool.buildLog); Debug.LogError(e); } }
public static void FitterRecord(List <string> files) { List <Analysis.Info> results = new List <Analysis.Info>(); files.Clear(); foreach (var k in Analysis.fileInfos) { string lower = k.Value.fileName.ToLower(); if (k.Value.ext == ".cs" || k.Value.ext == ".mask") { continue; } else if (lower.EndsWith("jpg") || lower.EndsWith("png") || lower.EndsWith("psd")) { results.Add(k.Value); } else if (k.Value.fileName.EndsWith("prefab") || k.Value.fileName.Contains("Resources")) { results.Add(k.Value); } else { if (k.Value.usedCount > 1) { results.Add(k.Value); } } } foreach (var k in results) { files.Add(k.fileName); } //场景 string[] scenes = MarkTool.GetSceneConfig(); files.AddRange(scenes); }
public static void CheckResources() { string rescontent = GetDiffRes(); if (rescontent != "") { CustomDialog.Show("资源更新", rescontent, "继续", "取消", () => { UpgradeResVer(); Version.SaveVersion2StreamingAsset(versionRes); BuildAPK(); SaveLastBuildLog(); MarkTool.SaveLog(); }, () => { }); } else { if (EditorUtility.DisplayDialog("打包", "本次无更新,仍要出资源?", "是", "否")) { UpgradeResVer(); Version.SaveVersion2StreamingAsset(versionRes); BuildAPK(); SaveLastBuildLog(); MarkTool.SaveLog(); } } }