ResourceUpdateStartEventArgs.cs 3.7 KB

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