public SoundEffectClip GetSound(string soundEffectName, bool logErrors) { var soundEffectNameLower = soundEffectName.ToLowerInvariant(); if (SoundEffectFiles.ContainsKey(soundEffectNameLower)) { return(SoundEffectFiles[soundEffectNameLower]); } if (TryAddGameModeSoundEffect(soundEffectName)) { return(SoundEffectFiles[soundEffectNameLower]); } Logger.Log(Logger.LogTypes.Warning, "SoundTrack.cs: Cannot find sound file \"" + soundEffectName + "\". Return nothing."); return(null); }
private bool AddSoundEffect(string soundEffectName, SoundEffectFile soundEffectFile, bool forceReplace) { var soundEffectFileLower = soundEffectName.ToLowerInvariant(); if (SoundEffectFiles.ContainsKey(soundEffectFileLower)) { if (forceReplace && SoundEffectFiles[soundEffectFileLower].IsStandard) { SoundEffectFiles.Remove(soundEffectFileLower); } else { return(true); } } SoundEffectFiles.Add(soundEffectFileLower, new SoundEffectClip(soundEffectFile)); //if (!soundEffectFile.ForceLoad()) //{ // Logger.Log(Logger.LogTypes.Warning, $"SoundTrack.cs: File at \"{soundEffectFile.LocalPath}\" is not a valid music file!"); // return false; //} return(true); }
public bool Contains(string musicName) => SoundEffectFiles.ContainsKey(Exceptions(musicName));