private void PopDifficultyAndDetails() { bool isSolo = (freePlayFlowCoordinator is SoloFreePlayFlowCoordinator); if (isSolo) { SoloFreePlayFlowCoordinator soloCoordinator = freePlayFlowCoordinator as SoloFreePlayFlowCoordinator; int controllers = 0; if (soloCoordinator.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController").isInViewControllerHierarchy) { controllers++; } if (controllers > 0) { soloCoordinator.InvokePrivateMethod("PopViewControllersFromNavigationController", new object[] { soloCoordinator.GetPrivateField <DismissableNavigationController>("_navigationController"), controllers, null, false }); } } else { PartyFreePlayFlowCoordinator partyCoordinator = freePlayFlowCoordinator as PartyFreePlayFlowCoordinator; int controllers = 0; if (partyCoordinator.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController").isInViewControllerHierarchy) { controllers++; } if (controllers > 0) { partyCoordinator.InvokePrivateMethod("PopViewControllersFromNavigationController", new object[] { partyCoordinator.GetPrivateField <DismissableNavigationController>("_navigationController"), controllers, null, false }); } } }
public void showLeaderboard() { if (Data.Steam.SteamAPI.GetConnectionState() != SteamAPI.ConnectionState.CONNECTED || !_partyFlowCoordinator || !_partyFlowCoordinator.isActivated) { return; } _partyFlowCoordinator.InvokePrivateMethod("SetRightScreenViewController", new object[] { MultiplayerLobby.Instance.rightViewController, false }); }
public MockPartyViewController() { _partyFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault(); LevelListViewController level = ReflectionUtil.GetPrivateField <LevelListViewController>(_partyFlowCoordinator, "_levelListViewController"); detail = ReflectionUtil.GetPrivateField <StandardLevelDetailViewController>(_partyFlowCoordinator, "_levelDetailViewController"); BeatmapDifficultyViewController beatmap = ReflectionUtil.GetPrivateField <BeatmapDifficultyViewController>(_partyFlowCoordinator, "_beatmapDifficultyViewController"); _gameplaySetupViewController = ReflectionUtil.GetPrivateField <GameplaySetupViewController>(_partyFlowCoordinator, "_gameplaySetupViewController"); level.didActivateEvent += (first, type) => { if (Data.Steam.SteamAPI.GetConnectionState() != SteamAPI.ConnectionState.CONNECTED || !_partyFlowCoordinator || !_partyFlowCoordinator.isActivated) { return; } _partyFlowCoordinator.InvokePrivateMethod("SetRightScreenViewController", new object[] { MultiplayerLobby.Instance.rightViewController, true }); }; level.didSelectLevelEvent += didSelectLevel; beatmap.didSelectDifficultyEvent += didSelectBeatmap; mPlay = BeatSaberUI.CreateUIButton(detail.rectTransform, "CreditsButton", new Vector2(0f, -24f), new Vector2(40, 9f)); mPlay.SetButtonText("Play with Lobby"); mPlay.SetButtonTextSize(5f); mPlay.gameObject.SetActive(false); mPlay.ToggleWordWrapping(false); mPlay.onClick.AddListener(didSelectPlay); _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!"; } } }; }