/// <summary> /// 编译DLL /// </summary> private void BuildDLL() { //编译项目的base.dll EditorUtility.DisplayProgressBar("打包dll", "编译base.dll ..", 0.1f); var directs = Directory.GetDirectories(Application.dataPath + "/Script"); var baseDllPath = Application.streamingAssetsPath + "/Base.dll"; for (int i = directs.Length - 1; i >= 0; i--) { if (directs[i].IndexOf("LogicModule") != -1) { directs[i] = ""; break; } } ScriptBiuld_Service.BuildDll(directs, baseDllPath); //原谅我作假 { //进度 EditorUtility.DisplayProgressBar("打包DLL", "编译Base.dll[完成] ..", 0.4f); //等待500ms Thread.Sleep(500); //进度 EditorUtility.DisplayProgressBar("打包DLL", "编译hotfix.dll ..", 0.7f); } //编译hotfix.dll var hotfix = Application.dataPath + "/Script/LogicModule"; var hotfixDllPath = Application.streamingAssetsPath + "/hot_fix.dll"; ScriptBiuld_Service.BuildDll(new string[] { hotfix }, hotfixDllPath, new string[] { baseDllPath }); //进度 EditorUtility.DisplayProgressBar("打包DLL", "编译hotfix.dll ..", 0.99f); EditorUtility.ClearProgressBar(); EditorUtility.DisplayDialog("DLL打包", "DLL打包成功!\n位于StreamingAssets下", "OK"); }
private void OnGUI() { GUILayout.BeginVertical(); { GUILayout.Space(20); //第二排 GUILayout.BeginHorizontal(); { // if (GUILayout.Button("1.编译dll (.net版)", GUILayout.Width(200), GUILayout.Height(30))) { string str1 = Application.dataPath; string str2 = Application.streamingAssetsPath; Debug.Log(str1); Debug.Log(str2); string exePath = Application.dataPath + "/" + "Code/BDFramework/Tools/ILRBuild/build.exe"; if (File.Exists(exePath)) { Debug.Log(".net编译工具存在!"); } //命令行内 路径不允许有空格,所以用引号引起来 var u3dUI = @"""D:\Program Files\Unity 2018.2.4f2\Editor\Data\UnityExtensions\Unity\GUISystem"""; var u3dEngine = @"""D:\Program Files\Unity 2018.2.4f2\Editor\Data\Managed\UnityEngine"""; if (Directory.Exists(u3dUI.Replace(@"""", "")) == false || Directory.Exists(u3dEngine.Replace(@"""", "")) == false) { EditorUtility.DisplayDialog("提示", "请修改u3dui 和u3dengine 的dll目录", "OK"); return; } // Process.Start(exePath, string.Format("{0} {1} {2} {3}", str1, str2, u3dUI, u3dEngine)); AssetDatabase.Refresh(); } if (GUILayout.Button("[mono版]", GUILayout.Width(100), GUILayout.Height(30))) { //u3d的 各种dll var u3dUI = @"D:\Program Files\Unity 2018.2.4f2\Editor\Data\UnityExtensions\Unity\GUISystem"; var u3dEngine = @"D:\Program Files\Unity 2018.2.4f2\Editor\Data\Managed\UnityEngine"; if (Directory.Exists(u3dUI) == false || Directory.Exists(u3dEngine) == false) { EditorUtility.DisplayDialog("提示", "请修改u3dui 和u3dengine 的dll目录", "OK"); } ScriptBiuld_Service.BuildDLL_Mono(Application.dataPath, Application.streamingAssetsPath, u3dUI, u3dEngine); } } GUILayout.EndHorizontal(); if (GUILayout.Button("2.生成CLRBinding", GUILayout.Width(305), GUILayout.Height(30))) { GenCLRBindingByAnalysis(); } if (GUILayout.Button("3.生成跨域Adapter[没事别瞎点]", GUILayout.Width(305), GUILayout.Height(30))) { GenCrossBindAdapter(); } } GUILayout.EndVertical(); }