Beispiel #1
0
        private void StandardLevelDetailViewController_didChangeDifficultyBeatmapEvent(
            StandardLevelDetailViewController controller, IDifficultyBeatmap difficultyBeatmap)
        {
            try
            {
                if (difficultyBeatmap.level is Search.SearchResultBeatmapLevel)
                {
                    Logger.Debug("didChangeDifficultyBeatmapEvent()");

                    var _standardLevelDetailView = controller.GetPrivateField <StandardLevelDetailView>("_standardLevelDetailView");
                    var _levelParamsPanel        = _standardLevelDetailView.GetPrivateField <LevelParamsPanel>("_levelParamsPanel");

                    _levelParamsPanel.bpm            = Mathf.Ceil(difficultyBeatmap.level.beatsPerMinute);
                    _levelParamsPanel.duration       = difficultyBeatmap.level.songDuration * 60;
                    _levelParamsPanel.notesPerSecond = difficultyBeatmap.beatmapData.notesCount / (difficultyBeatmap.level.songDuration * 60);
                    _levelParamsPanel.notesCount     = difficultyBeatmap.beatmapData.notesCount;
                    _levelParamsPanel.obstaclesCount = difficultyBeatmap.beatmapData.obstaclesCount;
                    _levelParamsPanel.bombsCount     = difficultyBeatmap.beatmapData.bombsCount;
                }
            }
            catch (Exception ex)
            {
                Logger.Debug(ex);
            }
        }
        /// <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 = StandardLevelDetailView.GetPrivateField <BeatmapCharacteristicSegmentedControlController>("_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 = StandardLevelDetailView.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);
        }
Beispiel #3
0
        private LevelParamsPanel ExtractPanel(FlowCoordinator flowCoordinator)
        {
            var LevelSelectionFlowCoordinator      = flowCoordinator;
            var LevelSelectionNavigationController = LevelSelectionFlowCoordinator.GetPrivateField <LevelSelectionNavigationController>("_levelSelectionNavigationController");

            LevelDetailViewController = LevelSelectionNavigationController.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController");
            var StandardLevelDetailView = LevelDetailViewController.GetPrivateField <StandardLevelDetailView>("_standardLevelDetailView");

            return(StandardLevelDetailView.GetPrivateField <LevelParamsPanel>("_levelParamsPanel"));
        }
Beispiel #4
0
        /// <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());

            // this is loaded late but available early, grab globally.
            LevelFilteringNavigationController = Resources.FindObjectsOfTypeAll <LevelFilteringNavigationController>().First();
            //LevelSelectionFlowCoordinator.GetPrivateField<LevelFilteringNavigationController>("_levelFilteringNavigationController");
            Logger.Debug("Acquired LevelFilteringNavigationController [{0}]", LevelFilteringNavigationController.GetInstanceID());

            // grab nav controller elements
            LevelCollectionViewController = LevelSelectionNavigationController.GetPrivateField <LevelCollectionViewController>("_levelCollectionViewController");
            Logger.Debug("Acquired LevelPackLevelsViewController [{0}]", LevelCollectionViewController.GetInstanceID());

            LevelDetailViewController = LevelSelectionNavigationController.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController");
            Logger.Debug("Acquired StandardLevelDetailViewController [{0}]", LevelDetailViewController.GetInstanceID());

            // grab level collection view controller elements
            LevelCollectionTableView = this.LevelCollectionViewController.GetPrivateField <LevelCollectionTableView>("_levelCollectionTableView");
            Logger.Debug("Acquired LevelPackLevelsTableView [{0}]", LevelCollectionTableView.GetInstanceID());

            // grab letel detail view
            StandardLevelDetailView = LevelDetailViewController.GetPrivateField <StandardLevelDetailView>("_standardLevelDetailView");
            Logger.Debug("Acquired StandardLevelDetailView [{0}]", StandardLevelDetailView.GetInstanceID());

            BeatmapCharacteristicSelectionViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSegmentedControlController>().First();
            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());

            TableView tableView = LevelCollectionTableView.GetPrivateField <TableView>("_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();

            BeatmapLevelsModel = Resources.FindObjectsOfTypeAll <BeatmapLevelsModel>().First();
        }
        /// <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();
        }
Beispiel #6
0
        private void StandardLevelDetailViewController_didPresentContentEvent(
            StandardLevelDetailViewController controller, StandardLevelDetailViewController.ContentType contentType)
        {
            try
            {
                if (LastSelectedPreviewLevel is Search.SearchResultBeatmapLevel level &&
                    !level.IsDownloadingBeatmap &&
                    !level.IsDownloadedBeatmap &&
                    contentType != StandardLevelDetailViewController.ContentType.OwnedAndDownloading)
                {
                    Logger.Debug("didPresentContentEvent()");

                    var _standardLevelBuyView    = controller.GetPrivateField <StandardLevelBuyView>("_standardLevelBuyView");
                    var _standardLevelDetailView = controller.GetPrivateField <StandardLevelDetailView>("_standardLevelDetailView");
                    var _playerDataModel         = controller.GetPrivateField <PlayerDataModel>("_playerDataModel");
                    var _showPlayerStats         = controller.GetPrivateField <bool>("_showPlayerStats");

                    _standardLevelDetailView.SetContent(level,
                                                        _playerDataModel.playerData.lastSelectedBeatmapDifficulty,
                                                        _playerDataModel.playerData.lastSelectedBeatmapCharacteristic,
                                                        _playerDataModel.playerData,
                                                        _showPlayerStats);

                    StandardLevelDetailViewController_didChangeDifficultyBeatmapEvent(controller, controller.selectedDifficultyBeatmap);

                    // loading, error, downloading
                    controller.GetPrivateField <LoadingControl>("_loadingControl").gameObject.SetActive(false);
                    controller.GetPrivateField <StandardLevelBuyView>("_standardLevelBuyView").gameObject.SetActive(false);
                    _standardLevelDetailView.gameObject.SetActive(true);

                    // didPresentContentEventが発生して無限ループになるので ShowContent() は使わない
                    // _standardLevelDetailView.ShowContent(StandardLevelDetailViewController.ContentType.OwnedAndReady);

                    _standardLevelDetailView.playButton.gameObject.SetActive(false);
                    _standardLevelDetailView.practiceButton.gameObject.SetActive(false);

                    if (DownloadButton == null)
                    {
                        DownloadButton = GameObject.Instantiate(_standardLevelDetailView.playButton.gameObject,
                                                                _standardLevelDetailView.playButton.transform.parent);
                        var button = DownloadButton.GetComponent <Button>();
                        button.onClick = new Button.ButtonClickedEvent();
                        button.onClick.AddListener(new UnityEngine.Events.UnityAction(OnClickDownloadButton));
                        DownloadButton.SetActive(true); // GetComponentInChildren でひかっけるのに必要?
                        DownloadButton.GetComponentInChildren <TextMeshProUGUI>().SetText("Download");
                        DownloadButton.name = "DownloadButton";
                        Logger.PrintHierarchy(DownloadButton.transform.parent.parent);
                    }
                    else if (level.IsDownloadedBeatmap)
                    {
                        DownloadButton.SetActive(false);
                    }
                    else
                    {
                        DownloadButton.SetActive(true);
                        // GetComponentInChildren でひかっけるのに必要
                        //  DownloadButton.GetComponentInChildren<TextMeshProUGUI>().SetText("Download");
                    }
                }
                else
                {
                    DownloadButton?.SetActive(false);
                }
            }