OpenUIFormDependencyAssetEventArgs.cs 4.6 KB

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