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