ShowEntityDependencyAssetEventArgs.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. using System;
  10. namespace UnityGameFramework.Runtime
  11. {
  12. /// <summary>
  13. /// 显示实体时加载依赖资源事件。
  14. /// </summary>
  15. public sealed class ShowEntityDependencyAssetEventArgs : GameEventArgs
  16. {
  17. /// <summary>
  18. /// 显示实体时加载依赖资源事件编号。
  19. /// </summary>
  20. public static readonly int EventId = typeof(ShowEntityDependencyAssetEventArgs).GetHashCode();
  21. /// <summary>
  22. /// 初始化显示实体时加载依赖资源事件的新实例。
  23. /// </summary>
  24. public ShowEntityDependencyAssetEventArgs()
  25. {
  26. EntityId = 0;
  27. EntityLogicType = null;
  28. EntityAssetName = null;
  29. EntityGroupName = null;
  30. DependencyAssetName = null;
  31. LoadedCount = 0;
  32. TotalCount = 0;
  33. UserData = null;
  34. }
  35. /// <summary>
  36. /// 获取显示实体时加载依赖资源事件编号。
  37. /// </summary>
  38. public override int Id
  39. {
  40. get
  41. {
  42. return EventId;
  43. }
  44. }
  45. /// <summary>
  46. /// 获取实体编号。
  47. /// </summary>
  48. public int EntityId
  49. {
  50. get;
  51. private set;
  52. }
  53. /// <summary>
  54. /// 获取实体逻辑类型。
  55. /// </summary>
  56. public Type EntityLogicType
  57. {
  58. get;
  59. private set;
  60. }
  61. /// <summary>
  62. /// 获取实体资源名称。
  63. /// </summary>
  64. public string EntityAssetName
  65. {
  66. get;
  67. private set;
  68. }
  69. /// <summary>
  70. /// 获取实体组名称。
  71. /// </summary>
  72. public string EntityGroupName
  73. {
  74. get;
  75. private set;
  76. }
  77. /// <summary>
  78. /// 获取被加载的依赖资源名称。
  79. /// </summary>
  80. public string DependencyAssetName
  81. {
  82. get;
  83. private set;
  84. }
  85. /// <summary>
  86. /// 获取当前已加载依赖资源数量。
  87. /// </summary>
  88. public int LoadedCount
  89. {
  90. get;
  91. private set;
  92. }
  93. /// <summary>
  94. /// 获取总共加载依赖资源数量。
  95. /// </summary>
  96. public int TotalCount
  97. {
  98. get;
  99. private set;
  100. }
  101. /// <summary>
  102. /// 获取用户自定义数据。
  103. /// </summary>
  104. public object UserData
  105. {
  106. get;
  107. private set;
  108. }
  109. /// <summary>
  110. /// 创建显示实体时加载依赖资源事件。
  111. /// </summary>
  112. /// <param name="e">内部事件。</param>
  113. /// <returns>创建的显示实体时加载依赖资源事件。</returns>
  114. public static ShowEntityDependencyAssetEventArgs Create(GameFramework.Entity.ShowEntityDependencyAssetEventArgs e)
  115. {
  116. ShowEntityInfo showEntityInfo = (ShowEntityInfo)e.UserData;
  117. ShowEntityDependencyAssetEventArgs showEntityDependencyAssetEventArgs = ReferencePool.Acquire<ShowEntityDependencyAssetEventArgs>();
  118. showEntityDependencyAssetEventArgs.EntityId = e.EntityId;
  119. showEntityDependencyAssetEventArgs.EntityLogicType = showEntityInfo.EntityLogicType;
  120. showEntityDependencyAssetEventArgs.EntityAssetName = e.EntityAssetName;
  121. showEntityDependencyAssetEventArgs.EntityGroupName = e.EntityGroupName;
  122. showEntityDependencyAssetEventArgs.DependencyAssetName = e.DependencyAssetName;
  123. showEntityDependencyAssetEventArgs.LoadedCount = e.LoadedCount;
  124. showEntityDependencyAssetEventArgs.TotalCount = e.TotalCount;
  125. showEntityDependencyAssetEventArgs.UserData = showEntityInfo.UserData;
  126. return showEntityDependencyAssetEventArgs;
  127. }
  128. /// <summary>
  129. /// 清理显示实体时加载依赖资源事件。
  130. /// </summary>
  131. public override void Clear()
  132. {
  133. EntityId = 0;
  134. EntityLogicType = null;
  135. EntityAssetName = null;
  136. EntityGroupName = null;
  137. DependencyAssetName = null;
  138. LoadedCount = 0;
  139. TotalCount = 0;
  140. UserData = null;
  141. }
  142. }
  143. }