Exemple #1
0
        public static IBeatmapLevelPack GetLevelPackWithLevels(BeatmapLevelSO[] levels, string packName = null, Sprite packCover = null)
        {
            CustomLevelCollectionSO levelCollection = ScriptableObject.CreateInstance <CustomLevelCollectionSO>();

            levelCollection.SetPrivateField("_levelList", levels.ToList());
            levelCollection.SetPrivateField("_beatmapLevels", levels);

            CustomBeatmapLevelPackSO pack = CustomBeatmapLevelPackSO.GetPack(levelCollection);

            pack.SetPrivateField("_packName", string.IsNullOrEmpty(packName) ? "Custom Songs" : packName);
            pack.SetPrivateField("_coverImage", packCover ?? Sprites.BeastSaberLogo);
            pack.SetPrivateField("_isPackAlwaysOwned", true);

            return(pack);
        }
        public void UpdateDataFromPlaylist()
        {
            _packName          = _playlist.playlistTitle;
            _coverImage        = _playlist.icon;
            _packID            = $"Playlist_{playlist.playlistTitle}_{playlist.playlistAuthor}";
            _isPackAlwaysOwned = false;

            PlaylistsCollection.MatchSongsForPlaylist(playlist);

            IPreviewBeatmapLevel[] levels = playlist.songs.Where(x => x.level != null).Select(x => x.level).ToArray();

            CustomLevelCollectionSO levelCollection = ScriptableObject.CreateInstance <CustomLevelCollectionSO>();

            levelCollection.SetPrivateField("_levelList", levels.Where(x => x is BeatmapLevelSO).Cast <BeatmapLevelSO>().ToList());
            levelCollection.SetPrivateField("_beatmapLevels", levels);

            _beatmapLevelCollection = levelCollection;
        }