/// <summary> /// 根据文件夹和文件名称,自动判断Mapper或者在Stream任意位置,总之读取到你想要的文件 /// 文件读取顺序,Mapper Persist,Mapper Stream,源文件 Persist,源文件 Stream /// PS!本API没有做单文件边界判断,读取的时候需要通过FileInfo自行判断是否读多了,避免读出超过单文件的边界到下个文件,产生解析错误。 /// </summary> public Stream GetFileStream(string fileName, out eFileMapperLoaderPosType pos) { pos = eFileMapperLoaderPosType.None; var info = GetFileInfo(fileName); if (info != null) { UnityFileLoaderHelper.eFileLoaderPosType filePos; var bs = UnityFileLoaderHelper.ReadFileByStream(Dir, info.GetMappedFileName(), out filePos, info.Offset); if (filePos == UnityFileLoaderHelper.eFileLoaderPosType.PersistAsset) { pos = eFileMapperLoaderPosType.MapperAsset_PersistAsset; } if (filePos == UnityFileLoaderHelper.eFileLoaderPosType.StreamAsset) { pos = eFileMapperLoaderPosType.MapperAsset_StreamAsset; } return(bs); } else { UnityFileLoaderHelper.eFileLoaderPosType filePos; var bs = UnityFileLoaderHelper.ReadFileByStream(Dir, fileName, out filePos); if (filePos == UnityFileLoaderHelper.eFileLoaderPosType.PersistAsset) { pos = eFileMapperLoaderPosType.PersistAsset; } if (filePos == UnityFileLoaderHelper.eFileLoaderPosType.StreamAsset) { pos = eFileMapperLoaderPosType.StreamAsset; } return(bs); } }