ShowEntityUpdateEventArgs.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 ShowEntityUpdateEventArgs : GameEventArgs
  16. {
  17. /// <summary>
  18. /// 显示实体更新事件编号。
  19. /// </summary>
  20. public static readonly int EventId = typeof(ShowEntityUpdateEventArgs).GetHashCode();
  21. /// <summary>
  22. /// 初始化显示实体更新事件的新实例。
  23. /// </summary>
  24. public ShowEntityUpdateEventArgs()
  25. {
  26. EntityId = 0;
  27. EntityLogicType = null;
  28. EntityAssetName = null;
  29. EntityGroupName = null;
  30. Progress = 0f;
  31. UserData = null;
  32. }
  33. /// <summary>
  34. /// 获取显示实体更新事件编号。
  35. /// </summary>
  36. public override int Id
  37. {
  38. get
  39. {
  40. return EventId;
  41. }
  42. }
  43. /// <summary>
  44. /// 获取实体编号。
  45. /// </summary>
  46. public int EntityId
  47. {
  48. get;
  49. private set;
  50. }
  51. /// <summary>
  52. /// 获取实体逻辑类型。
  53. /// </summary>
  54. public Type EntityLogicType
  55. {
  56. get;
  57. private set;
  58. }
  59. /// <summary>
  60. /// 获取实体资源名称。
  61. /// </summary>
  62. public string EntityAssetName
  63. {
  64. get;
  65. private set;
  66. }
  67. /// <summary>
  68. /// 获取实体组名称。
  69. /// </summary>
  70. public string EntityGroupName
  71. {
  72. get;
  73. private set;
  74. }
  75. /// <summary>
  76. /// 获取显示实体进度。
  77. /// </summary>
  78. public float Progress
  79. {
  80. get;
  81. private set;
  82. }
  83. /// <summary>
  84. /// 获取用户自定义数据。
  85. /// </summary>
  86. public object UserData
  87. {
  88. get;
  89. private set;
  90. }
  91. /// <summary>
  92. /// 创建显示实体更新事件。
  93. /// </summary>
  94. /// <param name="e">内部事件。</param>
  95. /// <returns>创建的显示实体更新事件。</returns>
  96. public static ShowEntityUpdateEventArgs Create(GameFramework.Entity.ShowEntityUpdateEventArgs e)
  97. {
  98. ShowEntityInfo showEntityInfo = (ShowEntityInfo)e.UserData;
  99. ShowEntityUpdateEventArgs showEntityUpdateEventArgs = ReferencePool.Acquire<ShowEntityUpdateEventArgs>();
  100. showEntityUpdateEventArgs.EntityId = e.EntityId;
  101. showEntityUpdateEventArgs.EntityLogicType = showEntityInfo.EntityLogicType;
  102. showEntityUpdateEventArgs.EntityAssetName = e.EntityAssetName;
  103. showEntityUpdateEventArgs.EntityGroupName = e.EntityGroupName;
  104. showEntityUpdateEventArgs.Progress = e.Progress;
  105. showEntityUpdateEventArgs.UserData = showEntityInfo.UserData;
  106. return showEntityUpdateEventArgs;
  107. }
  108. /// <summary>
  109. /// 清理显示实体更新事件。
  110. /// </summary>
  111. public override void Clear()
  112. {
  113. EntityId = 0;
  114. EntityLogicType = null;
  115. EntityAssetName = null;
  116. EntityGroupName = null;
  117. Progress = 0f;
  118. UserData = null;
  119. }
  120. }
  121. }