Exemple #1
0
        static void BeatmapIndexUpdateCache(BeatmapIndex __instance, Dictionary <string, BeatmapInfo> ___cachedByName, Dictionary <string, List <BeatmapInfo> > ___cachedBySong, Dictionary <string, BeatmapInfo> ___cachedByPath)
        {
            if (originalSongs == null)
            {
                originalSongs        = __instance.songNames;
                originalBeatmapInfos = __instance.beatmaps;
                originalDifficulties = __instance.difficulties;
            }

            __instance.songNames    = originalSongs.Concat(CustomBeatsPlugin.INSTANCE.songs).ToArray();
            __instance.beatmaps     = originalBeatmapInfos.Concat(CustomBeatsPlugin.INSTANCE.beatmaps).ToArray();
            __instance.difficulties = originalDifficulties.Concat(CustomBeatsPlugin.INSTANCE.difficulties).ToArray();

            foreach (var beatmap in __instance.beatmaps)
            {
                if (!___cachedByName.ContainsKey(beatmap.name))
                {
                    ___cachedByName.Add(beatmap.name, beatmap);
                }
                if (!___cachedBySong.ContainsKey(beatmap.songName))
                {
                    ___cachedBySong.Add(beatmap.songName, new List <BeatmapInfo>()
                    {
                        beatmap
                    });
                }
                string path = beatmap.songName + "/" + beatmap.difficulty;
                if (!___cachedByPath.ContainsKey(path))
                {
                    ___cachedByPath.Add(path, beatmap);
                }
            }
        }
Exemple #2
0
        static void WhiteLabelMainMenuLevelSelect(ref WrapCounter ___songsInc, ref List <string> ___songs, BeatmapIndex ___beatmapIndex)
        {
            if (CustomBeatsPlugin.INSTANCE.dirty)
            {
                foreach (var song in CustomBeatsPlugin.INSTANCE.songs)
                {
                    if (!___songs.Contains(song))
                    {
                        ___songs.Add(song);
                    }
                }

                ___songsInc = new WrapCounter(___songs.Count);
                CustomBeatsPlugin.INSTANCE.dirty = false;

                ___beatmapIndex.UpdateCache();
            }
        }