/// <summary>
    /// 最新包
    /// </summary>
    void LastestGUI()
    {
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("一键打包[美术资源]", GUILayout.Width(380), GUILayout.Height(30)))
        {
            //开始打包
            if (isSelectWindows)
            {
                AssetBundleEditorTools.GenAssetBundle(rootResourceDir, Application.streamingAssetsPath + "/Windows", BuildTarget.StandaloneWindows);
            }
            if (isSelectAndroid)
            {
                AssetBundleEditorTools.GenAssetBundle(rootResourceDir, Application.streamingAssetsPath + "/Android", BuildTarget.Android);
            }
            if (isSelectIOS)
            {
                AssetBundleEditorTools.GenAssetBundle(rootResourceDir, Application.streamingAssetsPath + "/iOS", BuildTarget.iOS);
            }

            AssetDatabase.Refresh();
            Debug.Log("资源打包完毕");
        }

        GUILayout.EndHorizontal();
    }
Пример #2
0
        /// <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);
            }
        }
Пример #3
0
    /// <summary>
    /// 最新包
    /// </summary>
    void LastestGUI()
    {
        GUILayout.BeginVertical();

        if (GUILayout.Button("检测资源", GUILayout.Width(100)))
        {
            exportPath = EditorUtility.OpenFolderPanel("选择导出目录", Application.dataPath, "");


            if (string.IsNullOrEmpty(exportPath))
            {
                return;
            }

            if (isSelectWindows)
            {
                AssetBundleEditorTools.CheackAssets(rootResourceDir, exportPath + "/Windows", BuildTarget.StandaloneWindows);
            }
            if (isSelectAndroid)
            {
                AssetBundleEditorTools.CheackAssets(rootResourceDir, exportPath + "/Android", BuildTarget.Android);
            }
            if (isSelectIOS)
            {
                AssetBundleEditorTools.CheackAssets(rootResourceDir, exportPath + "/iOS", BuildTarget.iOS);
            }

            AssetDatabase.Refresh();
            Debug.Log("资源打包完毕");
        }

        if (GUILayout.Button("一键打包[美术资源]", GUILayout.Width(380), GUILayout.Height(30)))
        {
            var exportPath = EditorUtility.OpenFolderPanel("选择导出目录", Application.dataPath, "");
            if (string.IsNullOrEmpty(exportPath))
            {
                return;
            }
            //开始打包
            if (isSelectWindows)
            {
                AssetBundleEditorTools.GenAssetBundle(rootResourceDir, exportPath + "/Windows", BuildTarget.StandaloneWindows, options);
            }
            if (isSelectAndroid)
            {
                AssetBundleEditorTools.GenAssetBundle(rootResourceDir, exportPath + "/Android", BuildTarget.Android, options);
            }
            if (isSelectIOS)
            {
                AssetBundleEditorTools.GenAssetBundle(rootResourceDir, exportPath + "/iOS", BuildTarget.iOS, options);
            }

            AssetDatabase.Refresh();
            Debug.Log("资源打包完毕");
        }

        GUILayout.EndVertical();
    }
Пример #4
0
    public void BuildAsset()
    {
        if (isSelectAndroid)
        {
            AssetBundleEditorTools.GenAssetBundle(rootResourceDir, exportPath + "/" + BDUtils.GetPlatformPath(RuntimePlatform.Android), BuildTarget.Android, options);
        }
        if (isSelectIOS)
        {
            AssetBundleEditorTools.GenAssetBundle(rootResourceDir, exportPath + "/" + BDUtils.GetPlatformPath(RuntimePlatform.IPhonePlayer), BuildTarget.iOS, options);
        }

        AssetDatabase.Refresh();
        Debug.Log("资源打包完毕");
    }
    /// <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);
    }
Пример #6
0
        /// <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);
            }
        }
Пример #7
0
        /// <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);
            }
        }
Пример #8
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("一键导出[自动转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.编译脚本
                        ScriptBuildTools.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.编译脚本
                        ScriptBuildTools.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.编译脚本
                        ScriptBuildTools.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();
    }
    public void OnGUI_OneKeyExprot()
    {
        GUILayout.BeginVertical();
        {
            GUILayout.Label("注:上面按钮操作,会默认生成到StreamingAssets", GUILayout.Width(500), GUILayout.Height(30));
            isGenAndroidAssets = GUILayout.Toggle(isGenAndroidAssets, "生成Android资源(Windows公用)");
            isGenIosAssets     = GUILayout.Toggle(isGenIosAssets, "生成Ios资源");

            //
            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;
                }

                //开始生成资源
                {
                    //生成android资源
                    if (isGenAndroidAssets)
                    {
                        var outPath = exportPath + "/" + BDUtils.GetPlatformPath(RuntimePlatform.Android);
                        //1.编译脚本
                        try
                        {
                            ScriptBuildTools.BuildDll(Application.dataPath, outPath);
                            EditorWindow_ScriptBuildDll.GenCLRBindingByAnalysis();
                        }
                        catch (Exception e)
                        {
                            Debug.LogError(e.Message);
                            return;
                        }
                        //2.打包资源
                        try
                        {
                            AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath,
                                                                  BuildTarget.Android);
                        }
                        catch (Exception e)
                        {
                            Debug.LogError(e.Message);
                            return;
                        }

                        //3.打包表格
                        try
                        {
                            Excel2SQLiteTools.GenSQLite(outPath);
                        }
                        catch (Exception e)
                        {
                            Debug.LogError(e.Message);
                            return;
                        }
                    }

                    //生成ios资源
                    if (isGenIosAssets)
                    {
                        var outPath = exportPath + "/" + BDUtils.GetPlatformPath(RuntimePlatform.IPhonePlayer);
                        //1.编译脚本
                        try
                        {
                            ScriptBuildTools.BuildDll(Application.dataPath, outPath);
                            EditorWindow_ScriptBuildDll.GenCLRBindingByAnalysis();
                        }
                        catch (Exception e)
                        {
                            Debug.LogError(e.Message);
                            return;
                        }
                        //2.打包资源
                        try
                        {
                            AssetBundleEditorTools.GenAssetBundle("Resource/Runtime/", outPath, BuildTarget.iOS);
                        }
                        catch (Exception e)
                        {
                            Debug.LogError(e.Message);
                            return;
                        }

                        //3.打包表格
                        try
                        {
                            Excel2SQLiteTools.GenSQLite(outPath);
                        }
                        catch (Exception e)
                        {
                            Debug.LogError(e.Message);
                            return;
                        }
                    }
                }

                EditorUtility.DisplayDialog("提示", "资源导出完成", "OK");
            }

            //
            if (GUILayout.Button("上传到文件服务器[内网测试]", GUILayout.Width(350), GUILayout.Height(30)))
            {
                //先不实现,等待使用者实现
            }

            if (GUILayout.Button("热更资源转hash[备用]", GUILayout.Width(350), GUILayout.Height(30)))
            {
                //选择目录
                exportPath = EditorUtility.OpenFolderPanel("选择导出目录", exportPath, "");
                if (string.IsNullOrEmpty(exportPath))
                {
                    return;
                }
                //自动转hash
                AssetUploadToServer.Assets2Hash(exportPath, "");
            }
        }
        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();
    }
Пример #11
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();
    }