public static void LoadSong(string songPath) { foreach (string file in Directory.EnumerateFiles(songPath)) { if (file.EndsWith(".pmb")) { Beatmap beatmap = DeserializeBeatmap(file); if (beatmap == null) { Debug.Log("Failed to load map " + file); continue; } beatmap.Fix(); BeatmapStoreInfo beatmapStoreInfo = new BeatmapStoreInfo() { MapPath = file, SongPath = beatmap.SongPath, SongName = beatmap.SongName, RomanizedSongName = beatmap.RomanizedSongName, DifficultyName = beatmap.DifficultyName, BackgroundPath = beatmap.BackgroundPath, uuid = beatmap.GetUUID() }; if (Beatmaps == null) { Beatmaps = new List <BeatmapStoreInfo>(); } Beatmaps.Add(beatmapStoreInfo); } } }
/// <param name="loadedBackground">If you already have the background texture loaded, pass it here</param> /// <param name="loadedSong">If you already have the song loaded, pass it here</param> public static void Load(Beatmap map, Texture2D loadedBackground = null, AudioClip loadedSong = null) { if (!map.hasBeenFixed) { map.Fix(); } else { map.ResetNotes(); } CurrentlyLoaded = map; map.Song = loadedSong ?? map.Song ?? GetAudio(map.SongPath); map.BackgroundImage = loadedBackground ?? map.BackgroundImage ?? Helper.LoadPNG(map.BackgroundPath); Debug.Log($"Loaded song {map.SongName}({map.GetUUID()})"); }