public static void BuildLuaScript() { //这是build资源的路径 string buildPath = BuildUtil.GetBuildDir(target); string resPath = Path.Combine(buildPath, "lua"); //resPath = F:/ MyGame / Assets\../ AssetBundles\win\lua if (Directory.Exists(resPath)) { Directory.Delete(resPath, true); } AssetDatabase.Refresh(); ClearAllLuaFiles(); if (AppConst.LuaBundleMode) { //HandleLuaBundle(); } else { HandleLuaFile(resPath); } BuildUtil.GenVersionFile(buildPath, BuildUtil.VersionEnum.LUA); BuildUtil.BuildFileIndex(buildPath); AssetDatabase.Refresh(); }
static void ClearAllLuaFiles() { string osName = BuildUtil.GetBuildOsDir(target);//win string osPath = Application.streamingAssetsPath + "/" + osName; string buildPath = BuildUtil.GetBuildDir(target); string resPath = Path.Combine(buildPath, "/lua"); if (Directory.Exists(osPath)) { string[] files = Directory.GetFiles(osPath, "Lua*.unity3d"); for (int i = 0; i < files.Length; i++) { File.Delete(files[i]); } } if (Directory.Exists(resPath)) { Directory.Delete(resPath, true); } string path = osPath + "/Lua"; if (Directory.Exists(path)) { Directory.Delete(path, true); } path = Application.dataPath + "/Resources/Lua"; if (Directory.Exists(path)) { Directory.Delete(path, true); } path = FXGame.AppConst.GetAppDownDir() + "/" + osName + "/Lua"; if (Directory.Exists(path)) { Directory.Delete(path, true); } }
static void BuildResourcesExecute() { Caching.CleanCache();//使用cach模式加载,第一次指定BundleURL,之后会有缓存,需要清除一下 string buildPath = BuildUtil.GetBuildDir(target); string resPath = Path.Combine(buildPath, "res"); //if (Directory.Exists(streamPath)) //{ // Directory.Delete(streamPath, true); // if (File.Exists(streamPath + ".meta")) // File.Delete(streamPath + ".meta"); //} AssetDatabase.Refresh(); ResourcesHandle(resPath); BuildUtil.GenVersionFile(buildPath, BuildUtil.VersionEnum.RES); BuildUtil.BuildFileIndex(buildPath); }