PlaySoundFailureEventArgs.cs 4.0 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.Sound
  8. {
  9. /// <summary>
  10. /// 播放声音失败事件。
  11. /// </summary>
  12. public sealed class PlaySoundFailureEventArgs : GameFrameworkEventArgs
  13. {
  14. /// <summary>
  15. /// 初始化播放声音失败事件的新实例。
  16. /// </summary>
  17. public PlaySoundFailureEventArgs()
  18. {
  19. SerialId = 0;
  20. SoundAssetName = null;
  21. SoundGroupName = null;
  22. PlaySoundParams = null;
  23. ErrorCode = PlaySoundErrorCode.Unknown;
  24. ErrorMessage = null;
  25. UserData = null;
  26. }
  27. /// <summary>
  28. /// 获取声音的序列编号。
  29. /// </summary>
  30. public int SerialId
  31. {
  32. get;
  33. private set;
  34. }
  35. /// <summary>
  36. /// 获取声音资源名称。
  37. /// </summary>
  38. public string SoundAssetName
  39. {
  40. get;
  41. private set;
  42. }
  43. /// <summary>
  44. /// 获取声音组名称。
  45. /// </summary>
  46. public string SoundGroupName
  47. {
  48. get;
  49. private set;
  50. }
  51. /// <summary>
  52. /// 获取播放声音参数。
  53. /// </summary>
  54. public PlaySoundParams PlaySoundParams
  55. {
  56. get;
  57. private set;
  58. }
  59. /// <summary>
  60. /// 获取错误码。
  61. /// </summary>
  62. public PlaySoundErrorCode ErrorCode
  63. {
  64. get;
  65. private set;
  66. }
  67. /// <summary>
  68. /// 获取错误信息。
  69. /// </summary>
  70. public string ErrorMessage
  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="serialId">声音的序列编号。</param>
  87. /// <param name="soundAssetName">声音资源名称。</param>
  88. /// <param name="soundGroupName">声音组名称。</param>
  89. /// <param name="playSoundParams">播放声音参数。</param>
  90. /// <param name="errorCode">错误码。</param>
  91. /// <param name="errorMessage">错误信息。</param>
  92. /// <param name="userData">用户自定义数据。</param>
  93. /// <returns>创建的播放声音失败事件。</returns>
  94. public static PlaySoundFailureEventArgs Create(int serialId, string soundAssetName, string soundGroupName, PlaySoundParams playSoundParams, PlaySoundErrorCode errorCode, string errorMessage, object userData)
  95. {
  96. PlaySoundFailureEventArgs playSoundFailureEventArgs = ReferencePool.Acquire<PlaySoundFailureEventArgs>();
  97. playSoundFailureEventArgs.SerialId = serialId;
  98. playSoundFailureEventArgs.SoundAssetName = soundAssetName;
  99. playSoundFailureEventArgs.SoundGroupName = soundGroupName;
  100. playSoundFailureEventArgs.PlaySoundParams = playSoundParams;
  101. playSoundFailureEventArgs.ErrorCode = errorCode;
  102. playSoundFailureEventArgs.ErrorMessage = errorMessage;
  103. playSoundFailureEventArgs.UserData = userData;
  104. return playSoundFailureEventArgs;
  105. }
  106. /// <summary>
  107. /// 清理播放声音失败事件。
  108. /// </summary>
  109. public override void Clear()
  110. {
  111. SerialId = 0;
  112. SoundAssetName = null;
  113. SoundGroupName = null;
  114. PlaySoundParams = null;
  115. ErrorCode = PlaySoundErrorCode.Unknown;
  116. ErrorMessage = null;
  117. UserData = null;
  118. }
  119. }
  120. }