123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- //------------------------------------------------------------
- // Game Framework
- // Copyright © 2013-2021 loyalsoft. All rights reserved.
- // Homepage: http://www.game7000.com/
- // Feedback: http://www.game7000.com/
- //------------------------------------------------------------
- namespace GameFramework.Sound
- {
- /// <summary>
- /// 播放声音失败事件。
- /// </summary>
- public sealed class PlaySoundFailureEventArgs : GameFrameworkEventArgs
- {
- /// <summary>
- /// 初始化播放声音失败事件的新实例。
- /// </summary>
- public PlaySoundFailureEventArgs()
- {
- SerialId = 0;
- SoundAssetName = null;
- SoundGroupName = null;
- PlaySoundParams = null;
- ErrorCode = PlaySoundErrorCode.Unknown;
- ErrorMessage = null;
- UserData = null;
- }
- /// <summary>
- /// 获取声音的序列编号。
- /// </summary>
- public int SerialId
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取声音资源名称。
- /// </summary>
- public string SoundAssetName
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取声音组名称。
- /// </summary>
- public string SoundGroupName
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取播放声音参数。
- /// </summary>
- public PlaySoundParams PlaySoundParams
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取错误码。
- /// </summary>
- public PlaySoundErrorCode ErrorCode
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取错误信息。
- /// </summary>
- public string ErrorMessage
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取用户自定义数据。
- /// </summary>
- public object UserData
- {
- get;
- private set;
- }
- /// <summary>
- /// 创建播放声音失败事件。
- /// </summary>
- /// <param name="serialId">声音的序列编号。</param>
- /// <param name="soundAssetName">声音资源名称。</param>
- /// <param name="soundGroupName">声音组名称。</param>
- /// <param name="playSoundParams">播放声音参数。</param>
- /// <param name="errorCode">错误码。</param>
- /// <param name="errorMessage">错误信息。</param>
- /// <param name="userData">用户自定义数据。</param>
- /// <returns>创建的播放声音失败事件。</returns>
- public static PlaySoundFailureEventArgs Create(int serialId, string soundAssetName, string soundGroupName, PlaySoundParams playSoundParams, PlaySoundErrorCode errorCode, string errorMessage, object userData)
- {
- PlaySoundFailureEventArgs playSoundFailureEventArgs = ReferencePool.Acquire<PlaySoundFailureEventArgs>();
- playSoundFailureEventArgs.SerialId = serialId;
- playSoundFailureEventArgs.SoundAssetName = soundAssetName;
- playSoundFailureEventArgs.SoundGroupName = soundGroupName;
- playSoundFailureEventArgs.PlaySoundParams = playSoundParams;
- playSoundFailureEventArgs.ErrorCode = errorCode;
- playSoundFailureEventArgs.ErrorMessage = errorMessage;
- playSoundFailureEventArgs.UserData = userData;
- return playSoundFailureEventArgs;
- }
- /// <summary>
- /// 清理播放声音失败事件。
- /// </summary>
- public override void Clear()
- {
- SerialId = 0;
- SoundAssetName = null;
- SoundGroupName = null;
- PlaySoundParams = null;
- ErrorCode = PlaySoundErrorCode.Unknown;
- ErrorMessage = null;
- UserData = null;
- }
- }
- }
|