//------------------------------------------------------------ // Game Framework // Copyright © 2013-2021 loyalsoft. All rights reserved. // Homepage: http://www.game7000.com/ // Feedback: http://www.game7000.com/ //------------------------------------------------------------ namespace GameFramework.Resource { internal sealed partial class ResourceManager : GameFrameworkModule, IResourceManager { /// /// 资源信息。 /// private sealed class ResourceInfo { private readonly ResourceName m_ResourceName; private readonly string m_FileSystemName; private readonly LoadType m_LoadType; private readonly int m_Length; private readonly int m_HashCode; private readonly int m_CompressedLength; private readonly bool m_StorageInReadOnly; private bool m_Ready; /// /// 初始化资源信息的新实例。 /// /// 资源名称。 /// 文件系统名称。 /// 资源加载方式。 /// 资源大小。 /// 资源哈希值。 /// 压缩后资源大小。 /// 资源是否在只读区。 /// 资源是否准备完毕。 public ResourceInfo(ResourceName resourceName, string fileSystemName, LoadType loadType, int length, int hashCode, int compressedLength, bool storageInReadOnly, bool ready) { m_ResourceName = resourceName; m_FileSystemName = fileSystemName; m_LoadType = loadType; m_Length = length; m_HashCode = hashCode; m_CompressedLength = compressedLength; m_StorageInReadOnly = storageInReadOnly; m_Ready = ready; } /// /// 获取资源名称。 /// public ResourceName ResourceName { get { return m_ResourceName; } } /// /// 获取资源是否使用文件系统。 /// public bool UseFileSystem { get { return !string.IsNullOrEmpty(m_FileSystemName); } } /// /// 获取文件系统名称。 /// public string FileSystemName { get { return m_FileSystemName; } } /// /// 获取资源是否通过二进制方式加载。 /// public bool IsLoadFromBinary { get { return m_LoadType == LoadType.LoadFromBinary || m_LoadType == LoadType.LoadFromBinaryAndQuickDecrypt || m_LoadType == LoadType.LoadFromBinaryAndDecrypt; } } /// /// 获取资源加载方式。 /// public LoadType LoadType { get { return m_LoadType; } } /// /// 获取资源大小。 /// public int Length { get { return m_Length; } } /// /// 获取资源哈希值。 /// public int HashCode { get { return m_HashCode; } } /// /// 获取压缩后资源大小。 /// public int CompressedLength { get { return m_CompressedLength; } } /// /// 获取资源是否在只读区。 /// public bool StorageInReadOnly { get { return m_StorageInReadOnly; } } /// /// 获取资源是否准备完毕。 /// public bool Ready { get { return m_Ready; } } /// /// 标记资源准备完毕。 /// public void MarkReady() { m_Ready = true; } } } }