private void SetupButtons() { AnnotatedBeatmapLevelCollectionsTableView annotatedBeatmapLevelCollectionsTableView = Accessors.AnnotatedBeatmapLevelCollectionsTableViewAccessor(ref annotatedBeatmapLevelCollectionsTableViewController); // Added RectMask2D to viewport to prevent the visual bug of playlist cells over buttons GameObject viewport = annotatedBeatmapLevelCollectionsTableView.transform.GetChild(0).gameObject; viewport.AddComponent <RectMask2D>().padding = new Vector4(0f, 0f, -1.9f, 0f); RectTransform rectTransform = annotatedBeatmapLevelCollectionsTableView.gameObject.GetComponent <RectTransform>(); rectTransform.anchorMax = new Vector2(0.78f, 1.0f); rectTransform.sizeDelta = new Vector2(-0.39f, 0); rectTransform.transform.localPosition = new Vector3(-6f, -6.5f, 0f); // Set buttons and scroll speed ScrollView scrollView = annotatedBeatmapLevelCollectionsTableView.gameObject.GetComponent <ScrollView>(); scrollView.SetField("_pageUpButton", leftButton); scrollView.SetField("_pageDownButton", rightButton); scrollView.SetField("_joystickScrollSpeed", 60f * PluginConfig.Instance.PlaylistScrollSpeed); }
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); }