//独自定義ファイルをバージョンアップする。バージョンアップチェックはしない(Eidtor上のみ使用可能) public void EditorVersionUp(string key, List <CusomFileVersionUpInfo> cusomFileVersionUpInfoList) { ConvertFileInfoDictionary oldInfoList; FileLists.TryGetValue(key, out oldInfoList); ConvertFileInfoDictionary newInfoList = new ConvertFileInfoDictionary(this, key); foreach (var versionUpInfo in cusomFileVersionUpInfoList) { ConvertFileInfo info; if (oldInfoList != null && oldInfoList.TryGetValue(versionUpInfo.Name, out info)) { if (versionUpInfo.IsVersionUp) { info.VersionUp(); } } else { info = new ConvertFileInfo(versionUpInfo.Name, newInfoList); } if (newInfoList.ContainsKey(info.Name)) { Debug.LogError(info.Name + " is already contains "); continue; } newInfoList.Add(info.Name, info); } FileLists.Remove(key); FileLists.Add(key, newInfoList); }
//データをバージョンアップする(Eidtor上のみ使用可能) public int EditorVersionUpAssetBundle(AssetBundleManifest manifest, UnityEditor.BuildTarget buildTarget) { int count = 0; string buildTargetKey = AssetBundleHelper.BuildTargetToBuildTargetFlag(buildTarget).ToString(); ConvertFileInfoDictionary oldInfoList; FileLists.TryGetValue(buildTargetKey, out oldInfoList); ConvertFileInfoDictionary newInfoList = new ConvertFileInfoDictionary(this, buildTargetKey); foreach (string assetBundleName in manifest.GetAllAssetBundles()) { ConvertFileInfo info; if (oldInfoList != null && oldInfoList.TryGetValue(assetBundleName, out info)) { if (info.VersionUp(manifest)) { ++count; } } else { info = new ConvertFileInfo(assetBundleName, manifest, newInfoList); ++count; } newInfoList.Add(info.Name, info); } FileLists.Remove(newInfoList.Key); FileLists.Add(newInfoList.Key, newInfoList); return(count); }
//ファイルのパスから、ファイル情報を取得 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 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); } }