コード例 #1
0
        /// <summary>
        /// 填充播放声音失败事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>播放声音失败事件。</returns>
        public PlaySoundFailureEventArgs Fill(Ash.Core.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);
        }
コード例 #2
0
ファイル: SoundComponent.cs プロジェクト: huangjk/Ash
        private void OnPlaySoundFailure(object sender, Ash.Core.Sound.PlaySoundFailureEventArgs e)
        {
            string logMessage = string.Format("Play sound failure, asset name '{0}', sound group name '{1}', error code '{2}', error message '{3}'.", e.SoundAssetName, e.SoundGroupName, e.ErrorCode.ToString(), e.ErrorMessage);

            if (e.ErrorCode == PlaySoundErrorCode.IgnoredDueToLowPriority)
            {
                Log.Info(logMessage);
            }
            else
            {
                Log.Warning(logMessage);
            }

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