/// <summary> /// 生成所有资源 /// </summary> /// <param name="exportPath"></param> /// <param name="platform"></param> /// <param name="target"></param> static public void GenAllAssets(string exportPath, RuntimePlatform platform, BuildTarget target) { var outPath = exportPath + "/" + BDUtils.GetPlatformPath(platform); if (Directory.Exists(outPath)) { Directory.Delete(outPath, true); } //1.打包资源 try { AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, target); } catch (Exception e) { Debug.LogError(e.Message); return; } //2.编译脚本 try { ScriptBuildTools.BuildDll(Application.dataPath, outPath, ScriptBuildTools.BuildMode.Release); var targetPath = Application.streamingAssetsPath + "/" + BDUtils.GetPlatformPath(platform) + "/hotfix/hotfix.dll"; var hotFix = outPath + "/hotfix/hotfix.dll"; //防空 if (!Directory.Exists(Path.GetDirectoryName(targetPath))) { Directory.CreateDirectory(Path.GetDirectoryName(targetPath)); } //拷贝 if (hotFix != targetPath) { if (File.Exists(targetPath)) { File.Delete(targetPath); } File.Copy(hotFix, targetPath, true); } //分析 EditorWindow_ScriptBuildDll.GenCLRBindingByAnalysis(platform); } catch (Exception e) { Debug.LogError(e.Message); return; } //3.打包表格 try { Excel2SQLiteTools.GenSQLite(outPath); Excel2SQLiteTools.CopyCurrentSqlToOther(outPath); } catch (Exception e) { Debug.LogError(e.Message); } }
public void OnGUI() { GUILayout.BeginVertical(); GUILayout.Label("3.表格打包", EditorGUIHelper.TitleStyle); GUILayout.Space(5); if (GUILayout.Button("表格导出成Sqlite", GUILayout.Width(300), GUILayout.Height(30))) { var outPath = Application.persistentDataPath + "/" + Utils.GetPlatformPath(RuntimePlatform.Android); //3.打包表格 Excel2SQLiteTools.GenSQLite(outPath); } GUILayout.EndVertical(); }
/// <summary> /// 一键build所有资源 /// </summary> public static void OneKeyBuildALLAssets_ForBuildPackage(RuntimePlatform platform, string outpath) { var outPath = outpath + "/" + BDUtils.GetPlatformPath(platform); //1.编译脚本 ScriptBuildTools.BuildDll(Application.dataPath, outPath); EditorWindow_ScriptBuildDll.GenCLRBindingByAnalysis(platform); //2.打包资源 if (platform == RuntimePlatform.IPhonePlayer) { AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.iOS); } else if (platform == RuntimePlatform.Android) { AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.Android); } //3.打包表格 Excel2SQLiteTools.GenSQLite(outPath); }
/// <summary> /// 生成所有资源 /// </summary> /// <param name="exportPath"></param> /// <param name="platform"></param> /// <param name="target"></param> static public void GenAllAssets(string exportPath, RuntimePlatform platform, BuildTarget target) { var outPath = exportPath + "/" + BApplication.GetPlatformPath(platform); if (Directory.Exists(outPath)) { Directory.Delete(outPath, true); } //1.打包资源 try { //搜集keywork ShaderCollection.GenShaderVariant(); AssetBundleEditorTools.GenAssetBundle(outPath, target); } catch (Exception e) { Debug.LogError(e.Message); return; } //2.编译脚本 try { EditorWindow_ScriptBuildDll.RoslynBuild(ScriptBuildTools.BuildMode.Release, outPath); } catch (Exception e) { Debug.LogError(e.Message); return; } //3.打包表格 try { Excel2SQLiteTools.GenExcel2SQLite(exportPath, platform); } catch (Exception e) { Debug.LogError(e.Message); } }
/// <summary> /// 生成所有资源 /// </summary> /// <param name="exportPath"></param> /// <param name="platform"></param> /// <param name="target"></param> static public void GenAllAssets(string exportPath, RuntimePlatform platform, BuildTarget target) { var outPath = exportPath + "/" + BDUtils.GetPlatformPath(platform); if (Directory.Exists(outPath)) { Directory.Delete(outPath, true); } //1.打包资源 try { AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, target); } catch (Exception e) { Debug.LogError(e.Message); return; } //2.编译脚本 try { var targetPath = exportPath + "/" + BDUtils.GetPlatformPath(platform); EditorWindow_ScriptBuildDll.RoslynBuild(ScriptBuildTools.BuildMode.Release, targetPath); } catch (Exception e) { Debug.LogError(e.Message); return; } //3.打包表格 try { Excel2SQLiteTools.GenSQLite(outPath); Excel2SQLiteTools.CopyCurrentSqlToOther(outPath); } catch (Exception e) { Debug.LogError(e.Message); } }
/// <summary> /// 构建所有资源 /// </summary> /// <param name="platform">平台</param> /// <param name="outputPath">输出目录</param> /// <param name="setNewVersionNum">新版本号</param> static public void BuildAllAssets(RuntimePlatform platform, string outputPath, string setNewVersionNum = null) { var newVersionNum = ""; //触发事件 var lastPackageBuildInfo = GlobalAssetsHelper.GetPackageBuildInfo(outputPath, platform); var lastVersionNum = lastPackageBuildInfo.Version; //没有指定版本号,则需要触发版本号的实现逻辑 if (string.IsNullOrEmpty(setNewVersionNum)) { BDFrameworkPipelineHelper.OnBeginBuildAllAssets(platform, outputPath, lastVersionNum, out newVersionNum); } //项目没有实现提供新的版本号,则内部提供一个版本号 if (string.IsNullOrEmpty(newVersionNum) || lastVersionNum == newVersionNum) { //没指定版本号 if (string.IsNullOrEmpty(setNewVersionNum)) { newVersionNum = VersionNumHelper.AddVersionNum(lastVersionNum, add: 1); } //指定版本号 else { newVersionNum = VersionNumHelper.AddVersionNum(lastVersionNum, setNewVersionNum); } } //开始构建资源 var _outputPath = Path.Combine(outputPath, BApplication.GetPlatformPath(platform)); if (!Directory.Exists(_outputPath)) { Directory.CreateDirectory(_outputPath); } //1.编译脚本 try { EditorWindow_ScriptBuildDll.RoslynBuild(outputPath, platform, ScriptBuildTools.BuildMode.Release); } catch (Exception e) { Debug.LogError(e.Message); } //2.打包表格 try { Excel2SQLiteTools.AllExcel2SQLite(outputPath, platform); } catch (Exception e) { Debug.LogError(e.Message); } //3.打包资源 try { //var config = BDEditorApplication.BDFrameWorkFrameEditorSetting.BuildAssetBundle; AssetBundleEditorToolsV2.GenAssetBundle(outputPath, platform); } catch (Exception e) { Debug.LogError(e.Message); } //4.生成母包资源信息 GlobalAssetsHelper.GenBasePackageAssetBuildInfo(outputPath, platform, version: newVersionNum); //5.生成本地Assets.info配置 //这个必须最后生成!!!! //这个必须最后生成!!!! //这个必须最后生成!!!! var allServerAssetItemList = PublishPipelineTools.GetAssetItemList(outputPath, platform); var csv = CsvSerializer.SerializeToString(allServerAssetItemList); var assetsInfoPath = BResources.GetAssetsInfoPath(outputPath, platform); FileHelper.WriteAllText(assetsInfoPath, csv); // Debug.Log($"<color=yellow>{ BApplication.GetPlatformPath(platform)} - 旧版本:{lastPackageBuildInfo.Version} 新版本号:{newVersionNum} </color> "); //完成回调通知 BDFrameworkPipelineHelper.OnEndBuildAllAssets(platform, outputPath, newVersionNum); }
public void OnGUI_OneKeyExprot() { GUILayout.BeginVertical(); { GUILayout.Label("注:上面按钮操作,会默认生成到StreamingAssets", GUILayout.Width(500), GUILayout.Height(30)); isGenWindowsAssets = GUILayout.Toggle(isGenWindowsAssets, "生成Windows资源"); isGenIosAssets = GUILayout.Toggle(isGenIosAssets, "生成Ios资源"); isGenAndroidAssets = GUILayout.Toggle(isGenAndroidAssets, "生成Android资源"); // GUILayout.Label("导出地址:" + exportPath, GUILayout.Width(500)); GUILayout.Label("增量打包请输入版本号,初始包可以忽略(默认起始版本号:1.0)"); currentVersion = EditorGUILayout.TextField("Version: ", currentVersion); // if (GUILayout.Button("一键导出", GUILayout.Width(350), GUILayout.Height(30))) { //选择目录 exportPath = EditorUtility.OpenFolderPanel("选择导出目录", Application.dataPath.Replace("Assets", ""), ""); { //生成windows资源 if (isGenWindowsAssets) { var outPath = exportPath + "/" + Utils.GetPlatformPath(RuntimePlatform.WindowsPlayer); //1.编译脚本 ScriptBiuldTools.GenDllByMono(Application.dataPath, outPath); //2.打包资源 AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.StandaloneWindows); //3.打包表格 Excel2SQLiteTools.GenSQLite(outPath); } //生成android资源 if (isGenAndroidAssets) { var outPath = exportPath + "/" + Utils.GetPlatformPath(RuntimePlatform.Android); //1.编译脚本 ScriptBiuldTools.GenDllByMono(Application.dataPath, outPath); //2.打包资源 AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.Android); //3.打包表格 Excel2SQLiteTools.GenSQLite(outPath); } //生成ios资源 if (isGenIosAssets) { var outPath = exportPath + "/" + Utils.GetPlatformPath(RuntimePlatform.IPhonePlayer); //1.编译脚本 ScriptBiuldTools.GenDllByMono(Application.dataPath, outPath); //2.打包资源 AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.iOS); //3.打包表格 Excel2SQLiteTools.GenSQLite(outPath); } } } // if (GUILayout.Button("资源转hash格式", GUILayout.Width(350), GUILayout.Height(30))) { Debug.LogError("defaultVersion:" + currentVersion); exportPath = EditorUtility.OpenFolderPanel("选择导出目录", Application.dataPath.Replace("Assets", ""), ""); if (Directory.Exists(exportPath)) { AssetUploadToServer.Start(exportPath, "", currentVersion); } else { EditorUtility.DisplayDialog("错误!", "你选择的文件夹有点问题哦~", "爱咋咋地!"); } } // if (GUILayout.Button("上传到文件服务器[内网测试]", GUILayout.Width(350), GUILayout.Height(30))) { //先不实现,暂时没空 } } GUILayout.EndVertical(); }
public void OnGUI_OneKeyExprot() { GUILayout.BeginVertical(); { GUILayout.Label("注:上面按钮操作,会默认生成到StreamingAssets", GUILayout.Width(500), GUILayout.Height(30)); isGenWindowsAssets = GUILayout.Toggle(isGenWindowsAssets, "生成Windows资源"); isGenIosAssets = GUILayout.Toggle(isGenIosAssets, "生成Ios资源"); isGenAndroidAssets = GUILayout.Toggle(isGenAndroidAssets, "生成Android资源"); // GUILayout.Label("导出地址:" + exportPath, GUILayout.Width(500)); // if (GUILayout.Button("一键导出", GUILayout.Width(350), GUILayout.Height(30))) { //选择目录 exportPath = EditorUtility.OpenFolderPanel("选择导出目录", Application.dataPath.Replace("Assets", ""), ""); var files = Directory.GetFiles(exportPath, "*.*", SearchOption.AllDirectories); // if (string.IsNullOrEmpty(exportPath) || Directory.Exists(exportPath) == false || files.Length > 0) { EditorUtility.DisplayDialog("错误!", "文件夹不存在,或者文件夹不为空", "爱咋咋地!"); } else { //生成windows资源 if (isGenWindowsAssets) { var outPath = exportPath + "/" + Utils.GetPlatformPath(RuntimePlatform.WindowsPlayer); //1.编译脚本 ScriptBiuldTools.GenDllByMono(Application.dataPath, outPath); //2.打包资源 AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.StandaloneWindows); //3.打包表格 Excel2SQLiteTools.GenSQLite(outPath); } //生成android资源 if (isGenAndroidAssets) { var outPath = exportPath + "/" + Utils.GetPlatformPath(RuntimePlatform.Android); //1.编译脚本 ScriptBiuldTools.GenDllByMono(Application.dataPath, outPath); //2.打包资源 AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.Android); //3.打包表格 Excel2SQLiteTools.GenSQLite(outPath); } //生成ios资源 if (isGenIosAssets) { var outPath = exportPath + "/" + Utils.GetPlatformPath(RuntimePlatform.IPhonePlayer); //1.编译脚本 ScriptBiuldTools.GenDllByMono(Application.dataPath, outPath); //2.打包资源 AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.iOS); //3.打包表格 Excel2SQLiteTools.GenSQLite(outPath); } } } // if (GUILayout.Button("资源转hash格式", GUILayout.Width(350), GUILayout.Height(30))) { exportPath = EditorUtility.OpenFolderPanel("选择导出目录", Application.dataPath.Replace("Assets", ""), ""); if (Directory.Exists(exportPath)) { AssetUploadToServer.Start(exportPath, ""); } else { EditorUtility.DisplayDialog("错误!", "你选择的文件夹有点问题哦~", "爱咋咋地!"); } } // if (GUILayout.Button("上传到文件服务器[内网测试]", GUILayout.Width(350), GUILayout.Height(30))) { //先不实现,暂时没空 } } GUILayout.EndVertical(); }