123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- //------------------------------------------------------------
- // 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 PlaySoundSuccessEventArgs : GameFrameworkEventArgs
- {
- /// <summary>
- /// 初始化播放声音成功事件的新实例。
- /// </summary>
- public PlaySoundSuccessEventArgs()
- {
- SerialId = 0;
- SoundAssetName = null;
- SoundAgent = null;
- Duration = 0f;
- UserData = null;
- }
- /// <summary>
- /// 获取声音的序列编号。
- /// </summary>
- public int SerialId
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取声音资源名称。
- /// </summary>
- public string SoundAssetName
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取用于播放的声音代理。
- /// </summary>
- public ISoundAgent SoundAgent
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取加载持续时间。
- /// </summary>
- public float Duration
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取用户自定义数据。
- /// </summary>
- public object UserData
- {
- get;
- private set;
- }
- /// <summary>
- /// 创建播放声音成功事件。
- /// </summary>
- /// <param name="serialId">声音的序列编号。</param>
- /// <param name="soundAssetName">声音资源名称。</param>
- /// <param name="soundAgent">用于播放的声音代理。</param>
- /// <param name="duration">加载持续时间。</param>
- /// <param name="userData">用户自定义数据。</param>
- /// <returns>创建的播放声音成功事件。</returns>
- public static PlaySoundSuccessEventArgs Create(int serialId, string soundAssetName, ISoundAgent soundAgent, float duration, object userData)
- {
- PlaySoundSuccessEventArgs playSoundSuccessEventArgs = ReferencePool.Acquire<PlaySoundSuccessEventArgs>();
- playSoundSuccessEventArgs.SerialId = serialId;
- playSoundSuccessEventArgs.SoundAssetName = soundAssetName;
- playSoundSuccessEventArgs.SoundAgent = soundAgent;
- playSoundSuccessEventArgs.Duration = duration;
- playSoundSuccessEventArgs.UserData = userData;
- return playSoundSuccessEventArgs;
- }
- /// <summary>
- /// 清理播放声音成功事件。
- /// </summary>
- public override void Clear()
- {
- SerialId = 0;
- SoundAssetName = null;
- SoundAgent = null;
- Duration = 0f;
- UserData = null;
- }
- }
- }
|