Example #1
0
        public static void buildImage(BuildOptions option = BuildOptions.None)
        {
            string outputImagePath = ExportUtil.getImagePath("", ResExportSys.m_instance.m_targetPlatform);

            UtilPath.deleteDirectory(outputImagePath);
            UtilPath.createDirectory(outputImagePath);

            string[] levelsPath = new string[1];    // 打包第一个启动场景目录
            levelsPath[0] = "Assets/Scenes/Start.unity";

            string targetName = ExportUtil.GetBuildTargetName(ResExportSys.m_instance.m_targetPlatform /*EditorUserBuildSettings.activeBuildTarget*/);

            if (targetName == null)
            {
                return;
            }

            // Build and copy AssetBundles.
            //option = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None;

            PlayerParam param = new PlayerParam();

            param.m_levels       = levelsPath;
            param.m_locationPath = outputImagePath + targetName;
            param.m_target       = ResExportSys.m_instance.m_targetPlatform;
            param.m_options      = option;

            ExportUtil.BuildPlayer(param);
        }
Example #2
0
 public static void createPublishProductOutputPath()
 {
     // 删除输出目录
     UtilPath.deleteDirectory(ExportUtil.getPkgOutPath());
     // 创建输出目录
     UtilPath.createDirectory(ExportUtil.getPkgOutPath());
 }
Example #3
0
        // 递归创建目录
        static public void recurseCreateStreamDirectory(string pathAndName)
        {
            string curpath  = "";
            string leftpath = "";
            string fullpath = "";

            leftpath = pathAndName.Substring(Application.streamingAssetsPath.Length + 1);
            int slashIdx = 0;

            slashIdx = leftpath.IndexOf("/");

            while (slashIdx != -1)
            {
                if (curpath.Length > 0)
                {
                    curpath += "/";
                }
                curpath += leftpath.Substring(0, slashIdx);
                leftpath = leftpath.Substring(slashIdx + 1, leftpath.Length - slashIdx - 1);

                fullpath = getStreamingDataPath(curpath);
                UtilPath.createDirectory(fullpath);

                slashIdx = leftpath.IndexOf("/");
            }
        }
 public void packPack()
 {
     if (!string.IsNullOrEmpty(m_destRoot))
     {
         UtilPath.createDirectory(Path.Combine(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath, m_destRoot));
     }
     UtilPath.recursiveTraversalDir(m_srcFullPath, handleFile, handleDir);
 }
Example #5
0
        public static void restoreResources()
        {
            string restorePath = ExportUtil.getDataPath("");
            string bakPath     = ExportUtil.getPkgWorkPath("");

            UtilPath.createDirectory(restorePath);
            UtilPath.recurseCopyDirectory(bakPath, restorePath);
            UtilPath.deleteDirectory(bakPath);
        }
Example #6
0
        // 拷贝文件到 StreamingAssets 目录下
        public static void CopyAssetBundlesTo(string srcPath, BuildTarget target)
        {
            string platForm = GetPlatformFolderForAssetBundles(target);

            UtilPath.deleteDirectory(Application.streamingAssetsPath);
            UtilPath.createDirectory(Application.streamingAssetsPath);
            // 放入平台单独的目录下
            //CreateDirectory(Path.Combine(Application.streamingAssetsPath, platForm));
            //copyDirectory(srcPath, Path.Combine(Application.streamingAssetsPath, platForm));
            UtilPath.recurseCopyDirectory(srcPath, Application.streamingAssetsPath);
        }
Example #7
0
        public static void pkgResources()
        {
            ResExportSys.m_instance.m_targetPlatform = BuildTarget.StandaloneWindows;

            ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath = ExportUtil.getStreamingDataPath("");
            ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath = UtilPath.normalPath(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath);
            UtilPath.deleteDirectory(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath);
            UtilPath.createDirectory(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath);

            ResExportSys.m_instance.parseResourceXml();
            ResExportSys.m_instance.packResourceList();
        }
Example #8
0
        public static void BuildAssetBundles(BuildTarget target)
        {
            string outputPath = Path.Combine(UtilApi.kAssetBundlesOutputPath, ExportUtil.GetPlatformFolderForAssetBundles(target));

            if (UtilPath.existDirectory(outputPath))
            {
                UtilPath.deleteDirectory(outputPath);
            }
            if (!UtilPath.existDirectory(outputPath))
            {
                UtilPath.createDirectory(outputPath);
            }

            BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.UncompressedAssetBundle, target);
        }
Example #9
0
        static void ExportByResourcesCfg()
        {
            ResExportSys.instance();
            ResExportSys.m_instance.m_targetPlatform = BuildTarget.StandaloneWindows;

            ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath = ExportUtil.getStreamingDataPath("");
            ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath = UtilPath.normalPath(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath);
            UtilPath.deleteDirectory(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath);
            UtilPath.createDirectory(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath);

            ResExportSys.m_instance.parseResourceXml();
            ResExportSys.m_instance.packResourceList();

            ExportUtil.CopyAssetBundlesTo(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath, ResExportSys.m_instance.m_targetPlatform);
        }
Example #10
0
        public void packPack()
        {
            string path = ExportUtil.getStreamingDataPath(m_packParam.m_outPath);

            UtilPath.createDirectory(path);

            if (m_packParam.m_packAllFiles)
            {
                packAll();
            }
            else
            {
                packByCfg();
            }
        }
 // 遍历一个文件夹的时候处理
 public void handleDir(string fullDirName, string name)
 {
     if (m_srcFullPath != fullDirName)
     {
         string destPath = fullDirName.Substring(m_srcFullPath.Length + 1, fullDirName.Length - (m_srcFullPath.Length + 1));
         if (!string.IsNullOrEmpty(m_destRoot))
         {
             destPath = Path.Combine(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath, m_destRoot);
             destPath = Path.Combine(destPath, destPath);
         }
         else
         {
             destPath = Path.Combine(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath, destPath);
             UtilPath.createDirectory(destPath);
         }
     }
     else
     {
         UtilPath.createDirectory(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath);
     }
 }