private void OnGUI() { EditorGUILayout.LabelField("打包平台:"); this.platformType = (PlatformType)EditorGUILayout.EnumPopup(platformType); this.clearFolder = EditorGUILayout.Toggle("清理资源文件夹: ", clearFolder); this.isBuildExe = EditorGUILayout.Toggle("是否打包EXE: ", this.isBuildExe); this.isContainAB = EditorGUILayout.Toggle("是否同将资源打进EXE: ", this.isContainAB); this.buildType = (BuildType)EditorGUILayout.EnumPopup("BuildType: ", this.buildType); EditorGUILayout.LabelField("BuildAssetBundleOptions(可多选):"); this.buildAssetBundleOptions = (BuildAssetBundleOptions)EditorGUILayout.EnumFlagsField(this.buildAssetBundleOptions); switch (buildType) { case BuildType.Development: this.buildOptions = BuildOptions.Development | BuildOptions.ConnectWithProfiler; break; case BuildType.Release: this.buildOptions = BuildOptions.None; break; } GUILayout.Space(5); if (GUILayout.Button("开始打包")) { if (this.platformType == PlatformType.None) { ShowNotification(new GUIContent("请选择打包平台!")); return; } if (platformType != activePlatform) { switch (EditorUtility.DisplayDialogComplex("警告!", $"当前目标平台为{activePlatform}, 如果切换到{platformType}, 可能需要较长加载时间", "切换", "取消", "不切换")) { case 0: activePlatform = platformType; break; case 1: return; case 2: platformType = activePlatform; break; } } BuildHelper.Build(this.platformType, this.buildAssetBundleOptions, this.buildOptions, this.isBuildExe, this.isContainAB, this.clearFolder); } GUILayout.Space(5); }
private void OnGUI() { if (this.config == null) { string jstr = File.ReadAllText("Assets/AssetsPackage/config.bytes"); config = LitJson.JsonMapper.ToObject <Dictionary <string, string> >(jstr); } EditorGUILayout.LabelField("cdn地址:" + this.config["remote_cdn_url"]); EditorGUILayout.LabelField("渠道标识:" + this.config["EngineVer"]); EditorGUILayout.LabelField("资源版本:" + this.config["ResVer"]); if (GUILayout.Button("修改配置")) { System.Diagnostics.Process.Start("notepad.exe", "Assets/AssetsPackage/config.bytes"); } if (GUILayout.Button("刷新配置")) { string jstr = File.ReadAllText("Assets/AssetsPackage/config.bytes"); config = LitJson.JsonMapper.ToObject <Dictionary <string, string> >(jstr); } EditorGUILayout.LabelField(""); EditorGUILayout.LabelField("打包平台:"); this.platformType = (PlatformType)EditorGUILayout.EnumPopup(platformType); this.clearFolder = EditorGUILayout.Toggle("清理资源文件夹: ", clearFolder); this.isBuildExe = EditorGUILayout.Toggle("是否打包EXE: ", this.isBuildExe); this.isInject = EditorGUILayout.Toggle("是否Inject(整包,无IFix标签) ", this.isInject); //this.isContainAB = EditorGUILayout.Toggle("是否同将资源打进EXE: ", this.isContainAB); this.buildType = (BuildType)EditorGUILayout.EnumPopup("BuildType: ", this.buildType); //EditorGUILayout.LabelField("BuildAssetBundleOptions(可多选):"); //this.buildAssetBundleOptions = (BuildAssetBundleOptions)EditorGUILayout.EnumFlagsField(this.buildAssetBundleOptions); switch (buildType) { case BuildType.Development: this.buildOptions = BuildOptions.Development | BuildOptions.ConnectWithProfiler | BuildOptions.AllowDebugging; break; case BuildType.Release: this.buildOptions = BuildOptions.None; break; } GUILayout.Space(5); if (GUILayout.Button("开始打包")) { if (this.platformType == PlatformType.None) { ShowNotification(new GUIContent("请选择打包平台!")); return; } if (platformType != activePlatform) { switch (EditorUtility.DisplayDialogComplex("警告!", $"当前目标平台为{activePlatform}, 如果切换到{platformType}, 可能需要较长加载时间", "切换", "取消", "不切换")) { case 0: activePlatform = platformType; break; case 1: return; case 2: platformType = activePlatform; break; } } BuildHelper.Build(this.platformType, this.buildOptions, this.isBuildExe, this.clearFolder, this.isInject); } GUILayout.Space(5); }
private void OnGUI() { this.platformType = (PlatformType)EditorGUILayout.EnumPopup(platformType); this.clearFolder = EditorGUILayout.Toggle("clean folder? ", clearFolder); this.isBuildExe = EditorGUILayout.Toggle("build exe?", this.isBuildExe); this.isContainAB = EditorGUILayout.Toggle("contain assetsbundle?", this.isContainAB); this.codeOptimization = (CodeOptimization)EditorGUILayout.EnumPopup("CodeOptimization ", this.codeOptimization); EditorGUILayout.LabelField("BuildAssetBundleOptions "); this.buildAssetBundleOptions = (BuildAssetBundleOptions)EditorGUILayout.EnumFlagsField(this.buildAssetBundleOptions); switch (this.codeOptimization) { case CodeOptimization.None: case CodeOptimization.Debug: this.buildOptions = BuildOptions.Development | BuildOptions.ConnectWithProfiler; break; case CodeOptimization.Release: this.buildOptions = BuildOptions.None; break; } GUILayout.Space(5); if (GUILayout.Button("BuildPackage")) { if (this.platformType == PlatformType.None) { ShowNotification(new GUIContent("please select platform!")); return; } if (platformType != activePlatform) { switch (EditorUtility.DisplayDialogComplex("Warning!", $"current platform is {activePlatform}, if change to {platformType}, may be take a long time", "change", "cancel", "no change")) { case 0: activePlatform = platformType; break; case 1: return; case 2: platformType = activePlatform; break; } } BuildHelper.Build(this.platformType, this.buildAssetBundleOptions, this.buildOptions, this.isBuildExe, this.isContainAB, this.clearFolder); } GUILayout.Label(""); GUILayout.Label("Code Compile:"); this.globalConfig.LoadMode = (LoadMode)EditorGUILayout.EnumPopup("LoadMode: ", this.globalConfig.LoadMode); this.globalConfig.CodeMode = (CodeMode)EditorGUILayout.EnumPopup("CodeMode: ", this.globalConfig.CodeMode); if (GUILayout.Button("BuildCode")) { if (Define.EnableCodes) { throw new Exception("now in ENABLE_CODES mode, do not need Build!"); } BuildAssemblieEditor.BuildCode(this.codeOptimization, globalConfig); } if (GUILayout.Button("BuildModel")) { if (Define.EnableCodes) { throw new Exception("now in ENABLE_CODES mode, do not need Build!"); } BuildAssemblieEditor.BuildModel(this.codeOptimization, globalConfig); } if (GUILayout.Button("BuildHotfix")) { if (Define.EnableCodes) { throw new Exception("now in ENABLE_CODES mode, do not need Build!"); } BuildAssemblieEditor.BuildHotfix(this.codeOptimization, globalConfig); } if (GUILayout.Button("ExcelExporter")) { //Directory.Delete("Assets/Bundles/Config", true); ToolsEditor.ExcelExporter(); // 如果是ClientServer,那么客户端要使用服务端配置 if (this.globalConfig.CodeMode == CodeMode.ClientServer) { FileHelper.CopyDirectory("../Config/StartConfig/Localhost", "Assets/Bundles/Config/StartConfig/Localhost"); foreach (string file in Directory.GetFiles("../Config/", "*.bytes")) { File.Copy(file, $"Assets/Bundles/Config/{Path.GetFileName(file)}", true); } } Debug.Log("copy config to Assets/Bundles/Config"); } if (GUILayout.Button("Proto2CS")) { ToolsEditor.Proto2CS(); } GUILayout.Space(5); }