ShowEntityDependencyAssetEventArgs.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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.Entity
  8. {
  9. /// <summary>
  10. /// 显示实体时加载依赖资源事件。
  11. /// </summary>
  12. public sealed class ShowEntityDependencyAssetEventArgs : GameFrameworkEventArgs
  13. {
  14. /// <summary>
  15. /// 初始化显示实体时加载依赖资源事件的新实例。
  16. /// </summary>
  17. public ShowEntityDependencyAssetEventArgs()
  18. {
  19. EntityId = 0;
  20. EntityAssetName = null;
  21. EntityGroupName = null;
  22. DependencyAssetName = null;
  23. LoadedCount = 0;
  24. TotalCount = 0;
  25. UserData = null;
  26. }
  27. /// <summary>
  28. /// 获取实体编号。
  29. /// </summary>
  30. public int EntityId
  31. {
  32. get;
  33. private set;
  34. }
  35. /// <summary>
  36. /// 获取实体资源名称。
  37. /// </summary>
  38. public string EntityAssetName
  39. {
  40. get;
  41. private set;
  42. }
  43. /// <summary>
  44. /// 获取实体组名称。
  45. /// </summary>
  46. public string EntityGroupName
  47. {
  48. get;
  49. private set;
  50. }
  51. /// <summary>
  52. /// 获取被加载的依赖资源名称。
  53. /// </summary>
  54. public string DependencyAssetName
  55. {
  56. get;
  57. private set;
  58. }
  59. /// <summary>
  60. /// 获取当前已加载依赖资源数量。
  61. /// </summary>
  62. public int LoadedCount
  63. {
  64. get;
  65. private set;
  66. }
  67. /// <summary>
  68. /// 获取总共加载依赖资源数量。
  69. /// </summary>
  70. public int TotalCount
  71. {
  72. get;
  73. private set;
  74. }
  75. /// <summary>
  76. /// 获取用户自定义数据。
  77. /// </summary>
  78. public object UserData
  79. {
  80. get;
  81. private set;
  82. }
  83. /// <summary>
  84. /// 创建显示实体时加载依赖资源事件。
  85. /// </summary>
  86. /// <param name="entityId">实体编号。</param>
  87. /// <param name="entityAssetName">实体资源名称。</param>
  88. /// <param name="entityGroupName">实体组名称。</param>
  89. /// <param name="dependencyAssetName">被加载的依赖资源名称。</param>
  90. /// <param name="loadedCount">当前已加载依赖资源数量。</param>
  91. /// <param name="totalCount">总共加载依赖资源数量。</param>
  92. /// <param name="userData">用户自定义数据。</param>
  93. /// <returns>创建的显示实体时加载依赖资源事件。</returns>
  94. public static ShowEntityDependencyAssetEventArgs Create(int entityId, string entityAssetName, string entityGroupName, string dependencyAssetName, int loadedCount, int totalCount, object userData)
  95. {
  96. ShowEntityDependencyAssetEventArgs showEntityDependencyAssetEventArgs = ReferencePool.Acquire<ShowEntityDependencyAssetEventArgs>();
  97. showEntityDependencyAssetEventArgs.EntityId = entityId;
  98. showEntityDependencyAssetEventArgs.EntityAssetName = entityAssetName;
  99. showEntityDependencyAssetEventArgs.EntityGroupName = entityGroupName;
  100. showEntityDependencyAssetEventArgs.DependencyAssetName = dependencyAssetName;
  101. showEntityDependencyAssetEventArgs.LoadedCount = loadedCount;
  102. showEntityDependencyAssetEventArgs.TotalCount = totalCount;
  103. showEntityDependencyAssetEventArgs.UserData = userData;
  104. return showEntityDependencyAssetEventArgs;
  105. }
  106. /// <summary>
  107. /// 清理显示实体时加载依赖资源事件。
  108. /// </summary>
  109. public override void Clear()
  110. {
  111. EntityId = 0;
  112. EntityAssetName = null;
  113. EntityGroupName = null;
  114. DependencyAssetName = null;
  115. LoadedCount = 0;
  116. TotalCount = 0;
  117. UserData = null;
  118. }
  119. }
  120. }