private void OnPlaySoundFailure(object sender, GameFramework.Sound.PlaySoundFailureEventArgs e) { string logMessage = Utility.Text.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); } m_EventComponent.Fire(this, PlaySoundFailureEventArgs.Create(e)); }
/// <summary> /// 创建播放声音失败事件。 /// </summary> /// <param name="e">内部事件。</param> /// <returns>创建的播放声音失败事件。</returns> public static PlaySoundFailureEventArgs Create(GameFramework.Sound.PlaySoundFailureEventArgs e) { PlaySoundInfo playSoundInfo = (PlaySoundInfo)e.UserData; PlaySoundFailureEventArgs playSoundFailureEventArgs = ReferencePool.Acquire <PlaySoundFailureEventArgs>(); playSoundFailureEventArgs.SerialId = e.SerialId; playSoundFailureEventArgs.SoundAssetName = e.SoundAssetName; playSoundFailureEventArgs.SoundGroupName = e.SoundGroupName; playSoundFailureEventArgs.PlaySoundParams = e.PlaySoundParams; playSoundFailureEventArgs.BindingEntity = playSoundInfo.BindingEntity; playSoundFailureEventArgs.ErrorCode = e.ErrorCode; playSoundFailureEventArgs.ErrorMessage = e.ErrorMessage; playSoundFailureEventArgs.UserData = playSoundInfo.UserData; ReferencePool.Release(playSoundInfo); return(playSoundFailureEventArgs); }