internal void ShowView(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
        {
            foreach (FlowCoordinator flow in Resources.FindObjectsOfTypeAll <FlowCoordinator>())
            {
                if (flow.name == "SoloFreePlayFlowCoordinator")
                {
                    soloFreePlayCoordinator = flow;
                }
            }
            if (soloFreePlayCoordinator != null)
            {
                //BeatSaberUI.MainFlowCoordinator.InvokeMethod("SetTopScreenViewController", new object[]
                //{
                //this.chatUIViewController,
                //ViewController.AnimationType.None
                //});

                soloFreePlayCoordinator.InvokeMethod("SetTopScreenViewController", new object[]
                {
                    this.chatUIViewController,
                    ViewController.AnimationType.None
                });

                chatUIViewController.Setup();
            }
        }
        /// <summary>
        /// Presents this flow coordinator and sets the list of songs to filter.
        /// This must be used instead of invoking the private PresentFlowCoordinator to ensure the list of levels is provided.
        /// </summary>
        /// <param name="parentFlowCoordinator">The flow coordinator that will present this flow coordinator.</param>
        /// <param name="levels">The list of levels that will be filtered.</param>
        public void Activate(FlowCoordinator parentFlowCoordinator, IPreviewBeatmapLevel[] levels)
        {
            Action loadBeatmaps = LoadBeatmaps;

            _unfilteredLevels = levels;
            parentFlowCoordinator.InvokeMethod("PresentFlowCoordinator", new object[] { this, loadBeatmaps, false, false });
        }
        private void ListBackPressed()
        {
            FlowCoordinator flowCoordinator = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First();

            flowCoordinator.InvokePrivateMethod("DismissViewController", new object[] { _menuButtonListViewController, null, false });
            flowCoordinator.SetProperty("title", string.Empty);
        }
        private void OnFreePlayFlowCoordinatorFinished(FlowCoordinator unused)
        {
            if (_freePlayFlowCoordinator is SoloFreePlayFlowCoordinator)
            {
                (_freePlayFlowCoordinator as SoloFreePlayFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }
            else if (_freePlayFlowCoordinator is PartyFreePlayFlowCoordinator)
            {
                (_freePlayFlowCoordinator as PartyFreePlayFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }
            else if (_freePlayFlowCoordinator is CampaignFlowCoordinator)
            {
                (_freePlayFlowCoordinator as CampaignFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }

            ToggleButtonsActive(false);
            BeatSaverDownloaderTweaks.HideTopButtons();

            // unapply filters before leaving the screen
            if (_filterViewController?.IsFilterApplied == true)
            {
                UnapplyFilters();

                SongBrowserTweaks.FiltersUnapplied();
            }

            _freePlayFlowCoordinator = null;
        }
        private void OnModeSelection(FreePlayMode mode)
        {
            if (SongBrowserTweaks.ModLoaded && !SongBrowserTweaks.Initialized && mode != FreePlayMode.Campaign)
            {
                StartCoroutine(GetSongBrowserButtons());
            }

            if (mode == FreePlayMode.Solo)
            {
                _freePlayFlowCoordinator = FindObjectOfType <SoloFreePlayFlowCoordinator>();
                (_freePlayFlowCoordinator as SoloFreePlayFlowCoordinator).didFinishEvent += OnFreePlayFlowCoordinatorFinished;

                ToggleButtonsActive(true);
                BeatSaverDownloaderTweaks.SetTopButtons(false);
            }
            else if (mode == FreePlayMode.Party)
            {
                _freePlayFlowCoordinator = FindObjectOfType <PartyFreePlayFlowCoordinator>();
                (_freePlayFlowCoordinator as PartyFreePlayFlowCoordinator).didFinishEvent += OnFreePlayFlowCoordinatorFinished;

                ToggleButtonsActive(true);
                BeatSaverDownloaderTweaks.SetTopButtons(false);
            }
            else if (mode == FreePlayMode.Campaign)
            {
                _freePlayFlowCoordinator = FindObjectOfType <CampaignFlowCoordinator>();
                (_freePlayFlowCoordinator as CampaignFlowCoordinator).didFinishEvent += OnFreePlayFlowCoordinatorFinished;

                ToggleButtonsActive(false);
                BeatSaverDownloaderTweaks.HideTopButtons();
            }

            SongBrowserTweaks.OnModeSelection();
        }
#pragma warning disable IDE0051 // Remove unused private members
        static void Prefix(FlowCoordinator flowCoordinator, Action finishedCallback = null, ViewController.AnimationDirection animationDirection = ViewController.AnimationDirection.Horizontal, bool immediately = false, bool replaceTopViewController = false)
#pragma warning restore IDE0051 // Remove unused private members
        {
            var flowType = flowCoordinator.GetType();

            if (flowType == typeof(SoloFreePlayFlowCoordinator))
            {
                Logger.Info("Initializing SongBrowser for Single Player Mode");
                SongBrowser.SongBrowserApplication.Instance.HandleSoloModeSelection();
            }
            else if (flowType == typeof(MultiplayerLevelSelectionFlowCoordinator))
            {
                Logger.Info("Initializing SongBrowser for Multiplayer Mode");
                SongBrowser.SongBrowserApplication.Instance.HandleMultiplayerModeSelection();
            }
            else if (flowType == typeof(PartyFreePlayFlowCoordinator))
            {
                Logger.Info("Initializing SongBrowser for Party Mode");
                SongBrowser.SongBrowserApplication.Instance.HandlePartyModeSelection();
            }
            else if (flowType == typeof(CampaignFlowCoordinator))
            {
                Logger.Info("Initializing SongBrowser for Multiplayer Mode");
                SongBrowser.SongBrowserApplication.Instance.HandleCampaignModeSelection();
            }

            return;
        }
예제 #7
0
        private void OnFreePlayFlowCoordinatorFinished(FlowCoordinator unused)
        {
            if (_freePlayFlowCoordinator is SoloFreePlayFlowCoordinator)
            {
                (_freePlayFlowCoordinator as SoloFreePlayFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }
            else if (_freePlayFlowCoordinator is PartyFreePlayFlowCoordinator)
            {
                (_freePlayFlowCoordinator as PartyFreePlayFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }
            else if (_freePlayFlowCoordinator is CampaignFlowCoordinator)
            {
                (_freePlayFlowCoordinator as CampaignFlowCoordinator).didFinishEvent -= OnFreePlayFlowCoordinatorFinished;
            }

            // unapply filters before leaving the screen
            if (FilterList.AnyApplied == true)
            {
                UnapplyFilters();

                SongBrowserTweaks.FiltersUnapplied();
            }

            _freePlayFlowCoordinator = null;
        }
예제 #8
0
        private void SetScreen(FlowCoordinator _activeFlowCoordinator, CustomViewController newViewController, VRUIViewController origViewController, bool right, bool immediately)
        {
            string        method     = right ? "SetRightScreenViewController" : "SetLeftScreenViewController";
            Action <bool> backAction = (immediate) => { _activeFlowCoordinator.InvokePrivateMethod(method, new object[] { PopViewControllerStack(right), immediate }); };

            _dismissCustom += backAction;  // custom back button behavior
            if (!newViewController.isActivated)
            {
                if (right)
                {
                    _rightViewControllerStack.Add(origViewController);
                }
                else
                {
                    _leftViewControllerStack.Add(origViewController);
                }

                if (newViewController.includeBackButton)
                {
                    newViewController.ClearBackButtonCallbacks();
                    newViewController.backButtonPressed += () => { backAction.Invoke(false); }; // default back button behavior
                }
                _activeFlowCoordinator.InvokePrivateMethod(method, new object[] { newViewController, immediately });
            }
        }
예제 #9
0
 public static void Show(FlowCoordinator fc)
 {
     fc.InvokeMethod("SetLeftScreenViewController", new object[] { instance.leftUi, ViewController.AnimationType.None });
     if (!SettingsMenu.instance.DisableGraphPanel)
     {
         fc.InvokeMethod("SetRightScreenViewController", new object[] { instance.rightUi, ViewController.AnimationType.None });
     }
 }
 public void SetParentFlowCoordinator(FlowCoordinator parent)
 {
     if (!AllowFlowCoordinatorChange)
     {
         throw new InvalidOperationException("Changing the parent FlowCoordinator is not allowed on this instance.");
     }
     ParentFlowCoordinator = parent;
 }
        /// <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);
        }
예제 #12
0
        /// <summary>
        /// Presents this flow coordinator and sets search space.
        /// This must be used instead of invoking the private PresentFlowCoordinator to ensure the list of levels is provided.
        /// </summary>
        /// <param name="parentFlowCoordinator">The flow coordinator that will be immediately higher in the hierarchy that will present this flow coordinator.</param>
        /// <param name="levels">The list of levels that will be used as the search space.</param>
        public void Activate(FlowCoordinator parentFlowCoordinator, IBeatmapLevelPack levelPack)
        {
            _levelsSearchSpace = levelPack.beatmapLevelCollection.beatmapLevels;
            Action onFinish = PushInitialViewControllersToNavigationController;

            parentFlowCoordinator.PresentFlowCoordinator(this, onFinish);

            WordPredictionEngine.instance.SetActiveWordStorageFromLevelPack(levelPack);
        }
        /// <summary>
        /// Presents this flow coordinator and sets search space.
        /// This must be used instead of invoking the private PresentFlowCoordinator to ensure the list of levels is provided.
        /// </summary>
        /// <param name="parentFlowCoordinator">The flow coordinator that will be immediately higher in the hierarchy that will present this flow coordinator.</param>
        /// <param name="levels">The list of levels that will be used as the search space.</param>
        public void Activate(FlowCoordinator parentFlowCoordinator, IBeatmapLevelPack levelPack)
        {
            _levelsSearchSpace = levelPack.beatmapLevelCollection.beatmapLevels;
            Action onFinish = PushInitialViewControllersToNavigationController;

            parentFlowCoordinator.InvokePrivateMethod("PresentFlowCoordinator", new object[] { this, onFinish, false, false });

            WordPredictionEngine.Instance.SetActiveWordStorageFromLevelPack(levelPack);
        }
예제 #14
0
        private void Initialize(FlowCoordinator flowCoordinator)
        {
            var statsPanel     = ExtractPanel(flowCoordinator);
            var statTransforms = statsPanel.GetComponentsInChildren <RectTransform>();

            _ankhRatingButton = UnityEngine.Object.Instantiate(statTransforms[1], statsPanel.transform, false);
            SetStatButtonIcon(_ankhRatingButton, AnkhIcon);
            DestroyHoverHint(_ankhRatingButton);
        }
예제 #15
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"));
        }
예제 #16
0
 private void ResultsViewController_DidDeactivate(bool removedFromHierarchy, bool screenSystemDisabling)
 {
     _data.disabled = false;
     _siraSubmissionView.Enabled(false);
     if (_siraSubmissionView.isInViewControllerHierarchy)
     {
         FlowCoordinator flowCoordinator = _soloFreePlayFlowCoordinator.IsFlowCoordinatorInHierarchy(_soloFreePlayFlowCoordinator) ? _soloFreePlayFlowCoordinator as FlowCoordinator : _campaignFlowCoordinator;
         flowCoordinator.InvokeMethod <object, FlowCoordinator>("SetBottomScreenViewController", null, ViewController.AnimationType.Out);
     }
 }
예제 #17
0
 private void ResultsViewController_DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
 {
     if (_data.disabled)
     {
         FlowCoordinator flowCoordinator = _soloFreePlayFlowCoordinator.IsFlowCoordinatorInHierarchy(_soloFreePlayFlowCoordinator) ? _soloFreePlayFlowCoordinator as FlowCoordinator : _campaignFlowCoordinator;
         flowCoordinator.InvokeMethod <object, FlowCoordinator>("SetBottomScreenViewController", _siraSubmissionView, ViewController.AnimationType.In);
         _siraSubmissionView.Enabled(true);
         _siraSubmissionView.SetText($"<size=115%><color=#f00e0e>{LOCAL_KEY.LocalizationGetOr("Score Submission Disabled By")}</color></size>\n{_data.Read()}");
     }
 }
예제 #18
0
 public static void Show(FlowCoordinator fc)
 {
     if (endLevelUI == null)
     {
         endLevelUI = BeatSaberUI.CreateViewController <EndLevelViewController>();
     }
     // Logger.log.Debug("MP GOT HERE");
     //   fc.InvokeMethod("SetTitle", new object[] {"BeatFollower", ViewController.AnimationType.None});
     fc.InvokeMethod("SetTopScreenViewController", new object[] { endLevelUI, ViewController.AnimationType.None });
 }
예제 #19
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();
        }
        /// <summary>
        /// When the back button is pressed
        /// </summary>
        /// <param name="p_TopViewController">Controller instance</param>
        protected override void BackButtonWasPressed(ViewController p_TopViewController)
        {
            /// Restore original flow coordinator
            if (m_BackupFlowCoordinator != null)
            {
                m_BackupFlowCoordinator.DismissFlowCoordinator(this);
            }
            else
            {
                BeatSaberUI.MainFlowCoordinator.DismissFlowCoordinator(this, null);
            }

            m_BackupFlowCoordinator = null;
        }
 private void SongListTweaks_didFinishEvent(MainMenuViewController sender, MainMenuViewController.MenuButton result)
 {
     if (result == MainMenuViewController.MenuButton.SoloFreePlay)
     {
         _freePlayFlowCoordinator = FindObjectOfType <SoloFreePlayFlowCoordinator>();
     }
     else if (result == MainMenuViewController.MenuButton.Party)
     {
         _freePlayFlowCoordinator = FindObjectOfType <PartyFreePlayFlowCoordinator>();
     }
     else
     {
         _freePlayFlowCoordinator = null;
     }
 }
        private void PresentList()
        {
            if (_menuButtonListViewController == null)
            {
                _menuButtonListViewController = BeatSaberUI.CreateViewController <MenuButtonListViewController>();
                _menuButtonListViewController.pinButtonPushed   += PinButtonWasPushed;
                _menuButtonListViewController.backButtonPressed += ListBackPressed;
            }
            _menuButtonListViewController.SetData(buttonData);

            // Using MainFlowCoordinator instead of CustomMenu for compatibility with mods
            FlowCoordinator flowCoordinator = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First();

            flowCoordinator.InvokePrivateMethod("PresentViewController", new object[] { _menuButtonListViewController, null, false });
            flowCoordinator.SetProperty("title", "Mods");
        }
예제 #24
0
        private void OnModeSelection(FreePlayMode mode)
        {
            if (mode == FreePlayMode.Solo)
            {
                Logger.log.Debug("Selected solo free play mode");
                _freePlayFlowCoordinator = FindObjectOfType <SoloFreePlayFlowCoordinator>();
                (_freePlayFlowCoordinator as SoloFreePlayFlowCoordinator).didFinishEvent += OnFreePlayFlowCoordinatorFinished;

                PrepareLevelPackSelectedEvent();
                if (!SongBrowserTweaks.ModLoaded)
                {
                    UnityCoroutineHelper.StartDelayedAction(SelectSavedLevelPack);
                }
                else if (!SongBrowserTweaks.Initialized)
                {
                    StartCoroutine(GetSongBrowserButtons());
                }
            }
            else if (mode == FreePlayMode.Party)
            {
                Logger.log.Debug("Selected party free play mode");
                _freePlayFlowCoordinator = FindObjectOfType <PartyFreePlayFlowCoordinator>();
                (_freePlayFlowCoordinator as PartyFreePlayFlowCoordinator).didFinishEvent += OnFreePlayFlowCoordinatorFinished;

                PrepareLevelPackSelectedEvent();
                if (!SongBrowserTweaks.ModLoaded)
                {
                    UnityCoroutineHelper.StartDelayedAction(SelectSavedLevelPack);
                }
                else if (!SongBrowserTweaks.Initialized)
                {
                    StartCoroutine(GetSongBrowserButtons());
                }
            }
            else if (mode == FreePlayMode.Campaign)
            {
                Logger.log.Debug("Selected campaign play mode");
                _freePlayFlowCoordinator = FindObjectOfType <CampaignFlowCoordinator>();
                (_freePlayFlowCoordinator as CampaignFlowCoordinator).didFinishEvent += OnFreePlayFlowCoordinatorFinished;
            }

            // UIState in SongBrowser is always reset to Main, so we need to disable the filter button
            SongBrowserTweaks.DisableOtherFiltersButton();
        }
예제 #25
0
        public FlowCoordinator PresentDownloaderFlowCoordinator(FlowCoordinator parent, Action dismissedCallback)
        {
            try
            {
                if (_coordinator == null)
                {
                    CustomMoreSongsFlowCoordinator moreSongsFlow = BeatSaberUI.CreateFlowCoordinator <CustomMoreSongsFlowCoordinator>();

                    moreSongsFlow.ParentFlowCoordinator = parent;
                    _coordinator = moreSongsFlow;
                }

                parent.PresentFlowCoordinator(_coordinator, dismissedCallback);
                return(_coordinator);
            }catch (Exception ex)
            {
                Plugin.log.Error($"Error creating MoreSongsFlowCoordinator: {ex}");
                return(null);
            }
        }
예제 #26
0
 private void SongListTweaks_didFinishEvent(MainMenuViewController sender, MainMenuViewController.MenuButton result)
 {
     if (result == MainMenuViewController.MenuButton.SoloFreePlay)
     {
         _freePlayFlowCoordinator = FindObjectOfType <SoloFreePlayFlowCoordinator>();
         _lastCharacteristic      = _beatmapCharacteristics.First(x => x.characteristicName == "Standard");
         lastPlaylist             = null;
     }
     else if (result == MainMenuViewController.MenuButton.Party)
     {
         _freePlayFlowCoordinator = FindObjectOfType <PartyFreePlayFlowCoordinator>();
         _lastCharacteristic      = _beatmapCharacteristics.First(x => x.characteristicName == "Standard");
         lastPlaylist             = null;
     }
     else
     {
         _freePlayFlowCoordinator = null;
         lastPlaylist             = null;
     }
 }
예제 #27
0
        private void SetScreen(FlowCoordinator _activeFlowCoordinator, CustomViewController newViewController, VRUIViewController origViewController, ViewControllerPosition pos, bool immediately)
        {
            Action <bool> backAction = (immediate) => SetViewController(_activeFlowCoordinator, PopViewControllerStack(pos), pos, immediate);

            _dismissCustom += backAction;  // custom back button behavior
            if (!newViewController.isActivated)
            {
                if (!_viewControllerStacks.ContainsKey(pos))
                {
                    _viewControllerStacks[pos] = new List <VRUIViewController>();
                }

                _viewControllerStacks[pos].Add(origViewController);
                if (newViewController.includeBackButton)
                {
                    newViewController.ClearBackButtonCallbacks();
                    newViewController.backButtonPressed += () => { backAction.Invoke(false); }; // default back button behavior
                }
                SetViewController(_activeFlowCoordinator, newViewController, pos, immediately);
            }
        }
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Switch to main view
        /// </summary>
        internal void Show()
        {
            if (IsFlowCoordinatorInHierarchy(this))
            {
                return;
            }

            m_BackupFlowCoordinator = null;

            if (!this.IsFlowCoordinatorInHierarchy(this))
            {
                FlowCoordinator l_GameCoordinator = Resources.FindObjectsOfTypeAll <FlowCoordinator>().Where(x => x.isActivated).LastOrDefault();
                if (l_GameCoordinator != null && this.IsFlowCoordinatorInHierarchy(l_GameCoordinator))
                {
                    l_GameCoordinator.PresentFlowCoordinator(this);
                    m_BackupFlowCoordinator = l_GameCoordinator;
                }

                return;
            }
        }
예제 #29
0
 private void AddMainButton()
 {
     MenuButtonUI.AddButton("Avatars", delegate()
     {
         var mainFlowCoordinator = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First();
         if (_flowCoordinator == null)
         {
             var flowCoordinator = new GameObject("AvatarListFlowCoordinator").AddComponent <AvatarListFlowCoordinator>();
             flowCoordinator.OnContentCreated = (content) =>
             {
                 content.onBackPressed = () =>
                 {
                     mainFlowCoordinator.InvokePrivateMethod("DismissFlowCoordinator", new object[] { flowCoordinator, null, false });
                 };
                 return("Avatar Select");
             };
             _flowCoordinator = flowCoordinator;
         }
         mainFlowCoordinator.InvokePrivateMethod("PresentFlowCoordinator", new object[] { _flowCoordinator, null, false, false });
     });
 }
예제 #30
0
        private void OnModeSelection(FreePlayMode mode)
        {
            if (mode == FreePlayMode.Solo)
            {
                _freePlayFlowCoordinator = FindObjectOfType <SoloFreePlayFlowCoordinator>();
                (_freePlayFlowCoordinator as SoloFreePlayFlowCoordinator).didFinishEvent += OnFreePlayFlowCoordinatorFinished;

                if (!SongBrowserTweaks.ModLoaded)
                {
                    PrepareLevelPackSelectedEvent();
                    StartCoroutine(UIUtilities.DelayedAction(SelectSavedLevelPack));
                }
                else if (!SongBrowserTweaks.Initialized)
                {
                    StartCoroutine(GetSongBrowserButtons());
                }
            }
            else if (mode == FreePlayMode.Party)
            {
                _freePlayFlowCoordinator = FindObjectOfType <PartyFreePlayFlowCoordinator>();
                (_freePlayFlowCoordinator as PartyFreePlayFlowCoordinator).didFinishEvent += OnFreePlayFlowCoordinatorFinished;

                if (!SongBrowserTweaks.ModLoaded)
                {
                    PrepareLevelPackSelectedEvent();
                    StartCoroutine(UIUtilities.DelayedAction(SelectSavedLevelPack));
                }
                else if (!SongBrowserTweaks.Initialized)
                {
                    StartCoroutine(GetSongBrowserButtons());
                }
            }
            else if (mode == FreePlayMode.Campaign)
            {
                _freePlayFlowCoordinator = FindObjectOfType <CampaignFlowCoordinator>();
                (_freePlayFlowCoordinator as CampaignFlowCoordinator).didFinishEvent += OnFreePlayFlowCoordinatorFinished;
            }

            SongBrowserTweaks.OnModeSelection();
        }