/// <summary> /// Constructor. Acquire all necessary BeatSaberUi elements. /// </summary> /// <param name="flowCoordinator"></param> public BeatSaberUIController(FlowCoordinator flowCoordinator) { Logger.Debug("Collecting all BeatSaberUI Elements..."); LevelSelectionFlowCoordinator = flowCoordinator; // gather flow coordinator elements LevelSelectionNavigationController = LevelSelectionFlowCoordinator.GetPrivateField <LevelSelectionNavigationController>("levelSelectionNavigationController"); Logger.Debug("Acquired LevelSelectionNavigationController [{0}]", LevelSelectionNavigationController.GetInstanceID()); LevelFilteringNavigationController = LevelSelectionNavigationController.GetPrivateField <LevelFilteringNavigationController>("_levelFilteringNavigationController"); Logger.Debug("Acquired LevelFilteringNavigationController [{0}]", LevelFilteringNavigationController.GetInstanceID()); LevelCollectionNavigationController = LevelSelectionNavigationController.GetPrivateField <LevelCollectionNavigationController>("_levelCollectionNavigationController"); Logger.Debug("Acquired LevelCollectionNavigationController [{0}]", LevelCollectionNavigationController.GetInstanceID()); LevelCollectionViewController = LevelCollectionNavigationController.GetPrivateField <LevelCollectionViewController>("_levelCollectionViewController"); Logger.Debug("Acquired LevelPackLevelsViewController [{0}]", LevelCollectionViewController.GetInstanceID()); LevelDetailViewController = LevelCollectionNavigationController.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController"); Logger.Debug("Acquired StandardLevelDetailViewController [{0}]", LevelDetailViewController.GetInstanceID()); LevelCollectionTableView = this.LevelCollectionViewController.GetPrivateField <LevelCollectionTableView>("_levelCollectionTableView"); Logger.Debug("Acquired LevelPackLevelsTableView [{0}]", LevelCollectionTableView.GetInstanceID()); StandardLevelDetailView = LevelDetailViewController.GetPrivateField <StandardLevelDetailView>("_standardLevelDetailView"); Logger.Debug("Acquired StandardLevelDetailView [{0}]", StandardLevelDetailView.GetInstanceID()); BeatmapCharacteristicSelectionViewController = LevelDetailViewController.GetComponentInChildren <BeatmapCharacteristicSegmentedControlController>(); Logger.Debug("Acquired BeatmapCharacteristicSegmentedControlController [{0}]", BeatmapCharacteristicSelectionViewController.GetInstanceID()); LevelDifficultyViewController = StandardLevelDetailView.GetPrivateField <BeatmapDifficultySegmentedControlController>("_beatmapDifficultySegmentedControlController"); Logger.Debug("Acquired BeatmapDifficultySegmentedControlController [{0}]", LevelDifficultyViewController.GetInstanceID()); LevelCollectionTableViewTransform = LevelCollectionTableView.transform as RectTransform; Logger.Debug("Acquired TableViewRectTransform from LevelPackLevelsTableView [{0}]", LevelCollectionTableViewTransform.GetInstanceID()); AnnotatedBeatmapLevelCollectionsViewController = LevelFilteringNavigationController.GetPrivateField <AnnotatedBeatmapLevelCollectionsViewController>("_annotatedBeatmapLevelCollectionsViewController"); Logger.Debug("Acquired AnnotatedBeatmapLevelCollectionsViewController from LevelFilteringNavigationController [{0}]", AnnotatedBeatmapLevelCollectionsViewController.GetInstanceID()); TableView tableView = LevelCollectionTableView.GetPrivateField <TableView>("_tableView"); TableViewPageUpButton = tableView.GetPrivateField <Button>("_pageUpButton"); TableViewPageDownButton = tableView.GetPrivateField <Button>("_pageDownButton"); Logger.Debug("Acquired Page Up and Down buttons..."); ActionButtons = LevelDetailViewController.GetComponentsInChildren <RectTransform>().First(x => x.name == "ActionButtons"); Logger.Debug("Acquired ActionButtons [{0}]", ActionButtons.GetInstanceID()); ScreenSystem = Resources.FindObjectsOfTypeAll <ScreenSystem>().Last(); Logger.Debug("Acquired ScreenSystem [{0}]", ScreenSystem.GetInstanceID()); SimpleDialogPromptViewControllerPrefab = Resources.FindObjectsOfTypeAll <SimpleDialogPromptViewController>().Last(); Logger.Debug("Acquired SimpleDialogPromptViewControllerPrefab [{0}]", SimpleDialogPromptViewControllerPrefab.GetInstanceID()); BeatmapLevelsModel = Resources.FindObjectsOfTypeAll <BeatmapLevelsModel>().Last(); Logger.Debug("Acquired BeatmapLevelsModel [{0}]", BeatmapLevelsModel); }
private void SetModDetailsData(StandardLevelDetailViewController modDetails, int selectedMod) { modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "SongNameText").text = _mods[selectedMod].Name; modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "DurationText").text = "Author"; modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "DurationValueText").text = _mods[selectedMod].Author; try { Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "BPMText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "BPMValueText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "BPMValueText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "NotesCountText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "NotesCountValueText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "DurationText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "DurationValueText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "ObstaclesCountText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "ObstaclesCountValueText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "Title").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "HighScoreText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "HighScoreValueText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "MaxComboText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "MaxComboValueText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "MaxRankText").gameObject); Destroy(modDetails.GetComponentsInChildren <TextMeshProUGUI>().First(x => x.name == "MaxRankValueText").gameObject); Destroy(modDetails.GetComponentsInChildren <RectTransform>().First(x => x.name == "YourStats").gameObject); } catch (Exception e) { } if (_toggleButton == null) { _toggleButton = modDetails.GetComponentInChildren <Button>(); } if (_compatibilitytext == null) { // var temp = modDetails.GetComponentsInChildren<TextMeshProUGUI>().First(x => x.name == "DurationText"); //_compatibilitytext = _modMenuUi.CreateTMPText(temp.rectTransform, "a", new Vector2(0.7f, 0.5f)); // ive tried a lot of stuff im sorry for this horrible solution // it's ok ^ - Kaori //_compatibilitytext.text = " This plugin doesnt work with BSMODUI"; } if (true) { //Utils.Log("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); //TODO: IMPLEMENT STUFFS _toggleButton.gameObject.SetActive(true); _modMenuUi.SetButtonText(ref _toggleButton, "Select"); //_compatibilitytext.gameObject.SetActive(false); DestroyImmediate(_toggleButton.GetComponent <GameEventOnUIButtonClick>()); _toggleButton.onClick = new Button.ButtonClickedEvent(); _toggleButton.onClick.AddListener(delegate { Plugin._currentSaberPath = _mods[selected].Path; }); } else { _toggleButton.gameObject.SetActive(false); _compatibilitytext.gameObject.SetActive(true); } }