• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MyCueId类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MyCueId的典型用法代码示例。如果您正苦于以下问题:C# MyCueId类的具体用法?C# MyCueId怎么用?C# MyCueId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MyCueId类属于命名空间,在下文中一共展示了MyCueId类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Init

        public void Init(string cueName)
        {
            if (string.IsNullOrEmpty(cueName) || MySandboxGame.IsDedicated || MyAudio.Static == null)
            {
                m_arcade = new MyCueId(MyStringHash.NullOrEmpty);
                m_realistic = new MyCueId(MyStringHash.NullOrEmpty);
            }
            else
            {
                m_arcade = MyAudio.Static.GetCueId(cueName);
                if (m_arcade.Hash != MyStringHash.NullOrEmpty)
                {
                    m_realistic = m_arcade;
                    return;
                }
                m_cache.Clear();
                m_cache.Append("Arc").Append(cueName);
                m_arcade = MyAudio.Static.GetCueId(m_cache.ToString());
                m_cache.Clear();
                m_cache.Append("Real").Append(cueName);
                m_realistic = MyAudio.Static.GetCueId(m_cache.ToString());

                //Debug.Assert(m_arcade != MySpaceTexts.NullOrEmpty || m_realistic != MySpaceTexts.NullOrEmpty, string.Format("Could not find any sound for '{0}'", cueName));
                if (m_arcade.Hash == MyStringHash.NullOrEmpty && m_realistic.Hash == MyStringHash.NullOrEmpty)
                    MySandboxGame.Log.WriteLine(string.Format("Could not find any sound for '{0}'", cueName));
            }
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:27,代码来源:MyEntity3DSoundEmitter.cs


示例2: RequestThrow

 public static void RequestThrow(MyObjectBuilder_CubeGrid grid, Vector3D position, Vector3D linearVelocity, float mass, MyCueId throwSound)
 {
     ThrowMsg msg = new ThrowMsg();
     msg.Grid = grid;
     msg.Position = position;
     msg.LinearVelocity = linearVelocity;
     msg.Mass = mass;
     msg.ThrowSound = throwSound;
     MySession.Static.SyncLayer.SendMessageToServer(ref msg);
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:10,代码来源:MySyncThrower.cs


示例3: Flush

 public void Flush()
 {
     m_cueId = new MyCueId(MyStringHash.NullOrEmpty);
     m_voice.Stop();
     m_voice.FlushSourceBuffers();
     for (int i = 0; i < m_loopBuffers.Length; i++ )
         m_loopBuffers[i] = null;
     m_isPlaying = false;
     m_isPaused = false;
     m_isLoopable = false;
     m_currentDescriptor = null;
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:12,代码来源:MySourceVoice.cs


示例4: Init

        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            var ob = builder as MyObjectBuilder_PrefabThrowerDefinition;
            if (ob.Mass.HasValue)
                Mass = ob.Mass;

            MaxSpeed = ob.MaxSpeed;
            MinSpeed = ob.MinSpeed;
            PushTime = ob.PushTime;
            PrefabToThrow = ob.PrefabToThrow;
            ThrowSound = new MyCueId(MyStringHash.GetOrCompute(ob.ThrowSound));
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:14,代码来源:MyPrefabThrowerDefinition.cs


示例5: ApplyEffect

        public IMyAudioEffect ApplyEffect(IMySourceVoice input, MyStringHash effect, MyCueId[] cueIds = null, float? duration = null, bool musicEffect = false)
        {
            if (m_effectBank == null)
                return null;
			int waveNumber;
            List<MySourceVoice> voices = new List<MySourceVoice>();
            if (cueIds != null)
            {
                foreach (var cueId in cueIds)
                {
                    var sound = GetSound(cueId, out waveNumber);
                    System.Diagnostics.Debug.Assert(sound != null, "Missing sound " + cueId);
                    if (sound != null)
                        voices.Add(sound);
                }
            }
            IMyAudioEffect result = m_effectBank.CreateEffect(input, effect, voices.ToArray(), duration);
            if (musicEffect && result.OutputSound is MySourceVoice)
                (result.OutputSound as MySourceVoice).SetOutputVoices(m_musicAudioVoiceDesc);
            return result;
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:21,代码来源:MyXAudio2.cs


示例6: GetSound

        IMySourceVoice IMyAudio.GetSound(MyCueId cueId, IMy3DSoundEmitter source, MySoundDimensions type)
        {
			int waveNumber;
            return GetSound(cueId, out waveNumber, source, type);
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:5,代码来源:MyXAudio2.cs


示例7: SourceIsCloseEnoughToPlaySound

        public bool SourceIsCloseEnoughToPlaySound(Vector3 sourcePosition, MyCueId cueId, float? customMaxDistance = 0)
        {
            if (m_cueBank == null || cueId.Hash == MyStringHash.NullOrEmpty)
                return false;

            MySoundData cueDefinition = m_cueBank.GetCue(cueId);
            if (cueDefinition == null)
                return false;

            float distanceToSound = Vector3.DistanceSquared(new Vector3(m_listener.Position.X, m_listener.Position.Y, m_listener.Position.Z), sourcePosition);

            if (customMaxDistance > 0)
                return (distanceToSound <= customMaxDistance * customMaxDistance);
            else if (cueDefinition.UpdateDistance > 0)
                return (distanceToSound <= cueDefinition.UpdateDistance * cueDefinition.UpdateDistance);
            else
                return (distanceToSound <= cueDefinition.MaxDistance * cueDefinition.MaxDistance);
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:18,代码来源:MyXAudio2.cs


示例8: IsSameLoopCue

 private bool IsSameLoopCue(MyCueId newCue)
 {
     return newCue == m_soundEmitters[m_soundEmitterIndex].SoundId;
 }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:4,代码来源:MySoundBlock.cs


示例9: InitCue

        private void InitCue(string cueName)
        {
            if (string.IsNullOrEmpty(cueName))
            {
                CueId = new MyCueId(MyStringHash.NullOrEmpty);
            }
            else
            {
                var cueId = new MyCueId(MyStringHash.GetOrCompute(cueName));
                MySoundCategoryDefinition.SoundDescription soundDesc = null;
                var soundCategories = MyDefinitionManager.Static.GetSoundCategoryDefinitions();

                // check whether saved cue is in some category
                foreach (var category in soundCategories)
                {
                    foreach (var soundDescTmp in category.Sounds)
                    {
                        if (MySoundPair.GetCueId(soundDescTmp.SoundId) == cueId)
                            soundDesc = soundDescTmp;
                    }     
                }

                if (soundDesc != null)
                    SelectSound(cueId, false);
                else
                    CueId = new MyCueId(MyStringHash.NullOrEmpty);
            }
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:28,代码来源:MySoundBlock.cs


示例10:

 IMySourceVoice IMyAudio.GetSound(MyCueId cue, IMy3DSoundEmitter source, MySoundDimensions type) { return null; }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:1,代码来源:MyNullAudio.cs


示例11: OnPlaySelected

 void OnPlaySelected(MyGuiControlButton button)
 {
     if ((m_sound != null) && (m_sound.IsPlaying))
         m_sound.Stop(true);
     var cue = new MyCueId(MyStringHash.TryGet(m_cuesCombo.GetSelectedValue().ToString()));
     m_sound = MyAudio.Static.PlaySound(cue);
     var effect = MyStringHash.TryGet(m_effects.GetSelectedValue().ToString());
     if(effect != MyStringHash.NullOrEmpty)
     {
         foreach(var box in m_cues)
         {
             var effCue = new MyCueId(MyStringHash.TryGet(box.GetSelectedValue().ToString()));
             m_cueCache.Add(effCue);
         }
         var eff = MyAudio.Static.ApplyEffect(m_sound, effect, m_cueCache.ToArray());
         m_sound = eff.OutputSound;
         m_cueCache.Clear();
     }
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:19,代码来源:MyGuiScreenDebugAudio.cs


示例12: StartSecondarySound

		public void StartSecondarySound(MyCueId cueId, bool sync = false)
		{
			if (cueId.IsNull) return;

			m_soundEmitters[(int)MySoundEmitterEnum.SecondaryState].PlaySoundWithDistance(cueId);            

			if (sync)
			{
				m_character.PlaySecondarySound(cueId);
			}
		}
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:11,代码来源:MyCharacterSoundComponent.cs


示例13: SelectSound

        public void SelectSound(MyCueId cueId, bool sync)
        {
            if (sync)
            {
                SyncObject.SendSelectSoundRequest(cueId);
            }
            else
            {
                CueId = cueId;

                if (!MySandboxGame.IsDedicated)
                {
                    m_soundPair.Init(cueId);
                    var soundData = MyAudio.Static.GetCue(cueId);
                    if (soundData != null)
                        IsLoopable = soundData.Loopable;
                }

                RaisePropertiesChanged();
            }
        }
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:21,代码来源:MySoundBlock.cs


示例14: SelectSound

 public void SelectSound(MyCueId cueId, bool sync)
 {
     CueId = cueId;
 }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:4,代码来源:MySoundBlock.cs


示例15:

 MySoundData IMyAudio.GetCue(MyCueId cueId) { return m_canPlay ? m_cueBank.GetCue(cueId) : null; }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:1,代码来源:MyXAudio2.cs


示例16: PlaySound

        private void PlaySound(MyCueId sound)
        {
            if (m_sound == null || !m_sound.IsPlaying)
            {
                m_sound = MyAudio.Static.PlaySound(sound);
                if (!sound.IsNull)
                    m_effect = MyAudio.Static.ApplyEffect(m_sound, m_fadeIn, null);
                if (m_effect != null)
                    m_sound = m_effect.OutputSound;
            }
            else if (m_effect != null && m_effect.Finished && sound.IsNull)
                m_sound.Stop(true);
            else if (m_sound.CueEnum != sound)
            {
                if (m_effect != null && !m_effect.Finished)
                {
                    //m_effect.SetPositionRelative(1f);
                    m_effect.AutoUpdate = true;
                }
                if (sound.IsNull)
                    m_effect = MyAudio.Static.ApplyEffect(m_sound, m_fadeOut, null, 5000f);
                else
                    m_effect = MyAudio.Static.ApplyEffect(m_sound, m_crossFade, new MyCueId[] { sound }, 5000f);

                if (m_effect != null && !m_effect.Finished)
                {
                    m_effect.AutoUpdate = true;
                    m_sound = m_effect.OutputSound;
                }
            }
            if (m_sound != null)
            {
                MySoundData data = MyAudio.Static.GetCue(sound);
                m_volumeOriginal = data != null ? data.Volume :1f;
                m_sound.SetVolume(m_volumeOriginal * m_volumeModifier * VolumeModifierGlobal);
            }
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:37,代码来源:MySessionComponentPlanetAmbientSounds.cs


示例17: PlaySound

        internal MySourceVoice PlaySound(MyCueId cueId, IMy3DSoundEmitter source = null, MySoundDimensions type = MySoundDimensions.D2, bool skipIntro = false, bool skipToEnd = false)
        {
			int waveNumber = -1;
			var sound = GetSound(cueId, out waveNumber, source, type);
			if(source != null)
				source.LastPlayedWaveNumber = -1;
			if (sound != null)
			{
                sound.Start(skipIntro, skipToEnd);
				if (source != null)
					source.LastPlayedWaveNumber = waveNumber;
			}
            return sound;
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:14,代码来源:MyXAudio2.cs


示例18: PlayMusic

 private void PlayMusic(MyCueId cue, MyStringHash effect, int effectDuration = 2000, MyCueId[] cueIds = null, bool play = true)
 {
     if (MyAudio.Static == null)
         return;
     if(play)
         m_musicSourceVoice = MyAudio.Static.PlayMusicCue(cue, true);
     if (m_musicSourceVoice != null)
     {
         if (effect != MyStringHash.NullOrEmpty)
         {
             m_musicSourceVoice = MyAudio.Static.ApplyEffect(m_musicSourceVoice, effect, cueIds, effectDuration, true).OutputSound;
         }
         if (m_musicSourceVoice != null)
             m_musicSourceVoice.StoppedPlaying += MusicStopped;
     }
     m_lastMusicData = MyAudio.Static.GetCue(cue);
 }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:17,代码来源:MyMusicController.cs


示例19: AddMusicCue

 public void AddMusicCue(MyStringId category, MyCueId cueId)
 {
     if (m_musicCuesAll.ContainsKey(category) == false)
         m_musicCuesAll.Add(category, new List<MyCueId>());
     m_musicCuesAll[category].Add(cueId);
 }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:6,代码来源:MyMusicController.cs


示例20: IsLoopable

        public bool IsLoopable(MyCueId cueId)
        {
            if (cueId.Hash == MyStringHash.NullOrEmpty || m_cueBank == null)
                return false;
            MySoundData cueDefinition = m_cueBank.GetCue(cueId);
            if (cueDefinition == null)
                return false;

            return cueDefinition.Loopable;
        }
开发者ID:rem02,项目名称:SpaceEngineers,代码行数:10,代码来源:MyXAudio2.cs



注:本文中的MyCueId类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# MyDefinitionId类代码示例发布时间:2022-05-24
下一篇:
C# MyCubeGrid类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap