ResourceManager.ResourceUpdater.UpdateInfo.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. //------------------------------------------------------------
  2. // Game Framework
  3. // Copyright © 2013-2021 loyalsoft. All rights reserved.
  4. // Homepage: http://www.game7000.com/
  5. // Feedback: http://www.game7000.com/
  6. //------------------------------------------------------------
  7. namespace GameFramework.Resource
  8. {
  9. internal sealed partial class ResourceManager : GameFrameworkModule, IResourceManager
  10. {
  11. private sealed partial class ResourceUpdater
  12. {
  13. /// <summary>
  14. /// 资源更新信息。
  15. /// </summary>
  16. private sealed class UpdateInfo
  17. {
  18. private readonly ResourceName m_ResourceName;
  19. private readonly string m_FileSystemName;
  20. private readonly LoadType m_LoadType;
  21. private readonly int m_Length;
  22. private readonly int m_HashCode;
  23. private readonly int m_CompressedLength;
  24. private readonly int m_CompressedHashCode;
  25. private readonly string m_ResourcePath;
  26. private bool m_Downloading;
  27. private int m_RetryCount;
  28. /// <summary>
  29. /// 初始化资源更新信息的新实例。
  30. /// </summary>
  31. /// <param name="resourceName">资源名称。</param>
  32. /// <param name="fileSystemName">资源所在的文件系统名称。</param>
  33. /// <param name="loadType">资源加载方式。</param>
  34. /// <param name="length">资源大小。</param>
  35. /// <param name="hashCode">资源哈希值。</param>
  36. /// <param name="compressedLength">压缩后大小。</param>
  37. /// <param name="compressedHashCode">压缩后哈希值。</param>
  38. /// <param name="resourcePath">资源路径。</param>
  39. public UpdateInfo(ResourceName resourceName, string fileSystemName, LoadType loadType, int length, int hashCode, int compressedLength, int compressedHashCode, string resourcePath)
  40. {
  41. m_ResourceName = resourceName;
  42. m_FileSystemName = fileSystemName;
  43. m_LoadType = loadType;
  44. m_Length = length;
  45. m_HashCode = hashCode;
  46. m_CompressedLength = compressedLength;
  47. m_CompressedHashCode = compressedHashCode;
  48. m_ResourcePath = resourcePath;
  49. m_Downloading = false;
  50. m_RetryCount = 0;
  51. }
  52. /// <summary>
  53. /// 获取资源名称。
  54. /// </summary>
  55. public ResourceName ResourceName
  56. {
  57. get
  58. {
  59. return m_ResourceName;
  60. }
  61. }
  62. /// <summary>
  63. /// 获取资源是否使用文件系统。
  64. /// </summary>
  65. public bool UseFileSystem
  66. {
  67. get
  68. {
  69. return !string.IsNullOrEmpty(m_FileSystemName);
  70. }
  71. }
  72. /// <summary>
  73. /// 获取资源所在的文件系统名称。
  74. /// </summary>
  75. public string FileSystemName
  76. {
  77. get
  78. {
  79. return m_FileSystemName;
  80. }
  81. }
  82. /// <summary>
  83. /// 获取资源加载方式。
  84. /// </summary>
  85. public LoadType LoadType
  86. {
  87. get
  88. {
  89. return m_LoadType;
  90. }
  91. }
  92. /// <summary>
  93. /// 获取资源大小。
  94. /// </summary>
  95. public int Length
  96. {
  97. get
  98. {
  99. return m_Length;
  100. }
  101. }
  102. /// <summary>
  103. /// 获取资源哈希值。
  104. /// </summary>
  105. public int HashCode
  106. {
  107. get
  108. {
  109. return m_HashCode;
  110. }
  111. }
  112. /// <summary>
  113. /// 获取压缩后大小。
  114. /// </summary>
  115. public int CompressedLength
  116. {
  117. get
  118. {
  119. return m_CompressedLength;
  120. }
  121. }
  122. /// <summary>
  123. /// 获取压缩后哈希值。
  124. /// </summary>
  125. public int CompressedHashCode
  126. {
  127. get
  128. {
  129. return m_CompressedHashCode;
  130. }
  131. }
  132. /// <summary>
  133. /// 获取资源路径。
  134. /// </summary>
  135. public string ResourcePath
  136. {
  137. get
  138. {
  139. return m_ResourcePath;
  140. }
  141. }
  142. /// <summary>
  143. /// 获取或设置下载状态。
  144. /// </summary>
  145. public bool Downloading
  146. {
  147. get
  148. {
  149. return m_Downloading;
  150. }
  151. set
  152. {
  153. m_Downloading = value;
  154. }
  155. }
  156. /// <summary>
  157. /// 获取或设置已重试次数。
  158. /// </summary>
  159. public int RetryCount
  160. {
  161. get
  162. {
  163. return m_RetryCount;
  164. }
  165. set
  166. {
  167. m_RetryCount = value;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. }