private bool AddMusic(string musicName, MusicFile musicFile, bool forceReplace) { var musicNameLower = musicName.ToLowerInvariant(); if (MusicFiles.ContainsKey(musicNameLower)) { if (forceReplace && MusicFiles[musicNameLower].IsStandard) { MusicFiles.Remove(musicNameLower); } else { return(true); } } MusicFiles.Add(musicNameLower, new MusicClip(musicFile)); // TODO: Loading every music increases uned memory size duh //if (!musicFile.ForceLoad()) //{ // Logger.Log(Logger.LogTypes.Warning, $"MusicTrack.cs: File at \"{musicFile.LocalPath}\" is not a valid music file!"); // return false; //} return(true); }
public MusicClip GetMusic(string musicName, bool logErrors) { var lowerMusicName = musicName.ToLowerInvariant(); if (MusicFiles.ContainsKey(lowerMusicName)) { return(MusicFiles[lowerMusicName]); } if (TryAddGameModeMusic(lowerMusicName)) { return(MusicFiles[lowerMusicName]); } if (logErrors && lowerMusicName != "nomusic") { Logger.Log(Logger.LogTypes.Warning, $"MusicManager.cs: Cannot find music file \"{musicName}\". Return nothing."); } return(null); }
public bool Contains(string musicName) => MusicFiles.ContainsKey(Exceptions(musicName));