示例#1
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);
            }
        }
示例#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
            {
                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);
            }
        }