ResourceUpdateSuccessEventArgs.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 ResourceUpdateSuccessEventArgs : GameEventArgs
  15. {
  16. /// <summary>
  17. /// 资源更新成功事件编号。
  18. /// </summary>
  19. public static readonly int EventId = typeof(ResourceUpdateSuccessEventArgs).GetHashCode();
  20. /// <summary>
  21. /// 初始化资源更新成功事件的新实例。
  22. /// </summary>
  23. public ResourceUpdateSuccessEventArgs()
  24. {
  25. Name = null;
  26. DownloadPath = null;
  27. DownloadUri = null;
  28. Length = 0;
  29. CompressedLength = 0;
  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 DownloadPath
  53. {
  54. get;
  55. private set;
  56. }
  57. /// <summary>
  58. /// 获取下载地址。
  59. /// </summary>
  60. public string DownloadUri
  61. {
  62. get;
  63. private set;
  64. }
  65. /// <summary>
  66. /// 获取资源大小。
  67. /// </summary>
  68. public int Length
  69. {
  70. get;
  71. private set;
  72. }
  73. /// <summary>
  74. /// 获取压缩后大小。
  75. /// </summary>
  76. public int CompressedLength
  77. {
  78. get;
  79. private set;
  80. }
  81. /// <summary>
  82. /// 创建资源更新成功事件。
  83. /// </summary>
  84. /// <param name="e">内部事件。</param>
  85. /// <returns>创建的资源更新成功事件。</returns>
  86. public static ResourceUpdateSuccessEventArgs Create(GameFramework.Resource.ResourceUpdateSuccessEventArgs e)
  87. {
  88. ResourceUpdateSuccessEventArgs resourceUpdateSuccessEventArgs = ReferencePool.Acquire<ResourceUpdateSuccessEventArgs>();
  89. resourceUpdateSuccessEventArgs.Name = e.Name;
  90. resourceUpdateSuccessEventArgs.DownloadPath = e.DownloadPath;
  91. resourceUpdateSuccessEventArgs.DownloadUri = e.DownloadUri;
  92. resourceUpdateSuccessEventArgs.Length = e.Length;
  93. resourceUpdateSuccessEventArgs.CompressedLength = e.CompressedLength;
  94. return resourceUpdateSuccessEventArgs;
  95. }
  96. /// <summary>
  97. /// 清理资源更新成功事件。
  98. /// </summary>
  99. public override void Clear()
  100. {
  101. Name = null;
  102. DownloadPath = null;
  103. DownloadUri = null;
  104. Length = 0;
  105. CompressedLength = 0;
  106. }
  107. }
  108. }