/// <summary> /// 生成绑定素材 /// </summary> public static void BuildAssetResource(BuildTarget target, bool isWin) { string streamPath = Application.streamingAssetsPath; if (Directory.Exists(streamPath)) { Directory.Delete(streamPath, true); } AssetDatabase.Refresh(); if (AppConst.ExampleMode) { HandleExampleBundle(target); } if (AppConst.LuaBundleMode) { ToLuaMenu.BuildNotJitBundles(); } else { HandleLuaFile(isWin); } BuildFileIndex(); AssetDatabase.Refresh(); }
static void HandleBundle() { ToLuaMenu.BuildNotJitBundles(); string luaPath = AppDataPath + "/StreamingAssets/lua/"; string[] luaPaths = { AppDataPath + "/_Scripts/FrameWork/lua/", AppDataPath + "/_Scripts/FrameWork/Tolua/Lua/" }; for (int i = 0; i < luaPaths.Length; i++) { paths.Clear(); files.Clear(); string luaDataPath = luaPaths[i].ToLower(); Recursive(luaDataPath); foreach (string f in files) { if (f.EndsWith(".meta") || f.EndsWith(".lua")) { continue; } string newfile = f.Replace(luaDataPath, ""); string path = Path.GetDirectoryName(luaPath + newfile); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string destfile = path + "/" + Path.GetFileName(f); File.Copy(f, destfile, true); } } }
private static void ProcessResourcesImpl(bool bRebuildBundle) { string AssetBundlePath = Path.Combine(Application.dataPath, "BundleAsset"); if (bRebuildBundle) { if (Directory.Exists(AssetBundlePath)) { Directory.Delete(AssetBundlePath, true); Directory.CreateDirectory(AssetBundlePath); } AssetBundleManagerEditor.RefreshDirectory(); AssetBundleManagerEditor.RebuildAll(); } else { var data = AssetBundleManager.GetManageData(false); var index = 0; { var __list3 = data.assetbundles; var __listCount3 = __list3.Count; for (int __i3 = 0; __i3 < __listCount3; ++__i3) { var assetBundleData = __list3[__i3]; { if (assetBundleData.File.Contains("Script")) { AssetBundleManagerEditor.CreateAssetBundleWithDependency(data, index, true); break; } index++; } } } } string streamAssetsPath = Application.streamingAssetsPath; if (Directory.Exists(streamAssetsPath)) { Directory.Delete(streamAssetsPath, true); } Directory.CreateDirectory(streamAssetsPath); //是不是要打小包 string path = Path.Combine(Application.dataPath, "../../thinpackage.txt"); if (File.Exists(path)) { s_IsThinPackage = true; File.Delete(path); } else { s_IsThinPackage = false; } if (s_IsThinPackage) { ModifyVersionFile(GameVersionPath, 1); ProcessThinPackageResource(); string destPath = Path.Combine(Application.streamingAssetsPath, "Game.ver"); File.Copy(GameVersionPath, destPath, true); if (bRebuildBundle) { ModifyVersionFile(GameVersionPath, 1); } } else { DirectoryCopy(AssetBundlePath, streamAssetsPath, true); if (bRebuildBundle) { ModifyVersionFile(GameVersionPath, 1); } string destPath = Path.Combine(Application.streamingAssetsPath, "Game.ver"); File.Copy(GameVersionPath, destPath, true); } string destPath3 = Path.Combine(Application.streamingAssetsPath, "logo.mp4"); string mp4Path = Path.Combine(Application.dataPath, "../../PlatformPlugin/logo.mp4"); if (File.Exists(mp4Path)) { File.Copy(mp4Path, destPath3, true); } ToLuaMenu.BuildNotJitBundles(); DirectoryCopy(Path.Combine(Application.streamingAssetsPath, LuaConst.osDir), Path.Combine(AssetBundlePath, LuaConst.osDir), true); //把需要更新文件备份 string assetBundlePath = Path.Combine(Application.dataPath, "BundleAsset"); string verInfo = File.ReadAllText(GameVersionPath).Trim(); var config = verInfo.Split(','); var backupPathStr = string.Format("../../Update/{0}/{1}/{2}/{3}/BundleAsset", config[0], config[1], config[2], config[3]); var backupPath = Path.Combine(Application.dataPath, backupPathStr); CheckTargetPath(backupPath); if (Directory.Exists(backupPath)) { Directory.Delete(backupPath, true); } DirectoryCopy(assetBundlePath, backupPath, true); DllBackupPath = backupPath; }