//アセットバンドルのリストを取得 List <MainAssetInfo> GetAssetBudleList(AssetFileManagerSettings settings) { List <MainAssetInfo> assets = new List <MainAssetInfo>(); //指定ディレクトリ以下のアセットを全て取得 MainAssetInfo inputDirAsset = new MainAssetInfo(AssetBundleDirectory); foreach (MainAssetInfo asset in inputDirAsset.GetAllChidren()) { if (asset.IsDirectory) { continue; } if (IsIgnoreAssetBundle(asset)) { continue; } AssetFileSetting assetFileSetting = settings.FindSettingFromPath(asset.AssetPath); AssetFileEncodeType encodeType = assetFileSetting.EncodeType; switch (encodeType) { case AssetFileEncodeType.AssetBundle: assets.Add(asset); break; default: break; } } return(assets); }
//ファイルのパスから、ファイル情報を取得 public bool TryGetValue(string filePath, AssetFileEncodeType encodeType, out ConvertFileInfo info) { info = null; foreach (ConvertFileList infoList in infoLists) { if (infoList.TryGetValue(filePath, encodeType, out info)) { return(true); } } return(false); }
//リソースファイルをバージョンアップ public void VersionUpResouces(string keyFiles, Object resourcesDir, bool isOnlyNew) { //指定ディレクトリ以下のアセットを全て取得 MainAssetInfo inputDirAsset = new MainAssetInfo(resourcesDir); List <MainAssetInfo> assets = inputDirAsset.GetAllChidren(); string inputDir = inputDirAsset.AssetPath; List <ConvertFileList.CusomFileVersionUpInfo> customFileVersionUpInfoList = new List <ConvertFileList.CusomFileVersionUpInfo>(); int convertFileCount = 0; int versionUpCount = 0; foreach (MainAssetInfo asset in assets) { if (asset.IsDirectory) { continue; } AssetFileSetting assetFileSetting = Settings.FindSettingFromPath(asset.AssetPath); AssetFileEncodeType encodeType = assetFileSetting.EncodeType; switch (encodeType) { case AssetFileEncodeType.AlreadyEncoded: { ++convertFileCount; bool isVersionUp = TryConvertToUtageFile(asset, inputDir, isOnlyNew); if (isVersionUp) { ++versionUpCount; } string fileKey = FilePathUtil.RemoveDirectory(asset.AssetPath, inputDir); customFileVersionUpInfoList.Add(new ConvertFileList.CusomFileVersionUpInfo(fileKey, isVersionUp)); } break; default: break; } } ConvertFileList.EditorVersionUp(keyFiles, customFileVersionUpInfoList); Debug.Log(string.Format("{0}/{1}files version up", versionUpCount, convertFileCount)); }
//ファイルのパスから、ファイル情報を取得 public bool TryGetValue(string filePath, AssetFileEncodeType encodeType, out ConvertFileInfo info) { info = null; switch (encodeType) { case AssetFileEncodeType.AlreadyEncoded: if (!FilePathUtil.IsUnderDirectory(filePath, DirectoryPath)) { return(false); } string fileKey = FilePathUtil.RemoveDirectory(filePath, DirectoryPath); foreach (var files in FileLists.Values) { if (files.TryGetValue(fileKey, out info)) { return(true); } } return(false); case AssetFileEncodeType.AssetBundle: string assetName = FilePathUtil.GetFileNameWithoutExtension(filePath).ToLower(); string keyPlatform = AssetBundleHelper.RuntimeAssetBundleTraget().ToString(); ConvertFileInfoDictionary infoList; if (FileLists.TryGetValue(keyPlatform, out infoList)) { if (infoList.TryGetValue(assetName, out info)) { return(true); } } return(false); default: return(false); } }