Exemplo n.º 1
0
 /// <summary>
 /// 获取Source Packages 下 存放 Main Packages 所有的 AssetBundle的Hash 的文件的根目录
 /// </summary>
 /// <param name="platform"></param>
 /// <returns></returns>
 public static string GetMainPackage_AssetBundle_HashFiles_FolderPath_InSourcePackagesFolder(string platform)
 {
     return(VFSUtil.GetMainPackageAssetBundleHashFilesRootPath(GetSourcePackagesFolderPath(platform)));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 复制到StreamingAssets
        /// </summary>
        /// <param name="packages_root_path">Packages根目录(有vfs_root,vfs_data之类的那个目录)</param>
        /// <param name="platform_name">平台名</param>
        public static void CopyToStreamingAssets(string packages_root_path, string platform_name, bool clearOtherPlatformFiles = false, bool OnlyMainPackage = false)
        {
            VFSEditorUtil.InitVFSFoldersInStreamingAssets(platform_name, clearOtherPlatformFiles);
            var stream_root_path      = Path.Combine(Application.streamingAssetsPath, VFSConst.VFS_STREAMINGASSETS_PATH);
            var project_vfs_root_path = Path.Combine(packages_root_path, VFSConst.VFS_FOLDER_MAIN);

            if (Directory.Exists(project_vfs_root_path))
            {
                string target_vfs_root = Path.Combine(stream_root_path, platform_name, VFSConst.VFS_FOLDER_MAIN);
                XDirectory.DeleteIfExists(target_vfs_root);
                XDirectory.CopyDir(project_vfs_root_path, target_vfs_root);
            }

            if (!OnlyMainPackage)
            {
                var project_vfs_extension_group = Path.Combine(packages_root_path, VFSConst.VFS_FOLDER_EXTENSION);
                if (Directory.Exists(project_vfs_extension_group))
                {
                    string target_vfs_extension = Path.Combine(stream_root_path, platform_name, VFSConst.VFS_FOLDER_EXTENSION);
                    XDirectory.DeleteIfExists(target_vfs_extension);
                    XDirectory.CopyDir(project_vfs_extension_group, target_vfs_extension);
                }
            }

            //Data目录处理----------------------------------------------------------
            //assetBundle hash
            var main_package_assetbundle_hash_files_folder_path = VFSUtil.GetMainPackageAssetBundleHashFilesRootPath(packages_root_path);

            if (Directory.Exists(main_package_assetbundle_hash_files_folder_path))
            {
                string target_path = VFSUtil.GetMainPackageAssetBundleHashFilesRootPath(Path.Combine(stream_root_path, platform_name));
                XDirectory.DeleteIfExists(target_path);
                XDirectory.CopyDir(main_package_assetbundle_hash_files_folder_path, target_path);
            }

            //manifest
            var main_package_manifest_file_folder_path = VFSUtil.GetMainPackage_AssetBundleManifests_Folder(packages_root_path);

            if (Directory.Exists(main_package_manifest_file_folder_path))
            {
                string target_path = VFSUtil.GetMainPackage_AssetBundleManifests_Folder(Path.Combine(stream_root_path, platform_name));
                XDirectory.DeleteIfExists(target_path);
                XDirectory.CopyDir(main_package_manifest_file_folder_path, target_path);
            }
            //build info
            var main_package_build_info = VFSUtil.GetMainPackage_BuildInfo_Path(packages_root_path);

            if (File.Exists(main_package_build_info))
            {
                string target_path = VFSUtil.GetMainPackage_BuildInfo_Path(Path.Combine(stream_root_path, platform_name));
                XFile.DeleteIfExists(target_path);
                XDirectory.CreateIfNotExists(Path.GetDirectoryName(target_path));
                File.Copy(main_package_build_info, target_path);
            }

            //package version info
            var main_package_version_info = VFSUtil.GetMainPackage_VersionInfo_Path(packages_root_path);

            if (File.Exists(main_package_version_info))
            {
                string target_path = VFSUtil.GetMainPackage_VersionInfo_Path(Path.Combine(stream_root_path, platform_name));
                XFile.DeleteIfExists(target_path);
                XDirectory.CreateIfNotExists(Path.GetDirectoryName(target_path));
                File.Copy(main_package_version_info, target_path);
            }

            //vfs config
            var vfs_config_path = VFSUtil.GetVFSConfigFilePath_InPackages(packages_root_path);

            if (File.Exists(vfs_config_path))
            {
                string target_path = VFSUtil.GetVFSConfigFilePath_InPackages(Path.Combine(stream_root_path, platform_name));
                XFile.DeleteIfExists(target_path);
                XDirectory.CreateIfNotExists(Path.GetDirectoryName(target_path));
                File.Copy(vfs_config_path, target_path, true);
            }
        }