예제 #1
0
    public void OnGUI()
    {
        GUILayout.BeginVertical();
        {
            GUILayout.Label("1.脚本打包", EditorGUIHelper.TitleStyle);
            GUILayout.Space(5);
            //第二排
            GUILayout.BeginHorizontal();
            {
                //
                if (GUILayout.Button("1.编译dll (.net版)", GUILayout.Width(200), GUILayout.Height(30)))
                {
                    string str1 = Application.dataPath;
                    string str2 = Application.streamingAssetsPath;
                    ScriptBiuldTools.BuildDLL_DotNet(str1, str2);
                    AssetDatabase.Refresh();
                }

                if (GUILayout.Button("[mono版]", GUILayout.Width(100), GUILayout.Height(30)))
                {
                    //
                    //u3d的 各种dll
                    ScriptBiuldTools.GenDllByMono(Application.dataPath,
                                                  Application.streamingAssetsPath + "/" + Utils.GetPlatformPath(Application.platform));
                    Debug.Log("脚本打包完毕");
                }
            }
            GUILayout.EndHorizontal();

            if (GUILayout.Button("2.生成CLRBinding · one for all", GUILayout.Width(305), GUILayout.Height(30)))
            {
                GenCLRBindingByAnalysis();
            }

            if (GUILayout.Button("3.生成跨域Adapter[没事别瞎点]", GUILayout.Width(305), GUILayout.Height(30)))
            {
                GenCrossBindAdapter();
            }

            if (GUILayout.Button("4.生成Link.xml", GUILayout.Width(305), GUILayout.Height(30)))
            {
                StripCode.GenLinkXml();
            }

            GUI.color = Color.green;
            GUILayout.Label(
                @"注意事项:
     1.编译服务使用codedom,请放心使用
     2.如编译出现报错,请仔细看报错信息,和报错的代码行列,
       一般均为语法错
     3.语法报错原因可能有:主工程访问hotfix中的类, 使用宏
       编译时代码结构发生变化..等等,需要细心的你去发现
"
                );
            GUI.color = GUI.backgroundColor;
        }
        GUILayout.EndVertical();
    }
예제 #2
0
    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();
    }
    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("一键导出[自动转hash]", GUILayout.Width(350), GUILayout.Height(30)))
            {
                //选择目录
                exportPath = EditorUtility.OpenFolderPanel("选择导出目录", exportPath, "");
                if (string.IsNullOrEmpty(exportPath))
                {
                    return;
                }
                //开始生成资源
                {
                    //生成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);
                    }
                }

                //自动转hash
                AssetUploadToServer.Assets2Hash(exportPath, "");

                EditorUtility.DisplayDialog("提示", "资源导出完成", "OK");
            }
            //
            if (GUILayout.Button("上传到文件服务器[内网测试]", GUILayout.Width(350), GUILayout.Height(30)))
            {
                //先不实现,暂时没空
            }
        }
        GUILayout.EndVertical();
    }