Esempio n. 1
0
        /// <summary>
        /// 填充播放声音成功事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>播放声音成功事件。</returns>
        public PlaySoundSuccessEventArgs Fill(Ash.Core.Sound.PlaySoundSuccessEventArgs e)
        {
            PlaySoundInfo playSoundInfo = (PlaySoundInfo)e.UserData;

            SerialId       = e.SerialId;
            SoundAssetName = e.SoundAssetName;
            SoundAgent     = e.SoundAgent;
            Duration       = e.Duration;
            BindingEntity  = playSoundInfo.BindingEntity;
            UserData       = playSoundInfo.UserData;

            return(this);
        }
Esempio n. 2
0
        private void OnPlaySoundSuccess(object sender, Ash.Core.Sound.PlaySoundSuccessEventArgs e)
        {
            PlaySoundInfo playSoundInfo = (PlaySoundInfo)e.UserData;

            if (playSoundInfo != null)
            {
                SoundAgentHelperBase soundAgentHelper = (SoundAgentHelperBase)e.SoundAgent.Helper;
                if (playSoundInfo.BindingEntity != null)
                {
                    soundAgentHelper.SetBindingEntity(playSoundInfo.BindingEntity);
                }
                else
                {
                    soundAgentHelper.SetWorldPosition(playSoundInfo.WorldPosition);
                }
            }

            if (m_EnablePlaySoundSuccessEvent)
            {
                m_EventComponent.Fire(this, ReferencePool.Acquire <PlaySoundSuccessEventArgs>().Fill(e));
            }
        }