ResourceUpdateStartEventArgs.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. /// <summary>
  10. /// 资源更新开始事件。
  11. /// </summary>
  12. public sealed class ResourceUpdateStartEventArgs : GameFrameworkEventArgs
  13. {
  14. /// <summary>
  15. /// 初始化资源更新开始事件的新实例。
  16. /// </summary>
  17. public ResourceUpdateStartEventArgs()
  18. {
  19. Name = null;
  20. DownloadPath = null;
  21. DownloadUri = null;
  22. CurrentLength = 0;
  23. CompressedLength = 0;
  24. RetryCount = 0;
  25. }
  26. /// <summary>
  27. /// 获取资源名称。
  28. /// </summary>
  29. public string Name
  30. {
  31. get;
  32. private set;
  33. }
  34. /// <summary>
  35. /// 获取资源下载后存放路径。
  36. /// </summary>
  37. public string DownloadPath
  38. {
  39. get;
  40. private set;
  41. }
  42. /// <summary>
  43. /// 获取下载地址。
  44. /// </summary>
  45. public string DownloadUri
  46. {
  47. get;
  48. private set;
  49. }
  50. /// <summary>
  51. /// 获取当前下载大小。
  52. /// </summary>
  53. public int CurrentLength
  54. {
  55. get;
  56. private set;
  57. }
  58. /// <summary>
  59. /// 获取压缩后大小。
  60. /// </summary>
  61. public int CompressedLength
  62. {
  63. get;
  64. private set;
  65. }
  66. /// <summary>
  67. /// 获取已重试下载次数。
  68. /// </summary>
  69. public int RetryCount
  70. {
  71. get;
  72. private set;
  73. }
  74. /// <summary>
  75. /// 创建资源更新开始事件。
  76. /// </summary>
  77. /// <param name="name">资源名称。</param>
  78. /// <param name="downloadPath">资源下载后存放路径。</param>
  79. /// <param name="downloadUri">资源下载地址。</param>
  80. /// <param name="currentLength">当前下载大小。</param>
  81. /// <param name="compressedLength">压缩后大小。</param>
  82. /// <param name="retryCount">已重试下载次数。</param>
  83. /// <returns>创建的资源更新开始事件。</returns>
  84. public static ResourceUpdateStartEventArgs Create(string name, string downloadPath, string downloadUri, int currentLength, int compressedLength, int retryCount)
  85. {
  86. ResourceUpdateStartEventArgs resourceUpdateStartEventArgs = ReferencePool.Acquire<ResourceUpdateStartEventArgs>();
  87. resourceUpdateStartEventArgs.Name = name;
  88. resourceUpdateStartEventArgs.DownloadPath = downloadPath;
  89. resourceUpdateStartEventArgs.DownloadUri = downloadUri;
  90. resourceUpdateStartEventArgs.CurrentLength = currentLength;
  91. resourceUpdateStartEventArgs.CompressedLength = compressedLength;
  92. resourceUpdateStartEventArgs.RetryCount = retryCount;
  93. return resourceUpdateStartEventArgs;
  94. }
  95. /// <summary>
  96. /// 清理资源更新开始事件。
  97. /// </summary>
  98. public override void Clear()
  99. {
  100. Name = null;
  101. DownloadPath = null;
  102. DownloadUri = null;
  103. CurrentLength = 0;
  104. CompressedLength = 0;
  105. RetryCount = 0;
  106. }
  107. }
  108. }