Esempio n. 1
0
        /// <summary>
        /// 填充播放声音成功事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>播放声音成功事件。</returns>
        public PlaySoundSuccessEventArgs Fill(GameFramework.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);
        }
        /// <summary>
        /// 填充播放声音更新事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>播放声音更新事件。</returns>
        public PlaySoundUpdateEventArgs Fill(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;

            return(this);
        }
        /// <summary>
        /// 填充播放声音失败事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>播放声音失败事件。</returns>
        public PlaySoundFailureEventArgs Fill(GameFramework.Sound.PlaySoundFailureEventArgs e)
        {
            PlaySoundInfo playSoundInfo = (PlaySoundInfo)e.UserData;

            SerialId        = e.SerialId;
            SoundAssetName  = e.SoundAssetName;
            SoundGroupName  = e.SoundGroupName;
            PlaySoundParams = e.PlaySoundParams;
            BindingEntity   = playSoundInfo.BindingEntity;
            ErrorCode       = e.ErrorCode;
            ErrorMessage    = e.ErrorMessage;
            UserData        = playSoundInfo.UserData;

            return(this);
        }
        /// <summary>
        /// 填充播放声音时加载依赖资源事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>播放声音时加载依赖资源事件。</returns>
        public PlaySoundDependencyAssetEventArgs Fill(GameFramework.Sound.PlaySoundDependencyAssetEventArgs e)
        {
            PlaySoundInfo playSoundInfo = (PlaySoundInfo)e.UserData;

            SerialId            = e.SerialId;
            SoundAssetName      = e.SoundAssetName;
            SoundGroupName      = e.SoundGroupName;
            PlaySoundParams     = e.PlaySoundParams;
            DependencyAssetName = e.DependencyAssetName;
            LoadedCount         = e.LoadedCount;
            TotalCount          = e.TotalCount;
            BindingEntity       = playSoundInfo.BindingEntity;
            UserData            = playSoundInfo.UserData;

            return(this);
        }
Esempio n. 5
0
        private void OnPlaySoundSuccess(object sender, GameFramework.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));
            }
        }