ResourceUpdateFailureEventArgs.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 ResourceUpdateFailureEventArgs : GameEventArgs
  15. {
  16. /// <summary>
  17. /// 资源更新失败事件编号。
  18. /// </summary>
  19. public static readonly int EventId = typeof(ResourceUpdateFailureEventArgs).GetHashCode();
  20. /// <summary>
  21. /// 初始化资源更新失败事件的新实例。
  22. /// </summary>
  23. public ResourceUpdateFailureEventArgs()
  24. {
  25. Name = null;
  26. DownloadUri = null;
  27. RetryCount = 0;
  28. TotalRetryCount = 0;
  29. ErrorMessage = null;
  30. }
  31. /// <summary>
  32. /// 获取资源更新失败事件编号。
  33. /// </summary>
  34. public override int Id
  35. {
  36. get
  37. {
  38. return EventId;
  39. }
  40. }
  41. /// <summary>
  42. /// 获取资源名称。
  43. /// </summary>
  44. public string Name
  45. {
  46. get;
  47. private set;
  48. }
  49. /// <summary>
  50. /// 获取下载地址。
  51. /// </summary>
  52. public string DownloadUri
  53. {
  54. get;
  55. private set;
  56. }
  57. /// <summary>
  58. /// 获取已重试次数。
  59. /// </summary>
  60. public int RetryCount
  61. {
  62. get;
  63. private set;
  64. }
  65. /// <summary>
  66. /// 获取设定的重试次数。
  67. /// </summary>
  68. public int TotalRetryCount
  69. {
  70. get;
  71. private set;
  72. }
  73. /// <summary>
  74. /// 获取错误信息。
  75. /// </summary>
  76. public string ErrorMessage
  77. {
  78. get;
  79. private set;
  80. }
  81. /// <summary>
  82. /// 创建资源更新失败事件。
  83. /// </summary>
  84. /// <param name="e">内部事件。</param>
  85. /// <returns>创建的资源更新失败事件。</returns>
  86. public static ResourceUpdateFailureEventArgs Create(GameFramework.Resource.ResourceUpdateFailureEventArgs e)
  87. {
  88. ResourceUpdateFailureEventArgs resourceUpdateFailureEventArgs = ReferencePool.Acquire<ResourceUpdateFailureEventArgs>();
  89. resourceUpdateFailureEventArgs.Name = e.Name;
  90. resourceUpdateFailureEventArgs.DownloadUri = e.DownloadUri;
  91. resourceUpdateFailureEventArgs.RetryCount = e.RetryCount;
  92. resourceUpdateFailureEventArgs.TotalRetryCount = e.TotalRetryCount;
  93. resourceUpdateFailureEventArgs.ErrorMessage = e.ErrorMessage;
  94. return resourceUpdateFailureEventArgs;
  95. }
  96. /// <summary>
  97. /// 清理资源更新失败事件。
  98. /// </summary>
  99. public override void Clear()
  100. {
  101. Name = null;
  102. DownloadUri = null;
  103. RetryCount = 0;
  104. TotalRetryCount = 0;
  105. ErrorMessage = null;
  106. }
  107. }
  108. }