Example #1
0
        /// <summary>
        /// 生成目标工程
        /// </summary>
        private static void GenerateProject()
        {
            BuildPlayerOptions options = new BuildPlayerOptions();

            options.target = EditorBaseUtil.GetBuildTarget();
            string exportPath = EditorPathUtil.GetExportProjectPath();
            string folderPath = Path.GetDirectoryName(exportPath);

            if (Directory.Exists(folderPath))
            {
                FileUtil.DeleteFileOrDirectory(folderPath);
            }
            options.locationPathName = exportPath;
            options.options          = BuildOptions.AcceptExternalModificationsToPlayer;
            BuildReport report = BuildPipeline.BuildPlayer(options);

            if (report.summary.result == BuildResult.Succeeded)
            {
                Debug.LogFormat("Export project path={0} success!", exportPath);
            }
            else
            {
                Debug.LogFormat("Export project path={0} Failure!", exportPath);
            }
        }
Example #2
0
        /// <summary>
        /// 导出资源
        /// </summary>
        /// <param name="updatedFiles"></param>
        private static void ExportUpdateFiles(List <string> updatedFiles)
        {
            if (updatedFiles.Count > 0)
            {
                for (int i = 0; i < updatedFiles.Count; i++)
                {
                    string assetbundleSrcPath = Path.Combine(EditorPathUtil.GetExportAssetBundlePath(), updatedFiles[i]);
                    string assetbundleDstPath = Path.Combine(EditorPathUtil.GetExportPatchPath(), updatedFiles[i]);
                    string destDir            = Path.GetDirectoryName(assetbundleDstPath);
                    if (!Directory.Exists(destDir))
                    {
                        Directory.CreateDirectory(destDir);
                    }
                    File.Copy(assetbundleSrcPath, assetbundleDstPath, true);
                }
            }
            string versionFileSrcPath = s_versionDiffFilePath;
            string versionFileDstPath = Path.Combine(s_versionPatchPath, Path.GetFileName(versionFileSrcPath));
            string updateFileDestDir  = Path.GetDirectoryName(versionFileDstPath);

            if (!Directory.Exists(updateFileDestDir))
            {
                Directory.CreateDirectory(updateFileDestDir);
            }
            File.Copy(versionFileSrcPath, versionFileDstPath, true);
        }