public static bool BundleLuaCsv() { System.DateTime lastTime = System.DateTime.Now; string sOutDir = AppPackage.AddStamp(ms_sDataOutDir); string sDataLuaScriptPath = ms_sDataDir + ms_sLuaScriptName; string sDataDesignerPath = ms_sDataDir + ms_sDesignerName; bool bSuccess = true; bSuccess &= AppPackage.LuaToByteCode(ms_sLuaScriptDir, sDataLuaScriptPath, ms_sLuaScriptName, ms_ArrGacLuaCheck); bSuccess &= AppPackage.LuaToByteCode(ms_sDesignerDir, sDataDesignerPath, ms_sDesignerName, new string[] { "/Config/" }); AssetDatabase.Refresh(); if (!bSuccess) { return(false); } BuildAssetBundleOptions theAssetOptions = BuildAssetBundleOptions.ForceRebuildAssetBundle; //theAssetOptions = theAssetOptions | BuildAssetBundleOptions.CompleteAssets; //theAssetOptions = theAssetOptions | BuildAssetBundleOptions.CollectDependencies; theAssetOptions = theAssetOptions | BuildAssetBundleOptions.UncompressedAssetBundle; theAssetOptions = theAssetOptions | BuildAssetBundleOptions.DeterministicAssetBundle; // Lua Handle AppPackage.DeleteABManifest(sOutDir + ms_sLuaScriptName.ToLower(), sOutDir + GameConfigMgr.ms_sLuaMFileName); string[] luaFilesList = AppPackage.GetFiles(new string[] { sDataLuaScriptPath }, new string[] { "*.bytes" }, true); AppPackage.BundleFiles(sOutDir, luaFilesList, theAssetOptions, false); bSuccess &= AppPackage.BackUpABManifest(sOutDir, sOutDir + GameConfigMgr.ms_sLuaMFileName + GameConfigMgr.ms_sABType); if (!bSuccess) { return(false); } // Csv Handle AppPackage.DeleteABManifest(sOutDir + ms_sDesignerName.ToLower(), sOutDir + GameConfigMgr.ms_sCsvMFileName); string[] csvFilesList = AppPackage.GetFiles(new string[] { sDataDesignerPath }, new string[] { "*.bytes" }, true); AppPackage.BundleFiles(sOutDir, csvFilesList, theAssetOptions, false); bSuccess &= AppPackage.BackUpABManifest(sOutDir, sOutDir + GameConfigMgr.ms_sCsvMFileName + GameConfigMgr.ms_sABType); if (!bSuccess) { return(false); } //Clean LuaCsv Temp Files if (Directory.Exists(sDataLuaScriptPath)) { Directory.Delete(sDataLuaScriptPath, true); File.Delete(sDataLuaScriptPath + ms_sMetaExt); } if (Directory.Exists(sDataDesignerPath)) { Directory.Delete(sDataDesignerPath, true); File.Delete(sDataDesignerPath + ms_sMetaExt); } AssetDatabase.Refresh(); System.TimeSpan costTime = System.DateTime.Now - lastTime; Debug.Log("-->> BundleLuaCsv Cost: " + (costTime.Hours * 3600 + costTime.Minutes * 60 + costTime.Seconds).ToString() + "s"); return(true); }