/// <summary> /// Builds the asset bundles update A. /// </summary> public static void buildAssetBundlesUpdateAB() { EditorUtility.DisplayProgressBar("Generate FileList", "loading bundle manifest", 1 / 2); AssetDatabase.Refresh(); string readPath = EditorUtils.GetFileStreamingOutAssetsPath(); // 读取Streaming目录 var u3dList = EditorUtils.getAllChildFiles(readPath, @"\.meta$|\.manifest$|\.DS_Store$|\.u$", null, false); List <string> assets = new List <string>(); foreach (var s in u3dList) { string ab = EditorUtils.GetAssetPath(s); //s.Replace(readPath, "").Replace("/", "").Replace("\\", ""); assets.Add(ab); } readPath = new System.IO.DirectoryInfo(EditorUtils.GetLuaBytesResourcesPath()).FullName; // 读取lua 目录 u3dList = EditorUtils.getAllChildFiles(readPath, @"\.bytes$", null); foreach (var s in u3dList) { string ab = EditorUtils.GetAssetPath(s); //s.Replace(readPath, "").Replace("/", "").Replace("\\", ""); assets.Add(ab); } EditorUtility.ClearProgressBar(); CUtils.DebugCastTime("Time Generate FileList End"); Debug.Log("all assetbundle count = " + assets.Count); BuildScript.GenerateAssetBundlesUpdateFile(assets.ToArray()); CUtils.DebugCastTime("Time GenerateAssetBundlesUpdateFile End"); }
private static int GetAssetbundleSize(string abName) { FileInfo finfo = new FileInfo(CUtils.PathCombine(CUtils.realStreamingAssetsPath, abName)); int abSize = 0; if (finfo.Exists) { abSize = (int)finfo.Length; } else { finfo = new FileInfo(EditorUtils.GetLuaBytesResourcesPath() + "/" + abName); if (finfo.Exists) { abSize = (int)finfo.Length; } } return(abSize); }
public static void doExportLua(string rootPath) { EditorUtils.CheckstreamingAssetsPath(); string OutLuaBytesPath = EditorUtils.GetLuaBytesResourcesPath(); AssetDatabase.DeleteAsset(OutLuaBytesPath); EditorUtils.GetLuaBytesResourcesPath(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); var files = Directory.GetFiles(rootPath, "*.lua", SearchOption.AllDirectories); var dests = new string[files.Length]; // var dests64 = new string[files.Length]; for (int i = 0; i < files.Length; i++) { string xfile = files[i].Remove(0, rootPath.Length + 1); xfile = xfile.Replace("\\", "+").Replace("/", "+"); string file = files[i].Replace("\\", "/"); string dest = OutLuaBytesPath + "/" + CUtils.GetRightFileName(xfile); string destName = dest.Substring(0, dest.Length - 3) + "bytes"; System.IO.File.Copy(file, destName, true); sb.AppendFormat("\r\n {0} ({1}) ", file, destName); } string tmpPath = EditorUtils.GetAssetTmpPath(); EditorUtils.CheckDirectory(tmpPath); string outPath = Path.Combine(tmpPath, "lua_export_log.txt"); Debug.Log("write to path=" + outPath); using (StreamWriter sr = new StreamWriter(outPath, false)) { sr.Write(sb.ToString()); } EditorUtility.ClearProgressBar(); }