本文整理汇总了C#中MyCueId类的典型用法代码示例。如果您正苦于以下问题:C# MyCueId类的具体用法?C# MyCueId怎么用?C# MyCueId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyCueId类属于命名空间,在下文中一共展示了MyCueId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
}
示例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);
}
示例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;
}
示例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));
}
示例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;
}
示例6: GetSound
IMySourceVoice IMyAudio.GetSound(MyCueId cueId, IMy3DSoundEmitter source, MySoundDimensions type)
{
int waveNumber;
return GetSound(cueId, out waveNumber, source, type);
}
示例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);
}
示例8: IsSameLoopCue
private bool IsSameLoopCue(MyCueId newCue)
{
return newCue == m_soundEmitters[m_soundEmitterIndex].SoundId;
}
示例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);
}
}
示例10:
IMySourceVoice IMyAudio.GetSound(MyCueId cue, IMy3DSoundEmitter source, MySoundDimensions type) { return null; }
示例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();
}
}
示例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);
}
}
示例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();
}
}
示例14: SelectSound
public void SelectSound(MyCueId cueId, bool sync)
{
CueId = cueId;
}
示例15:
MySoundData IMyAudio.GetCue(MyCueId cueId) { return m_canPlay ? m_cueBank.GetCue(cueId) : null; }