//------------------------------------------------------------
// 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 PlaySoundUpdateEventArgs : GameEventArgs
{
///
/// 播放声音更新事件编号。
///
public static readonly int EventId = typeof(PlaySoundUpdateEventArgs).GetHashCode();
///
/// 初始化播放声音更新事件的新实例。
///
public PlaySoundUpdateEventArgs()
{
SerialId = 0;
SoundAssetName = null;
SoundGroupName = null;
PlaySoundParams = null;
Progress = 0f;
BindingEntity = 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 float Progress
{
get;
private set;
}
///
/// 获取声音绑定的实体。
///
public Entity BindingEntity
{
get;
private set;
}
///
/// 获取用户自定义数据。
///
public object UserData
{
get;
private set;
}
///
/// 创建播放声音更新事件。
///
/// 内部事件。
/// 创建的播放声音更新事件。
public static PlaySoundUpdateEventArgs Create(GameFramework.Sound.PlaySoundUpdateEventArgs e)
{
PlaySoundInfo playSoundInfo = (PlaySoundInfo)e.UserData;
PlaySoundUpdateEventArgs playSoundUpdateEventArgs = ReferencePool.Acquire();
playSoundUpdateEventArgs.SerialId = e.SerialId;
playSoundUpdateEventArgs.SoundAssetName = e.SoundAssetName;
playSoundUpdateEventArgs.SoundGroupName = e.SoundGroupName;
playSoundUpdateEventArgs.PlaySoundParams = e.PlaySoundParams;
playSoundUpdateEventArgs.Progress = e.Progress;
playSoundUpdateEventArgs.BindingEntity = playSoundInfo.BindingEntity;
playSoundUpdateEventArgs.UserData = playSoundInfo.UserData;
return playSoundUpdateEventArgs;
}
///
/// 清理播放声音更新事件。
///
public override void Clear()
{
SerialId = 0;
SoundAssetName = null;
SoundGroupName = null;
PlaySoundParams = null;
Progress = 0f;
BindingEntity = null;
UserData = null;
}
}
}