예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 public bool Contains(string musicName) => SoundEffectFiles.ContainsKey(Exceptions(musicName));