public static void BuildAssetBundles() { CUtils.DebugCastTime("Time HandleUpdateMaterail End"); EditorUtils.CheckstreamingAssetsPath(); CUtils.DebugCastTime("Time CheckstreamingAssetsPath End"); var ab = BuildPipeline.BuildAssetBundles(EditorUtils.GetOutPutPath(), SplitPackage.DefaultBuildAssetBundleOptions, target); SplitPackage.CreateStreamingFileManifest(ab); CUtils.DebugCastTime("Time BuildPipeline.BuildAssetBundles End"); }
public static void DoExport() { var files = AssetDatabase.GetAllAssetPaths().Where(p => p.StartsWith("Assets/Lua/proto") && (p.EndsWith(".proto") || p.EndsWith(".pb")) ).ToArray(); //copy EditorUtils.CheckstreamingAssetsPath(); string OutLuaProtobufPath = GetLuaProtobufResourcesPath(); AssetDatabase.DeleteAsset(OutLuaProtobufPath); GetLuaProtobufResourcesPath(); var dests = new string[files.Length]; System.Text.StringBuilder sb = new System.Text.StringBuilder(); for (int i = 0; i < files.Length; i++) { string xfile = System.IO.Path.GetFileName(files[i]);//.Remove(0, rootPath.Length + 1); string file = files[i].Replace("\\", "/"); string dest = OutLuaProtobufPath + "/" + CUtils.GetRightFileName(xfile).Replace(".", "+"); string destName = dest + ".bytes"; dests[i] = destName; Debug.LogFormat("Copy({0},{1})", file, destName); 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_protobuf_export_log.txt"); Debug.Log("write to path=" + outPath); using (StreamWriter sr = new StreamWriter(outPath, false)) { sr.Write(sb.ToString()); } EditorUtility.ClearProgressBar(); AssetDatabase.Refresh(); //addressables var setting = AASEditorUtility.LoadAASSetting(); var groupSchama = AASEditorUtility.DefaltGroupSchema[0]; var group = AASEditorUtility.FindGroup(LUA_PROTO_GROUP_NAME, groupSchama);//setting.FindGroup(LUA_GROUP_NAME); foreach (var str in dests) { var guid = AssetDatabase.AssetPathToGUID(str); //获得GUID var entry = setting.CreateOrMoveEntry(guid, group); //通过GUID创建entry entry.SetAddress(System.IO.Path.GetFileNameWithoutExtension(str)); entry.SetLabel("lua_protobuf", true); } }
public static void DoExportLua(string rootPath) { EditorUtils.CheckstreamingAssetsPath(); string OutLuaBytesPath = GetLuaBytesResourcesPath(); AssetDatabase.DeleteAsset(OutLuaBytesPath); GetLuaBytesResourcesPath(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); var files = Directory.GetFiles(rootPath, "*.lua", SearchOption.AllDirectories); var dests = new string[files.Length]; for (int i = 0; i < files.Length; i++) { string xfile = files[i].Remove(0, rootPath.Length + 1); xfile = "lua_" + xfile.Replace("\\", "+").Replace("/", "+"); string file = files[i].Replace("\\", "/"); string dest = OutLuaBytesPath + "/" + CUtils.GetRightFileName(xfile); string destName = dest.Substring(0, dest.Length - 3) + "bytes"; dests[i] = destName; 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(); AssetDatabase.Refresh(); //addressables var setting = AASEditorUtility.LoadAASSetting(); var groupSchama = AASEditorUtility.DefaltGroupSchema[0]; var group = AASEditorUtility.FindGroup(LUA_GROUP_NAME, groupSchama); //setting.FindGroup(LUA_GROUP_NAME); AASEditorUtility.ClearGroup(LUA_GROUP_NAME); //清空 foreach (var str in dests) { var guid = AssetDatabase.AssetPathToGUID(str); //获得GUID var entry = setting.CreateOrMoveEntry(guid, group); //通过GUID创建entry entry.SetAddress(System.IO.Path.GetFileNameWithoutExtension(str)); entry.SetLabel("lua_script", true); } }
public static void exportConfig() { var files = AssetDatabase.GetAllAssetPaths().Where(p => p.StartsWith("Assets/Config") && !p.StartsWith("Assets/Config/Lan") && p.EndsWith(".bytes") ).ToArray(); EditorUtils.CheckstreamingAssetsPath(); if (files.Length > 0) { string cname = CUtils.GetRightFileName(Common.CONFIG_CSV_NAME); BuildScript.BuildABsOneByOne(files.ToArray(), null, SplitPackage.DefaultBuildAssetBundleOptions); Debug.LogFormat(" Config export {0}", files.Length); } }
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(); }
public static void exportLanguage() { var files = AssetDatabase.GetAllAssetPaths().Where(p => p.StartsWith("Assets/Config/Lan") && p.EndsWith(".csv") ).ToArray(); EditorUtils.CheckstreamingAssetsPath(); // BuildScript.ch foreach (string abPath in files) { string name = CUtils.GetAssetName(abPath); string abName = CUtils.GetRightFileName(name + Common.CHECK_ASSETBUNDLE_SUFFIX); Hugula.BytesAsset bytes = (Hugula.BytesAsset)ScriptableObject.CreateInstance(typeof(Hugula.BytesAsset)); bytes.bytes = File.ReadAllBytes(abPath); string bytesPath = string.Format("Assets/Tmp/{0}.asset", name); AssetDatabase.CreateAsset(bytes, bytesPath); BuildScript.BuildABs(new string[] { bytesPath }, null, abName, SplitPackage.DefaultBuildAssetBundleOptions); Debug.Log(name + " " + abName + " export"); } }
public static void exportLuaProtobuf() { var files = AssetDatabase.GetAllAssetPaths().Where(p => p.StartsWith("Assets/Lua/proto") && (p.EndsWith(".proto") || p.EndsWith(".pb")) ).ToArray(); //copy EditorUtils.CheckstreamingAssetsPath(); string OutLuaProtobufPath = EditorUtils.GetLuaProtobufResourcesPath(); AssetDatabase.DeleteAsset(OutLuaProtobufPath); EditorUtils.GetLuaProtobufResourcesPath(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); for (int i = 0; i < files.Length; i++) { string xfile = System.IO.Path.GetFileName(files[i]);//.Remove(0, rootPath.Length + 1); string file = files[i].Replace("\\", "/"); string dest = OutLuaProtobufPath + "/" + CUtils.GetRightFileName(xfile); string destName = dest + ".txt"; Debug.LogFormat("Copy({0},{1})", file, destName); 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_protobuf_export_log.txt"); Debug.Log("write to path=" + outPath); using (StreamWriter sr = new StreamWriter(outPath, false)) { sr.Write(sb.ToString()); } EditorUtility.ClearProgressBar(); }