ResourceUpdateChangedEventArgs.cs 3.2 KB

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