/// <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;
            BindingEntity   = playSoundInfo.BindingEntity;
            Progress        = e.Progress;
            UserData        = playSoundInfo.UserData;

            return(this);
        }
Exemplo n.º 3
0
        /// <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);
        }
        //播放声音成功的回调
        private void OnPlaySoundSuccess(object sender, GameFramework.Sound.PlaySoundSuccessEventArgs e)
        {
            PlaySoundInfo playSoundInfo = e.UserData as PlaySoundInfo;

            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));
            }
        }