Beispiel #1
0
 private void OnPlaySoundUpdate(object sender, GameFramework.Sound.PlaySoundUpdateEventArgs e)
 {
     if (m_EnablePlaySoundUpdateEvent)
     {
         m_EventComponent.Fire(this, new PlaySoundUpdateEventArgs(e));
     }
 }
Beispiel #2
0
 private void OnPlaySoundUpdate(object sender, GameFramework.Sound.PlaySoundUpdateEventArgs e)
 {
     if (m_EnablePlaySoundUpdateEvent)
     {
         m_EventComponent.Fire(this, ReferencePool.Acquire <PlaySoundUpdateEventArgs>().Fill(e));
     }
 }
        /// <summary>
        /// 初始化播放声音更新事件的新实例。
        /// </summary>
        /// <param name="e">内部事件。</param>
        public PlaySoundUpdateEventArgs(GameFramework.Sound.PlaySoundUpdateEventArgs e)
        {
            PlaySoundInfo playSoundInfo = (PlaySoundInfo)e.UserData;

            SerialId        = e.SerialId;
            SoundAssetName  = e.SoundAssetName;
            SoundGroupName  = e.SoundGroupName;
            PlaySoundParams = e.PlaySoundParams;
            Progress        = e.Progress;
            BindingEntity   = playSoundInfo.BindingEntity;
            UserData        = playSoundInfo.UserData;
        }
        /// <summary>
        /// 创建播放声音更新事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的播放声音更新事件。</returns>
        public static PlaySoundUpdateEventArgs Create(GameFramework.Sound.PlaySoundUpdateEventArgs e)
        {
            PlaySoundInfo            playSoundInfo            = (PlaySoundInfo)e.UserData;
            PlaySoundUpdateEventArgs playSoundUpdateEventArgs = ReferencePool.Acquire <PlaySoundUpdateEventArgs>();

            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);
        }
        private void LoadAssetUpdateCallback(string soundAssetName, float progress, object userData)
        {
            PlaySoundInfo playSoundInfo = (PlaySoundInfo)userData;

            if (playSoundInfo == null)
            {
                throw new GameFrameworkException("Play sound info is invalid.");
            }

            if (m_PlaySoundUpdateEventHandler != null)
            {
                PlaySoundUpdateEventArgs playSoundUpdateEventArgs = PlaySoundUpdateEventArgs.Create(playSoundInfo.SerialId, soundAssetName, playSoundInfo.SoundGroup.Name, playSoundInfo.PlaySoundParams, progress, playSoundInfo.UserData);
                m_PlaySoundUpdateEventHandler(this, playSoundUpdateEventArgs);
                ReferencePool.Release(playSoundUpdateEventArgs);
            }
        }
 private void OnPlaySoundUpdate(object sender, GameFramework.Sound.PlaySoundUpdateEventArgs e)
 {
     m_EventComponent.Fire(this, PlaySoundUpdateEventArgs.Create(e));
 }