private void LevelPackSelected(LevelPacksViewController viewController, IBeatmapLevelPack levelPack) { var previousPack = _lastPack; if (levelPack.packName != FilteredSongsPackName) { _lastPack = levelPack; } if (SongBrowserTweaks.ModLoaded && SongBrowserTweaks.Initialized) { // on the new version of SongBrowser, selecting the same level pack should have no changes to what is shown // unless it is an OST song pack (which we then clear the filter) IPreviewBeatmapLevel[] levels = levelPack.beatmapLevelCollection.beatmapLevels; if (previousPack != levelPack || (levels.Length > 0 && !(levels[0] is CustomPreviewBeatmapLevel))) { if (_filterViewController != null) { _filterViewController.UnapplyFilters(false); } SongBrowserTweaks.FiltersUnapplied(); } } else { UnapplyFilters(); } }
public void ShowSongsList(string lastLevelId = "") { if (_songSelectionViewController == null) { _songSelectionViewController = BeatSaberUI.CreateViewController <SongSelectionViewController>(); _songSelectionViewController.SongSelected += SongSelected; _songSelectionViewController.SortPressed += (sortMode) => { SetSongs(_lastSelectedPack, sortMode, _lastSearchRequest); }; _songSelectionViewController.SearchPressed += () => { _searchKeyboard.inputString = ""; PresentViewController(_searchKeyboard, null); }; } if (_packsViewController == null) { _packsViewController = Instantiate(Resources.FindObjectsOfTypeAll <LevelPacksViewController>().First(x => x.name != "CustomLevelPacksViewController")); _packsViewController.name = "CustomLevelPacksViewController"; TableView table = _packsViewController.GetComponentInChildren <TableView>(); table.Init(); _packsViewController.GetComponentInChildren <TableViewScroller>().Init(table); if (_lastSelectedPack == null) { _lastSelectedPack = SongCore.Loader.CustomBeatmapLevelPackCollectionSO.beatmapLevelPacks[0]; } _packsViewController.didSelectPackEvent += (sender, selectedPack) => { SetSongs(selectedPack, _lastSortMode, _lastSearchRequest); }; } _packsViewController.SetData(SongCore.Loader.CustomBeatmapLevelPackCollectionSO, SongCore.Loader.CustomBeatmapLevelPackCollectionSO.beatmapLevelPacks.FindIndexInArray(_lastSelectedPack)); if (_roomNavigationController.viewControllers.IndexOf(_songSelectionViewController) < 0) { PushViewControllerToNavigationController(_roomNavigationController, _songSelectionViewController, null, true); SetSongs(_lastSelectedPack, _lastSortMode, _lastSearchRequest); if (!string.IsNullOrEmpty(lastLevelId)) { _songSelectionViewController.ScrollToLevel(lastLevelId); } } if (Client.Instance.isHost) { _packsViewController.gameObject.SetActive(true); SetBottomScreenViewController(_packsViewController); } else { _packsViewController.gameObject.SetActive(false); SetBottomScreenViewController(null); } _songSelectionViewController.UpdateViewController(Client.Instance.isHost); }
/// <summary> /// Constructor. Acquire all necessary BeatSaberUi elements. /// </summary> /// <param name="flowCoordinator"></param> public BeatSaberUIController(FlowCoordinator flowCoordinator) { LevelSelectionFlowCoordinator = flowCoordinator; // gather controllers and ui elements. LevelPackViewController = LevelSelectionFlowCoordinator.GetPrivateField <LevelPacksViewController>("_levelPacksViewController"); Logger.Debug("Acquired LevelPacksViewController [{0}]", LevelPackViewController.GetInstanceID()); LevelPackDetailViewController = LevelSelectionFlowCoordinator.GetPrivateField <LevelPackDetailViewController>("_levelPackDetailViewController"); Logger.Debug("Acquired LevelPackDetailViewController [{0}]", LevelPackDetailViewController.GetInstanceID()); LevelPacksTableView = LevelPackViewController.GetPrivateField <LevelPacksTableView>("_levelPacksTableView"); Logger.Debug("Acquired LevelPacksTableView [{0}]", LevelPacksTableView.GetInstanceID()); LevelPackLevelsViewController = LevelSelectionFlowCoordinator.GetPrivateField <LevelPackLevelsViewController>("_levelPackLevelsViewController"); Logger.Debug("Acquired LevelPackLevelsViewController [{0}]", LevelPackLevelsViewController.GetInstanceID()); LevelPackLevelsTableView = this.LevelPackLevelsViewController.GetPrivateField <LevelPackLevelsTableView>("_levelPackLevelsTableView"); Logger.Debug("Acquired LevelPackLevelsTableView [{0}]", LevelPackLevelsTableView.GetInstanceID()); LevelDetailViewController = LevelSelectionFlowCoordinator.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController"); Logger.Debug("Acquired StandardLevelDetailViewController [{0}]", LevelDetailViewController.GetInstanceID()); StandardLevelDetailView = LevelDetailViewController.GetPrivateField <StandardLevelDetailView>("_standardLevelDetailView"); Logger.Debug("Acquired StandardLevelDetailView [{0}]", StandardLevelDetailView.GetInstanceID()); BeatmapCharacteristicSelectionViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSegmentedControlController>().First(); Logger.Debug("Acquired BeatmapCharacteristicSegmentedControlController [{0}]", BeatmapCharacteristicSelectionViewController.GetInstanceID()); LevelSelectionNavigationController = LevelSelectionFlowCoordinator.GetPrivateField <DismissableNavigationController>("_navigationController"); Logger.Debug("Acquired DismissableNavigationController [{0}]", LevelSelectionNavigationController.GetInstanceID()); LevelDifficultyViewController = StandardLevelDetailView.GetPrivateField <BeatmapDifficultySegmentedControlController>("_beatmapDifficultySegmentedControlController"); Logger.Debug("Acquired BeatmapDifficultySegmentedControlController [{0}]", LevelDifficultyViewController.GetInstanceID()); LevelPackLevelsTableViewRectTransform = LevelPackLevelsTableView.transform as RectTransform; Logger.Debug("Acquired TableViewRectTransform from LevelPackLevelsTableView [{0}]", LevelPackLevelsTableViewRectTransform.GetInstanceID()); TableView tableView = ReflectionUtil.GetPrivateField <TableView>(LevelPackLevelsTableView, "_tableView"); TableViewPageUpButton = tableView.GetPrivateField <Button>("_pageUpButton"); TableViewPageDownButton = tableView.GetPrivateField <Button>("_pageDownButton"); Logger.Debug("Acquired Page Up and Down buttons..."); PlayContainer = StandardLevelDetailView.GetComponentsInChildren <RectTransform>().First(x => x.name == "PlayContainer"); PlayButtons = PlayContainer.GetComponentsInChildren <RectTransform>().First(x => x.name == "PlayButtons"); PlayButton = Resources.FindObjectsOfTypeAll <Button>().First(x => x.name == "PlayButton"); PracticeButton = PlayButtons.GetComponentsInChildren <Button>().First(x => x.name == "PracticeButton"); SimpleDialogPromptViewControllerPrefab = Resources.FindObjectsOfTypeAll <SimpleDialogPromptViewController>().First(); }
public MockPartyViewController() { Instance = this; _partyFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault(); LevelPackLevelsViewController levels = ReflectionUtil.GetPrivateField <LevelPackLevelsViewController>(_partyFlowCoordinator, "_levelPackLevelsViewController"); LevelPacksViewController levelPacks = ReflectionUtil.GetPrivateField <LevelPacksViewController>(_partyFlowCoordinator, "_levelPacksViewController"); LevelPackDetailViewController levelPackDetail = ReflectionUtil.GetPrivateField <LevelPackDetailViewController>(_partyFlowCoordinator, "_levelPackDetailViewController"); StandardLevelDetailViewController detail = ReflectionUtil.GetPrivateField <StandardLevelDetailViewController>(_partyFlowCoordinator, "_levelDetailViewController"); detailView = ReflectionUtil.GetPrivateField <StandardLevelDetailView>(detail, "_standardLevelDetailView"); _gameplaySetupViewController = ReflectionUtil.GetPrivateField <GameplaySetupViewController>(_partyFlowCoordinator, "_gameplaySetupViewController"); LocalLeaderboardViewController leaderboard = ReflectionUtil.GetPrivateField <LocalLeaderboardViewController>(_partyFlowCoordinator, "_localLeaderboardViewController"); detail.didPresentContentEvent += (controller, type) => { if (type == StandardLevelDetailViewController.ContentType.OwnedAndReady) { didSelectLevel(detail.selectedDifficultyBeatmap); } }; detail.didChangeDifficultyBeatmapEvent += didSelectDifficultyBeatmap; detail.didPressPlayButtonEvent += didPressPlay; levelPackDetail.didActivateEvent += (firstActivation, type) => showLeaderboard(); leaderboard.didActivateEvent += (firstActivation, type) => showLeaderboard(); _mainMenuController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().FirstOrDefault(); Button partyButton = ReflectionUtil.GetPrivateField <Button>(_mainMenuController, "_partyButton"); HoverHint hint = Resources.FindObjectsOfTypeAll <HoverHint>().Where(x => x.text == "Play with your friends locally!").First(); _mainMenuController.didActivateEvent += (first, type) => { if (Data.Steam.SteamAPI.GetConnectionState() != SteamAPI.ConnectionState.CONNECTED) { partyButton.SetButtonText("Party"); if (hint) { hint.text = "Play with your friends locally!"; } } else { partyButton.SetButtonText("Online Lobby"); if (hint) { hint.text = "Play with your friends in your steam lobby!"; } } }; }
private void _levelPacksViewController_didSelectPackEvent(LevelPacksViewController arg1, IBeatmapLevelPack arg2) { lastPlaylist = null; }
private void SetupTweaks() { _mainFlowCoordinator = FindObjectOfType <MainFlowCoordinator>(); _mainFlowCoordinator.GetPrivateField <MainMenuViewController>("_mainMenuViewController").didFinishEvent += SongListTweaks_didFinishEvent; RectTransform viewControllersContainer = FindObjectsOfType <RectTransform>().First(x => x.name == "ViewControllers"); if (initialized || PluginConfig.disableSongListTweaks) { return; } Logger.Log("Setting up song list tweaks..."); try { var harmony = HarmonyInstance.Create("BeatSaverDownloaderHarmonyInstance"); harmony.PatchAll(Assembly.GetExecutingAssembly()); } catch (Exception e) { Logger.Log("Unable to patch level list! Exception: " + e); } _playlistsFlowCoordinator = new GameObject("PlaylistsFlowCoordinator").AddComponent <PlaylistsFlowCoordinator>(); _playlistsFlowCoordinator.didFinishEvent += _playlistsFlowCoordinator_didFinishEvent; if (SongLoader.AreSongsLoaded) { _levelCollection = SongLoader.CustomLevelCollectionSO; } else { SongLoader.SongsLoadedEvent += (SongLoader sender, List <CustomLevel> levels) => { _levelCollection = SongLoader.CustomLevelCollectionSO; }; } _simpleDialog = ReflectionUtil.GetPrivateField <SimpleDialogPromptViewController>(_mainFlowCoordinator, "_simpleDialogPromptViewController"); _simpleDialog = Instantiate(_simpleDialog.gameObject, _simpleDialog.transform.parent).GetComponent <SimpleDialogPromptViewController>(); _levelListViewController = viewControllersContainer.GetComponentInChildren <LevelPackLevelsViewController>(true); _levelListViewController.didSelectLevelEvent += _levelListViewController_didSelectLevelEvent; _levelPacksViewController = viewControllersContainer.GetComponentInChildren <LevelPacksViewController>(true); _levelPacksViewController.didSelectPackEvent += _levelPacksViewController_didSelectPackEvent; TableView _songSelectionTableView = _levelListViewController.GetComponentsInChildren <TableView>(true).First(); RectTransform _tableViewRectTransform = _levelListViewController.GetComponentsInChildren <RectTransform>(true).First(x => x.name == "LevelsTableView"); _tableViewRectTransform.sizeDelta = new Vector2(0f, -20.5f); _tableViewRectTransform.anchoredPosition = new Vector2(0f, -2.5f); Button _pageUp = _tableViewRectTransform.GetComponentsInChildren <Button>(true).First(x => x.name == "PageUpButton"); (_pageUp.transform as RectTransform).anchoredPosition = new Vector2(0f, -1f); Button _pageDown = _tableViewRectTransform.GetComponentsInChildren <Button>(true).First(x => x.name == "PageDownButton"); (_pageDown.transform as RectTransform).anchoredPosition = new Vector2(0f, 1f); _fastPageUpButton = Instantiate(_pageUp, _tableViewRectTransform, false); (_fastPageUpButton.transform as RectTransform).anchorMin = new Vector2(0.5f, 1f); (_fastPageUpButton.transform as RectTransform).anchorMax = new Vector2(0.5f, 1f); (_fastPageUpButton.transform as RectTransform).anchoredPosition = new Vector2(-26f, 1f); (_fastPageUpButton.transform as RectTransform).sizeDelta = new Vector2(8f, 6f); _fastPageUpButton.GetComponentsInChildren <RectTransform>().First(x => x.name == "BG").sizeDelta = new Vector2(8f, 6f); _fastPageUpButton.GetComponentsInChildren <UnityEngine.UI.Image>().First(x => x.name == "Arrow").sprite = Sprites.DoubleArrow; _fastPageUpButton.onClick.AddListener(delegate() { FastScrollUp(_songSelectionTableView, PluginConfig.fastScrollSpeed); }); _fastPageDownButton = Instantiate(_pageDown, _tableViewRectTransform, false); (_fastPageDownButton.transform as RectTransform).anchorMin = new Vector2(0.5f, 0f); (_fastPageDownButton.transform as RectTransform).anchorMax = new Vector2(0.5f, 0f); (_fastPageDownButton.transform as RectTransform).anchoredPosition = new Vector2(-26f, -1f); (_fastPageDownButton.transform as RectTransform).sizeDelta = new Vector2(8f, 6f); _fastPageDownButton.GetComponentsInChildren <RectTransform>().First(x => x.name == "BG").sizeDelta = new Vector2(8f, 6f); _fastPageDownButton.GetComponentsInChildren <UnityEngine.UI.Image>().First(x => x.name == "Arrow").sprite = Sprites.DoubleArrow; _fastPageDownButton.onClick.AddListener(delegate() { FastScrollDown(_songSelectionTableView, PluginConfig.fastScrollSpeed); }); _randomButton = Instantiate(viewControllersContainer.GetComponentsInChildren <Button>(true).First(x => x.name == "PracticeButton"), _levelListViewController.rectTransform, false); _randomButton.onClick = new Button.ButtonClickedEvent(); _randomButton.onClick.AddListener(() => { int randomRow = UnityEngine.Random.Range(0, _songSelectionTableView.dataSource.NumberOfCells()); _songSelectionTableView.ScrollToCellWithIdx(randomRow, TableView.ScrollPositionType.Beginning, false); _songSelectionTableView.SelectCellWithIdx(randomRow, true); }); _randomButton.name = "CustomUIButton"; (_randomButton.transform as RectTransform).anchorMin = new Vector2(0.5f, 0.5f); (_randomButton.transform as RectTransform).anchorMax = new Vector2(0.5f, 0.5f); (_randomButton.transform as RectTransform).anchoredPosition = new Vector2(35f, 36.25f); (_randomButton.transform as RectTransform).sizeDelta = new Vector2(8.8f, 6f); _randomButton.SetButtonText(""); _randomButton.SetButtonIcon(Sprites.RandomIcon); _randomButton.GetComponentsInChildren <UnityEngine.UI.Image>().First(x => x.name == "Stroke").sprite = Resources.FindObjectsOfTypeAll <Sprite>().First(x => x.name == "RoundRectSmallStroke"); var _randomIconLayout = _randomButton.GetComponentsInChildren <HorizontalLayoutGroup>().First(x => x.name == "Content"); _randomIconLayout.padding = new RectOffset(0, 0, 0, 0); _searchButton = _levelListViewController.CreateUIButton("CreditsButton", new Vector2(-20f, 36.25f), new Vector2(20f, 6f), SearchPressed, "Search"); _searchButton.SetButtonTextSize(3f); _searchButton.ToggleWordWrapping(false); _sortByButton = _levelListViewController.CreateUIButton("CreditsButton", new Vector2(0f, 36.25f), new Vector2(20f, 6f), () => { SelectTopButtons(TopButtonsState.SortBy); }, "Sort By"); _sortByButton.SetButtonTextSize(3f); _sortByButton.ToggleWordWrapping(false); _playlistsButton = _levelListViewController.CreateUIButton("CreditsButton", new Vector2(20f, 36.25f), new Vector2(20f, 6f), PlaylistsButtonPressed, "Playlists"); _playlistsButton.SetButtonTextSize(3f); _playlistsButton.ToggleWordWrapping(false); _defButton = _levelListViewController.CreateUIButton("CreditsButton", new Vector2(-20f, 36.25f), new Vector2(20f, 6f), () => { SelectTopButtons(TopButtonsState.Select); SetLevels(SortMode.Default, ""); }, "Default"); _defButton.SetButtonTextSize(3f); _defButton.ToggleWordWrapping(false); _defButton.gameObject.SetActive(false); _newButton = _levelListViewController.CreateUIButton("CreditsButton", new Vector2(0f, 36.25f), new Vector2(20f, 6f), () => { SelectTopButtons(TopButtonsState.Select); SetLevels(SortMode.Newest, ""); }, "Newest"); _newButton.SetButtonTextSize(3f); _newButton.ToggleWordWrapping(false); _newButton.gameObject.SetActive(false); _difficultyButton = _levelListViewController.CreateUIButton("CreditsButton", new Vector2(20f, 36.25f), new Vector2(20f, 6f), () => { SelectTopButtons(TopButtonsState.Select); SetLevels(SortMode.Difficulty, ""); }, "Difficulty"); _difficultyButton.SetButtonTextSize(3f); _difficultyButton.ToggleWordWrapping(false); _difficultyButton.gameObject.SetActive(false); _detailViewController = viewControllersContainer.GetComponentsInChildren <StandardLevelDetailViewController>(true).First(x => x.name == "LevelDetailViewController"); _detailViewController.didChangeDifficultyBeatmapEvent += _difficultyViewController_didSelectDifficultyEvent; RectTransform buttonsRect = _detailViewController.GetComponentsInChildren <RectTransform>(true).First(x => x.name == "PlayButtons"); _favoriteButton = Instantiate(viewControllersContainer.GetComponentsInChildren <Button>(true).First(x => x.name == "PracticeButton"), buttonsRect, false); _favoriteButton.onClick = new Button.ButtonClickedEvent(); _favoriteButton.onClick.AddListener(() => { if (PluginConfig.favoriteSongs.Any(x => x.Contains(_detailViewController.selectedDifficultyBeatmap.level.levelID))) { PluginConfig.favoriteSongs.Remove(_detailViewController.selectedDifficultyBeatmap.level.levelID); PluginConfig.SaveConfig(); _favoriteButton.SetButtonIcon(Sprites.AddToFavorites); PlaylistsCollection.RemoveLevelFromPlaylist(PlaylistsCollection.loadedPlaylists.First(x => x.playlistTitle == "Your favorite songs"), _detailViewController.selectedDifficultyBeatmap.level.levelID); } else { PluginConfig.favoriteSongs.Add(_detailViewController.selectedDifficultyBeatmap.level.levelID); PluginConfig.SaveConfig(); _favoriteButton.SetButtonIcon(Sprites.RemoveFromFavorites); PlaylistsCollection.AddSongToPlaylist(PlaylistsCollection.loadedPlaylists.First(x => x.playlistTitle == "Your favorite songs"), new PlaylistSong() { levelId = _detailViewController.selectedDifficultyBeatmap.level.levelID, songName = _detailViewController.selectedDifficultyBeatmap.level.songName, level = SongDownloader.GetLevel(_detailViewController.selectedDifficultyBeatmap.level.levelID) }); } }); _favoriteButton.name = "CustomUIButton"; _favoriteButton.SetButtonIcon(Sprites.AddToFavorites); (_favoriteButton.transform as RectTransform).sizeDelta = new Vector2(12f, 8.8f); var _favoriteIconLayout = _favoriteButton.GetComponentsInChildren <HorizontalLayoutGroup>().First(x => x.name == "Content"); _favoriteIconLayout.padding = new RectOffset(3, 3, 0, 0); _favoriteButton.transform.SetAsFirstSibling(); Button practiceButton = buttonsRect.GetComponentsInChildren <Button>().First(x => x.name == "PracticeButton"); (practiceButton.transform as RectTransform).sizeDelta = new Vector2(12f, 8.8f); var _practiceIconLayout = practiceButton.GetComponentsInChildren <HorizontalLayoutGroup>().First(x => x.name == "Content"); _practiceIconLayout.padding = new RectOffset(3, 3, 0, 0); _deleteButton = Instantiate(viewControllersContainer.GetComponentsInChildren <Button>(true).First(x => x.name == "PracticeButton"), buttonsRect, false); _deleteButton.onClick = new Button.ButtonClickedEvent(); _deleteButton.onClick.AddListener(DeletePressed); _deleteButton.name = "CustomUIButton"; _deleteButton.SetButtonIcon(Sprites.DeleteIcon); _deleteButton.interactable = !PluginConfig.disableDeleteButton; (_deleteButton.transform as RectTransform).sizeDelta = new Vector2(8.8f, 8.8f); _deleteButton.GetComponentsInChildren <UnityEngine.UI.Image>().First(x => x.name == "Stroke").sprite = Resources.FindObjectsOfTypeAll <Sprite>().First(x => x.name == "RoundRectSmallStroke"); var _deleteIconLayout = _deleteButton.GetComponentsInChildren <HorizontalLayoutGroup>().First(x => x.name == "Content"); _deleteIconLayout.padding = new RectOffset(0, 0, 1, 1); _deleteButton.transform.SetAsLastSibling(); //based on https://github.com/halsafar/BeatSaberSongBrowser/blob/master/SongBrowserPlugin/UI/Browser/SongBrowserUI.cs#L192 var statsPanel = _detailViewController.GetComponentsInChildren <LevelParamsPanel>(true).First(x => x.name == "LevelParamsPanel"); var statTransforms = statsPanel.GetComponentsInChildren <RectTransform>(true); var valueTexts = statsPanel.GetComponentsInChildren <TextMeshProUGUI>(true).Where(x => x.name == "ValueText").ToList(); foreach (RectTransform r in statTransforms) { if (r.name == "Separator") { continue; } r.sizeDelta = new Vector2(r.sizeDelta.x * 0.85f, r.sizeDelta.y * 0.85f); } var _starStatTransform = Instantiate(statTransforms[1], statsPanel.transform, false); _starStatText = _starStatTransform.GetComponentInChildren <TextMeshProUGUI>(true); _starStatTransform.GetComponentInChildren <UnityEngine.UI.Image>(true).sprite = Sprites.StarFull; _starStatText.text = "--"; ResultsViewController _standardLevelResultsViewController = viewControllersContainer.GetComponentsInChildren <ResultsViewController>(true).First(x => x.name == "StandardLevelResultsViewController"); _standardLevelResultsViewController.continueButtonPressedEvent += _standardLevelResultsViewController_continueButtonPressedEvent; initialized = true; }
internal void OnSceneChanged(Scene oldScene, Scene newScene) { if (AreSongsLoading) { //Scene changing while songs are loading. Since we are using a separate thread while loading, this is bad and could cause a crash. //So we have to stop loading. if (_loadingTask != null) { _loadingTask.Cancel(); _loadingCancelled = true; AreSongsLoading = false; LoadingProgress = 0; StopAllCoroutines(); _progressBar.ShowMessage("Loading cancelled\n<size=80%>Press Ctrl+R to refresh</size>"); Logging.Log("Loading was cancelled by player since they loaded another scene."); } } if (newScene.name == "MenuCore") { BS_Utils.Gameplay.Gamemode.Init(); if (_customLevelLoader == null) { _customLevelLoader = Resources.FindObjectsOfTypeAll <CustomLevelLoaderSO>().FirstOrDefault(); if (_customLevelLoader) { Texture2D defaultCoverTex = _customLevelLoader.GetField <Texture2D>("_defaultPackCoverTexture2D"); defaultCoverImage = Sprite.Create(defaultCoverTex, new Rect(0f, 0f, (float)defaultCoverTex.width, (float)defaultCoverTex.height), new Vector2(0.5f, 0.5f)); cachedMediaAsyncLoaderSO = _customLevelLoader.GetField <CachedMediaAsyncLoaderSO>("_cachedMediaAsyncLoaderSO"); beatmapCharacteristicCollection = _customLevelLoader.GetField <BeatmapCharacteristicCollectionSO>("_beatmapCharacteristicCollection"); } else { Texture2D defaultCoverTex = Texture2D.blackTexture; defaultCoverImage = Sprite.Create(defaultCoverTex, new Rect(0f, 0f, (float)defaultCoverTex.width, (float)defaultCoverTex.height), new Vector2(0.5f, 0.5f)); } } if (BeatmapLevelsModelSO == null) { BeatmapLevelsModelSO = Resources.FindObjectsOfTypeAll <BeatmapLevelsModelSO>().FirstOrDefault(); } //Handle LevelPacks if (CustomBeatmapLevelPackCollectionSO == null) { var beatmapLevelPackCollectionSO = Resources.FindObjectsOfTypeAll <BeatmapLevelPackCollectionSO>().FirstOrDefault(); CustomBeatmapLevelPackCollectionSO = SongCoreBeatmapLevelPackCollectionSO.ReplaceOriginal(beatmapLevelPackCollectionSO); CustomLevelsCollection = new SongCoreCustomLevelCollection(CustomLevels.Values.ToArray()); WIPLevelsCollection = new SongCoreCustomLevelCollection(CustomWIPLevels.Values.ToArray()); CustomLevelsPack = new SongCoreCustomBeatmapLevelPack(CustomLevelLoaderSO.kCustomLevelPackPrefixId + "CustomLevels", "Custom Maps", defaultCoverImage, CustomLevelsCollection); WIPLevelsPack = new SongCoreCustomBeatmapLevelPack(CustomLevelLoaderSO.kCustomLevelPackPrefixId + "CustomWIPLevels", "WIP Maps", UI.BasicUI.WIPIcon, WIPLevelsCollection); CustomBeatmapLevelPackCollectionSO.AddLevelPack(CustomLevelsPack); CustomBeatmapLevelPackCollectionSO.AddLevelPack(WIPLevelsPack); // CustomBeatmapLevelPackSO = CustomBeatmapLevelPackSO.GetPack(CustomLevelCollectionSO); // CustomBeatmapLevelPackCollectionSO.AddLevelPack(CustomBeatmapLevelPackSO); // WIPCustomBeatmapLevelPackSO = CustomBeatmapLevelPackSO.GetPack(WIPCustomLevelCollectionSO, true); // CustomBeatmapLevelPackCollectionSO.AddLevelPack(WIPCustomBeatmapLevelPackSO); CustomBeatmapLevelPackCollectionSO.ReplaceReferences(); } else { CustomBeatmapLevelPackCollectionSO.ReplaceReferences(); } //RefreshLevelPacks(); var soloFreePlay = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); LevelPacksViewController levelPacksViewController = soloFreePlay?.GetField <LevelPacksViewController>("_levelPacksViewController"); levelPacksViewController?.SetData(CustomBeatmapLevelPackCollectionSO, 0); } }