Exemplo n.º 1
0
        public static async void SetupCustomPlaylists(object tabBar)
        {
            List <IAnnotatedBeatmapLevelCollection> levelCollections = new List <IAnnotatedBeatmapLevelCollection>();

            levelCollections.AddRange(playlistTabData);

            var data = await GetStuff();

            for (int i = 0; i < data.Item3.Count(); i++)
            {
                var customGroup = new CustomPlaylistGroup(data.Item3.ElementAt(i));
                levelCollections.Add(customGroup);
            }
            levelCollections.AddRange(data.Item2);
            tabBar.SetField("annotatedBeatmapLevelCollections", levelCollections.ToArray());
        }
Exemplo n.º 2
0
        public static void SetupCustomPlaylists(object tabBar)
        {
            var manager   = BeatSaberPlaylistsLib.PlaylistManager.DefaultManager;
            var playlists = manager.GetAllPlaylists();

            List <IAnnotatedBeatmapLevelCollection> levelCollections = new List <IAnnotatedBeatmapLevelCollection>();

            levelCollections.AddRange(playlistTabData);

            var groups = manager.GetChildManagers();

            for (int i = 0; i < groups.Count(); i++)
            {
                var customGroup = new CustomPlaylistGroup(groups.ElementAt(i));
                levelCollections.Add(customGroup);
            }
            levelCollections.AddRange(playlists);
            tabBar.SetField("annotatedBeatmapLevelCollections", levelCollections.ToArray());
        }
Exemplo n.º 3
0
        internal static IAnnotatedBeatmapLevelCollection[] SetupGroup(PlaylistManager manager, bool withBackButton)
        {
            List <IAnnotatedBeatmapLevelCollection> levelCollections = new List <IAnnotatedBeatmapLevelCollection>();

            if (withBackButton)
            {
                var backButton = new CustomPlaylistBackButton(manager.Parent);
                levelCollections.Add(backButton);
            }
            var groups = manager.GetChildManagers();

            for (int i = 0; i < groups.Count(); i++)
            {
                var customGroup = new CustomPlaylistGroup(groups.ElementAt(i));
                levelCollections.Add(customGroup);
            }
            levelCollections.AddRange(manager.GetAllPlaylists());
            return(levelCollections.ToArray());
        }
        internal static bool Prefix(ref AnnotatedBeatmapLevelCollectionsTableView __instance, ref IAnnotatedBeatmapLevelCollection[] ____annotatedBeatmapLevelCollections, ref int column, ref TableView ____tableView)
        {
            var playlist = ____annotatedBeatmapLevelCollections[column];

            if (playlist is CustomPlaylistBackButton)
            {
                var backButton = playlist as CustomPlaylistBackButton;

                if (backButton.parent == PlaylistManager.DefaultManager)
                {
                    var manager   = PlaylistManager.DefaultManager;
                    var playlists = manager.GetAllPlaylists();

                    List <IAnnotatedBeatmapLevelCollection> levelCollections = new List <IAnnotatedBeatmapLevelCollection>();
                    levelCollections.AddRange(PlaylistCore.playlistTabData);
                    levelCollections.AddRange(PlaylistCore.SetupGroup(manager, false));
                    ____annotatedBeatmapLevelCollections = levelCollections.ToArray();
                }
                else
                {
                    var group = new CustomPlaylistGroup(backButton.parent);
                    ____annotatedBeatmapLevelCollections = PlaylistCore.SetupGroup(group.PlaylistManager, true);
                }
                __instance.HandleAdditionalContentModelDidInvalidateData();
                ____tableView.ScrollToCellWithIdx(0, TableViewScroller.ScrollPositionType.Beginning, false);
                ____tableView.ClearSelection();
                return(false);
            }
            if (playlist is CustomPlaylistGroup)
            {
                var group = playlist as CustomPlaylistGroup;
                ____annotatedBeatmapLevelCollections = PlaylistCore.SetupGroup(group.PlaylistManager, true);
                __instance.HandleAdditionalContentModelDidInvalidateData();
                ____tableView.ScrollToCellWithIdx(0, TableViewScroller.ScrollPositionType.Beginning, false);
                ____tableView.ClearSelection();
                return(false);
            }

            return(true);
        }