//------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 loyalsoft. All rights reserved.
// Homepage: http://www.game7000.com/
// Feedback: http://www.game7000.com/
//------------------------------------------------------------
using GameFramework;
using GameFramework.Event;
using GameFramework.Sound;
namespace UnityGameFramework.Runtime
{
///
/// 播放声音失败事件。
///
public sealed class PlaySoundFailureEventArgs : GameEventArgs
{
///
/// 播放声音失败事件编号。
///
public static readonly int EventId = typeof(PlaySoundFailureEventArgs).GetHashCode();
///
/// 初始化播放声音失败事件的新实例。
///
public PlaySoundFailureEventArgs()
{
SerialId = 0;
SoundAssetName = null;
SoundGroupName = null;
PlaySoundParams = null;
BindingEntity = null;
ErrorCode = 0;
ErrorMessage = null;
UserData = null;
}
///
/// 获取播放声音失败事件编号。
///
public override int Id
{
get
{
return EventId;
}
}
///
/// 获取声音的序列编号。
///
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 Entity BindingEntity
{
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(GameFramework.Sound.PlaySoundFailureEventArgs e)
{
PlaySoundInfo playSoundInfo = (PlaySoundInfo)e.UserData;
PlaySoundFailureEventArgs playSoundFailureEventArgs = ReferencePool.Acquire();
playSoundFailureEventArgs.SerialId = e.SerialId;
playSoundFailureEventArgs.SoundAssetName = e.SoundAssetName;
playSoundFailureEventArgs.SoundGroupName = e.SoundGroupName;
playSoundFailureEventArgs.PlaySoundParams = e.PlaySoundParams;
playSoundFailureEventArgs.BindingEntity = playSoundInfo.BindingEntity;
playSoundFailureEventArgs.ErrorCode = e.ErrorCode;
playSoundFailureEventArgs.ErrorMessage = e.ErrorMessage;
playSoundFailureEventArgs.UserData = playSoundInfo.UserData;
ReferencePool.Release(playSoundInfo);
return playSoundFailureEventArgs;
}
///
/// 清理播放声音失败事件。
///
public override void Clear()
{
SerialId = 0;
SoundAssetName = null;
SoundGroupName = null;
PlaySoundParams = null;
BindingEntity = null;
ErrorCode = 0;
ErrorMessage = null;
UserData = null;
}
}
}