private ISound FindSound(string name) { var list = new List <ISound>(); list.AddRange(SoundEffects.Where(a => a.Key == name).Select(a => a.Value).ToList()); list.AddRange(Songs.Where(a => a.Key == name).Select(a => a.Value).ToList()); return(list.FirstOrDefault()); }
public bool AddSound(KeyValuePair <string, string> song) { if (IsUniqueName(song)) { var soundFile = Content.Load <SoundEffect>(song.Value); SoundEffects.Add(song.Key.ToLower(), new SoundEffects(soundFile)); return(true); } return(false); }
public SoundEffect GetSoundEffect(string hoverSoundName) { return(SoundEffects.FirstOrDefault(a => a.Key == hoverSoundName).Value.sound); }
private bool IsUniqueName(KeyValuePair <string, string> key) { return(!string.IsNullOrEmpty(key.Key.ToLower()) && !string.IsNullOrEmpty(key.Value) && SoundEffects.Count(a => a.Key == key.Key.ToLower()) == 0 && Songs.Count(a => a.Key == key.Value) == 0); }