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 }); } } }
protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) { if (firstActivation) { SetTitle("Qualifier Room", ViewController.AnimationType.None); showBackButton = true; _playerDataModel = Resources.FindObjectsOfTypeAll <PlayerDataModel>().First(); _menuLightsManager = Resources.FindObjectsOfTypeAll <MenuLightsManager>().First(); _soloFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); _campaignFlowCoordinator = Resources.FindObjectsOfTypeAll <CampaignFlowCoordinator>().First(); _resultsViewController = Resources.FindObjectsOfTypeAll <ResultsViewController>().First(); _scoreLights = _soloFreePlayFlowCoordinator.GetField <MenuLightsPresetSO>("_resultsClearedLightsPreset"); _redLights = _soloFreePlayFlowCoordinator.GetField <MenuLightsPresetSO>("_resultsFailedLightsPreset"); _defaultLights = _soloFreePlayFlowCoordinator.GetField <MenuLightsPresetSO>("_defaultLightsPreset"); _songSelection = BeatSaberUI.CreateViewController <SongSelection>(); _songSelection.SongSelected += songSelection_SongSelected; _songDetail = BeatSaberUI.CreateViewController <SongDetail>(); _songDetail.PlayPressed += songDetail_didPressPlayButtonEvent; _songDetail.DisableCharacteristicControl = true; _songDetail.DisableDifficultyControl = true; _songDetail.DisablePlayButton = false; } if (addedToHierarchy) { _songSelection.SetSongs(Event.QualifierMaps.ToList()); ProvideInitialViewControllers(_songSelection); } }
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene) { SongListUtils.Initialize(); if (scene.name == "GameCore") { _isInGame = true; } if (scene.name != "Menu") { return; } _isInGame = false; _standardLevelSelectionFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); if (!_standardLevelSelectionFlowCoordinator) { return; } _standardLevelListViewController = ReflectionUtil.GetPrivateField <LevelListViewController>(_standardLevelSelectionFlowCoordinator, "_levelListViewController"); if (!_standardLevelListViewController) { return; } _standardLevelListViewController.didSelectLevelEvent += standardLevelListViewController_didSelectLevelEvent; }
public static void Init() { Plugin.ApplyHarmonyPatches(); if (MainMenuViewController == null) { SoloFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); PartyFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault(); MainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().FirstOrDefault(); if (MainMenuViewController == null) { return; } MainMenuViewController.didFinishEvent += MainMenuViewController_didFinishEvent; /* * if (CharacteristicSelectionViewController == null) * { * CharacteristicSelectionViewController = Resources.FindObjectsOfTypeAll<BeatmapCharacteristicSegmentedControlController>().FirstOrDefault(); * if (CharacteristicSelectionViewController != null) * CharacteristicSelectionViewController.didSelectBeatmapCharacteristicEvent += CharacteristicSelectionViewController_didSelectBeatmapCharacteristicEvent; * } */ } }
public void OpenSongsList(string songToSelectWhenLoaded = null) { if (songListViewController == null) { songListViewController = BeatSaberUI.CreateViewController <SongListViewController>(); } if (_bottomViewController == null) { _bottomViewController = BeatSaberUI.CreateViewController <BottomViewController>(); } if (_resultsViewController == null) { _resultsViewController = Resources.FindObjectsOfTypeAll <ResultsViewController>().First(); } if (_playerDataModel == null) { _playerDataModel = Resources.FindObjectsOfTypeAll <PlayerDataModel>().First(); } if (_menuLightsManager == null) { _menuLightsManager = Resources.FindObjectsOfTypeAll <MenuLightsManager>().First(); } if (_soloFreePlayFlowCoordinator == null) { _soloFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); } if (_campaignFlowCoordinator == null) { _campaignFlowCoordinator = Resources.FindObjectsOfTypeAll <CampaignFlowCoordinator>().First(); } if (_alwaysOwnedContent == null) { _alwaysOwnedContent = Resources.FindObjectsOfTypeAll <AlwaysOwnedContentSO>().First(); } if (_primaryLevelCollection == null) { _primaryLevelCollection = _alwaysOwnedContent.alwaysOwnedPacks.First(x => x.packID == OstHelper.packs[0].PackID).beatmapLevelCollection as BeatmapLevelCollectionSO; } if (_secondaryLevelCollection == null) { _secondaryLevelCollection = _alwaysOwnedContent.alwaysOwnedPacks.First(x => x.packID == OstHelper.packs[1].PackID).beatmapLevelCollection as BeatmapLevelCollectionSO; } if (_tertiaryLevelCollection == null) { _tertiaryLevelCollection = _alwaysOwnedContent.alwaysOwnedPacks.First(x => x.packID == OstHelper.packs[2].PackID).beatmapLevelCollection as BeatmapLevelCollectionSO; } if (_extrasLevelCollection == null) { _extrasLevelCollection = _alwaysOwnedContent.alwaysOwnedPacks.First(x => x.packID == OstHelper.packs[3].PackID).beatmapLevelCollection as BeatmapLevelCollectionSO; } if (!songListViewController.isInViewControllerHierarchy || !songListViewController.isActiveAndEnabled) { SetViewControllersToNavigationController(_mainModNavigationController, new ViewController[] { songListViewController }); songListViewController.SelectWhenLoaded(songToSelectWhenLoaded); songListViewController.SongListRowSelected += SongListRowSelected; songListViewController.ReloadPressed += () => ReloadServerData(); ReloadServerData(); } }
internal void OnLoad() { initialized = false; // remove potential for duplicate event calls BSEvents.levelSelected -= BSEvents_levelSelected; // attach to level selected event if we are enabled, and double presses are required if (Plugin.cfg.Enabled && Plugin.cfg.DoublePress) { BSEvents.levelSelected += BSEvents_levelSelected; } MainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().FirstOrDefault(); MainMenuViewController.didFinishEvent += MainMenuViewController_didFinishEvent; // get PromoViewController PromoViewController = Resources.FindObjectsOfTypeAll <PromoViewController>().FirstOrDefault(); PromoViewController.promoButtonWasPressedEvent += PromoViewController_promoButtonWasPressedEvent; SoloFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); SoloFreePlayFlowCoordinator.didFinishEvent += SoloFreePlayFlowCoordinator_didFinishEvent; StandardLevelDetailView = Resources.FindObjectsOfTypeAll <StandardLevelDetailView>().LastOrDefault(v => v.name.IndexOf("Clone", StringComparison.OrdinalIgnoreCase) == -1); // setup settings SetupUI(); }
private IEnumerator DelayedActiveSceneChanged(Scene scene) { yield return(new WaitForSeconds(0.1f)); SongListUtils.Initialize(); if (scene.name == "GameCore") { _isInGame = true; } if (scene.name != "MenuCore") { yield break; } _isInGame = false; _standardLevelSelectionFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); if (!_standardLevelSelectionFlowCoordinator) { yield break; } _standardLevelListViewController = ReflectionUtil.GetPrivateField <LevelPackLevelsViewController>(_standardLevelSelectionFlowCoordinator, "_levelPackLevelsViewController"); if (!_standardLevelListViewController) { yield break; } _standardLevelListViewController.didSelectLevelEvent -= standardLevelListViewController_didSelectLevelEvent; _standardLevelListViewController.didSelectLevelEvent += standardLevelListViewController_didSelectLevelEvent; }
public static void Init() { Plugin.ApplyHarmonyPatches(); if (CharacteristicSelectionViewController == null) { CharacteristicSelectionViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSelectionViewController>().FirstOrDefault(); if (CharacteristicSelectionViewController == null) { Utilities.Logger.Log("Characteristic View Controller null"); return; } CharacteristicSelectionViewController.didSelectBeatmapCharacteristicEvent += CharacteristicSelectionViewController_didSelectBeatmapCharacteristicEvent; } if (MainMenuViewController == null) { SoloFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); PartyFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault(); MainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().FirstOrDefault(); if (MainMenuViewController == null) { return; } MainMenuViewController.didFinishEvent += MainMenuViewController_didFinishEvent; } }
static void Postfix(ref SoloFreePlayFlowCoordinator __instance, LevelCompletionResults levelCompletionResults) { // Show end of song UI if (levelCompletionResults.levelEndAction == LevelCompletionResults.LevelEndAction.None) { EndOfLevelUICreator.Show(__instance); } }
internal Display(Data data, SiraSubmissionView siraSubmissionView, ResultsViewController resultsViewController, CampaignFlowCoordinator campaignFlowCoordinator, SoloFreePlayFlowCoordinator soloFreePlayFlowCoordinator) { _data = data; _siraSubmissionView = siraSubmissionView; _resultsViewController = resultsViewController; _campaignFlowCoordinator = campaignFlowCoordinator; _soloFreePlayFlowCoordinator = soloFreePlayFlowCoordinator; }
static bool Prefix(MissionLevelScenesTransitionSetupDataSO missionLevelScenesTransitionSetupData, MissionCompletionResults missionCompletionResults, CampaignFlowCoordinator __instance, MissionSelectionNavigationController ____missionSelectionNavigationController) { if (!(____missionSelectionNavigationController.selectedMissionNode.missionData is CustomMissionDataSO)) { return(true); } ChallengeExternalModifiers.onChallengeEnd?.Invoke(); if (missionCompletionResults.levelCompletionResults.levelEndAction == LevelCompletionResults.LevelEndAction.Restart) { ____missionSelectionNavigationController.GetPrivateField <Action <MissionSelectionNavigationController> >("didPressPlayButtonEvent")(____missionSelectionNavigationController); return(false); } if (missionCompletionResults.levelCompletionResults.levelEndStateType == LevelCompletionResults.LevelEndStateType.Cleared && missionCompletionResults.IsMissionComplete) { CustomMissionDataSO customMissionData = ____missionSelectionNavigationController.selectedMissionNode.missionData as CustomMissionDataSO; Campaign campaign = customMissionData.campaign; Challenge challenge = customMissionData.challenge; foreach (UnlockableItem item in challenge.unlockableItems) { try { item.UnlockItem(campaign.path); } catch (Exception ex) { Console.WriteLine("Failed to unlock item: " + item.fileName + " - Exception: " + ex.Message); } } UnlockedItemsViewController unlockedItemsViewController = Resources.FindObjectsOfTypeAll <UnlockedItemsViewController>().First(); unlockedItemsViewController.items = challenge.unlockableItems; unlockedItemsViewController.index = 0; if (unlockedItemsViewController.items.Count > 0) { __instance.InvokeMethod("SetBottomScreenViewController", new object[] { unlockedItemsViewController, false }); } if (challenge.unlockMap) { UnlockedMaps.CompletedChallenge(challenge.name); } //Score submission if (customMissionData.gameplayModifiers.songSpeedMul == 1f && customMissionData.gameplayModifiers.fastNotes == false && customMissionData.gameplayModifiers.failOnSaberClash == false) { SoloFreePlayFlowCoordinator freePlayCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); PlayerDataModelSO dataModel = freePlayCoordinator.GetPrivateField <PlayerDataModelSO>("_playerDataModel"); PlayerData currentLocalPlayer = dataModel.playerData; IDifficultyBeatmap difficultyBeatmap = Loader.BeatmapLevelsModelSO.GetBeatmapLevelIfLoaded(customMissionData.customLevel.levelID).beatmapLevelData.GetDifficultyBeatmap(customMissionData.beatmapCharacteristic, customMissionData.beatmapDifficulty); PlayerLevelStatsData playerLevelStatsData = currentLocalPlayer.GetPlayerLevelStatsData(difficultyBeatmap.level.levelID, difficultyBeatmap.difficulty, difficultyBeatmap.parentDifficultyBeatmapSet.beatmapCharacteristic); LevelCompletionResults levelCompletionResults = missionCompletionResults.levelCompletionResults; playerLevelStatsData.UpdateScoreData(levelCompletionResults.modifiedScore, levelCompletionResults.maxCombo, levelCompletionResults.fullCombo, levelCompletionResults.rank); //todo Need change??? //freePlayCoordinator.GetPrivateField<PlatformLeaderboardsModel>("_platformLeaderboardsModel").AddScoreFromComletionResults(difficultyBeatmap, levelCompletionResults); } __instance.StartCoroutine(CustomCampaignLeaderboard.SubmitScore(challenge, missionCompletionResults)); } return(true); }
private void SetupPreMap() { SoloFreePlayFlowCoordinator coord = UnityEngine.Object.FindObjectOfType <SoloFreePlayFlowCoordinator>(); Practice = ((PlayerDataModelSO)typeof(SoloFreePlayFlowCoordinator).GetField("_playerDataModel", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(coord)).sharedPracticeSettings; GameplaySetupViewController gameplayViewController = (GameplaySetupViewController)typeof(SoloFreePlayFlowCoordinator).GetField("_gameplaySetupViewController", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(coord); Modifiers = new GameplayModifiers(gameplayViewController.gameplayModifiers); PlayerSettings = gameplayViewController.playerSettings; Difficulty = ((StandardLevelDetailViewController)typeof(SoloFreePlayFlowCoordinator).GetField("_levelDetailViewController", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(coord)).selectedDifficultyBeatmap; }
private void SceneManager_activeSceneChanged(UnityEngine.SceneManagement.Scene arg0, UnityEngine.SceneManagement.Scene arg1) { if (arg1.name == "Menu") { if (_characteristicViewController == null) { _characteristicViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSelectionViewController>().FirstOrDefault(); if (_characteristicViewController == null) { return; } _characteristicViewController.didSelectBeatmapCharacteristicEvent += _characteristicViewController_didSelectBeatmapCharacteristicEvent; } if (_soloFlowCoordinator == null) { _soloFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); if (_soloFlowCoordinator == null) { return; } _soloDetailView = _soloFlowCoordinator.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController"); _practiceViewController = _soloFlowCoordinator.GetPrivateField <PracticeViewController>("_practiceViewController"); if (_soloDetailView != null) { _soloDetailView.didPressPlayButtonEvent += _soloDetailView_didPressPlayButtonEvent; } else { Log("Detail View Null", Plugin.LogLevel.Info); } if (_practiceViewController != null) { _practiceViewController.didPressPlayButtonEvent += _practiceViewController_didPressPlayButtonEvent; } else { Log("Practice View Null", Plugin.LogLevel.Info); } } if (_partyFlowCoordinator == null) { _partyFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault(); } if (saveRequested) { Settings.Save(); saveRequested = false; } } }
public MenuColorSwapper(Config.Menu menuConfig, MenuLightsManager menuLightsManager, MainFlowCoordinator mainFlowCoordinator, CampaignFlowCoordinator campaignFlowCoordinator, SoloFreePlayFlowCoordinator soloFreePlayFlowCoordinator, PartyFreePlayFlowCoordinator partyFreePlayFlowCoordinator, CenterStageScreenController centerStageScreenController) { _menuConfig = menuConfig; _menuLightsManager = menuLightsManager; _mainFlowCoordinator = mainFlowCoordinator; _campaignFlowCoordinator = campaignFlowCoordinator; _centerStageScreenController = centerStageScreenController; _soloFreePlayFlowCoordinator = soloFreePlayFlowCoordinator; _partyFreePlayFlowCoordinator = partyFreePlayFlowCoordinator; }
public void Constraactor(SoloFreePlayFlowCoordinator soloFreePlayFlowCoordinator, LevelCollectionViewController levelCollectionViewController, RequestFlowCoordinator requestFlowCoordinator, RequestBot bot) { _soloFlowCoordinator = soloFreePlayFlowCoordinator; _levelCollectionViewController = levelCollectionViewController; _flowCoordinator = requestFlowCoordinator; _bot = bot; _bot.RecevieRequest += this._bot_RecevieRequest; _bot.Dismiss += this.Bot_Dismiss; _bot.UpdateUI += this._bot_UpdateUI; this.transform.parent = _levelCollectionViewController.rectTransform; }
public override void Instantiate() { if (initialized) { return; } //We have to find our own target //TODO: Clean up time complexity issue. This is called for each new option SoloFreePlayFlowCoordinator sfpfc = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); GameplaySetupViewController gsvc = sfpfc.GetField <GameplaySetupViewController>("_gameplaySetupViewController"); RectTransform container = (RectTransform)gsvc.transform.Find("GameplayModifiers").Find("RightColumn"); gameObject = UnityEngine.Object.Instantiate(container.Find("NoFail").gameObject, container); gameObject.name = optionName; gameObject.layer = container.gameObject.layer; gameObject.transform.parent = container; gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localScale = Vector3.one; gameObject.transform.rotation = Quaternion.identity; gameObject.SetActive(false); var gmt = gameObject.GetComponent <GameplayModifierToggle>(); if (gmt != null) { gmt.toggle.isOn = GetValue; gmt.toggle.onValueChanged.RemoveAllListeners(); gmt.toggle.onValueChanged.AddListener((bool e) => { OnToggle?.Invoke(e); }); GameplayModifierParamsSO _gameplayModifier = new GameplayModifierParamsSO(); _gameplayModifier.SetPrivateField("_modifierName", optionName); _gameplayModifier.SetPrivateField("_hintText", hintText); _gameplayModifier.SetPrivateField("_multiplier", 0.0f); _gameplayModifier.SetPrivateField("_icon", optionIcon == null ? gmt.GetPrivateField <GameplayModifierParamsSO>("_gameplayModifier").icon : optionIcon); gmt.SetPrivateField("_gameplayModifier", _gameplayModifier); if (hintText != String.Empty) { var hoverHint = gmt.GetPrivateField <HoverHint>("_hoverHint"); hoverHint.text = hintText; hoverHint.name = optionName; hoverHint.enabled = true; var hoverHintController = Resources.FindObjectsOfTypeAll <HoverHintController>().First(); hoverHint.SetPrivateField("_hoverHintController", hoverHintController); } } initialized = true; }
public override void Instantiate() { if (initialized) { return; } //We have to find our own target //TODO: Clean up time complexity issue. This is called for each new option SoloFreePlayFlowCoordinator sfpfc = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); GameplaySetupViewController gsvc = sfpfc.GetField <GameplaySetupViewController>("_gameplaySetupViewController"); RectTransform container = (RectTransform)gsvc.transform.Find("GameplayModifiers").Find("RightColumn"); var volumeSettings = Resources.FindObjectsOfTypeAll <VolumeSettingsController>().FirstOrDefault(); gameObject = UnityEngine.Object.Instantiate(volumeSettings.gameObject, container); gameObject.name = optionName; gameObject.GetComponentInChildren <TMP_Text>().text = optionName; //Slim down the toggle option so it fits in the space we have before the divider (gameObject.transform as RectTransform).sizeDelta = new Vector2(50, (gameObject.transform as RectTransform).sizeDelta.y); //This magical nonsense is courtesy of Taz and his SettingsUI class VolumeSettingsController volume = gameObject.GetComponent <VolumeSettingsController>(); ListViewController newListSettingsController = (ListViewController)ReflectionUtil.CopyComponent(volume, typeof(ListSettingsController), typeof(ListViewController), gameObject); UnityEngine.Object.DestroyImmediate(volume); newListSettingsController.values = _options.Keys.ToList(); newListSettingsController.SetValue = OnChange; newListSettingsController.GetValue = () => { if (GetValue != null) { return(GetValue.Invoke()); } return(_options.Keys.ElementAt(0)); }; newListSettingsController.GetTextForValue = (v) => { if (_options.ContainsKey(v)) { return(_options[v]); } return("UNKNOWN"); }; //Initialize the controller, as if we had just opened the settings menu newListSettingsController.Init(); gameObject.SetActive(false); initialized = true; }
public static void InitializeCoordinators() { if (_characteristicViewController == null) { _characteristicViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSelectionViewController>().FirstOrDefault(); if (_characteristicViewController == null) { return; } _characteristicViewController.didSelectBeatmapCharacteristicEvent += _characteristicViewController_didSelectBeatmapCharacteristicEvent; } if (_soloFlowCoordinator == null) { _soloFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); if (_soloFlowCoordinator == null) { return; } _soloDetailView = _soloFlowCoordinator.GetField <StandardLevelDetailViewController>("_levelDetailViewController"); _practiceViewController = _soloFlowCoordinator.GetField <PracticeViewController>("_practiceViewController"); if (_soloDetailView != null) { _soloDetailView.didPressPlayButtonEvent += _soloDetailView_didPressPlayButtonEvent; } else { ChromaLogger.Log("Detail View Null", ChromaLogger.Level.WARNING); } if (_practiceViewController != null) { _practiceViewController.didPressPlayButtonEvent += _practiceViewController_didPressPlayButtonEvent; } else { ChromaLogger.Log("Practice View Null", ChromaLogger.Level.WARNING); } } if (_partyFlowCoordinator == null) { _partyFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault(); } }
public void OnActiveSceneChanged(Scene prevScene, Scene nextScene) { if (nextScene.name == "MenuCore") { if (_soloFlowCoordinator == null) { _soloFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); if (_soloFlowCoordinator == null) { return; } _soloDetailView = _soloFlowCoordinator.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController"); _practiceViewController = _soloFlowCoordinator.GetPrivateField <PracticeViewController>("_practiceViewController"); if (_soloDetailView != null) { _soloDetailView.didPressPlayButtonEvent += _soloDetailView_didPressPlayButtonEvent; } else { Log("Detail View Null", Plugin.LogLevel.Info); } if (_practiceViewController != null) { _practiceViewController.didPressPlayButtonEvent += _practiceViewController_didPressPlayButtonEvent; } else { Log("Practice View Null", Plugin.LogLevel.Info); } } if (_partyFlowCoordinator == null) { _partyFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault(); } if (saveRequested) { Settings.Save(); saveRequested = false; } } }
private void initMapVariables() { if (soloFreePlayFlowCoordinator == null) { // has a start function soloFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault(); // has a set level function levelPackLevelsViewController = Resources.FindObjectsOfTypeAll <LevelPackLevelsViewController>().FirstOrDefault(); // has an event, that is called, when a level finished loading standardLevelDetailViewController = Resources.FindObjectsOfTypeAll <StandardLevelDetailViewController>().FirstOrDefault(); standardLevelDetailViewController.didPresentContentEvent += new Action <StandardLevelDetailViewController, StandardLevelDetailViewController.ContentType> (this.HandleLevelDetailViewControllerDidPresentContent); // all the beat saber levels beatmapLevelsModelSO = Resources.FindObjectsOfTypeAll <BeatmapLevelsModelSO>().FirstOrDefault(); levelPackCollection = beatmapLevelsModelSO.allLoadedBeatmapLevelPackCollection; } }
public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene) { if (isMenuScene(scene)) { try { flowCoordinator = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().FirstOrDefault(); mainMenuViewController = flowCoordinator.GetPrivateField <MainMenuViewController>("_mainMenuViewController"); //soloModeSelectionViewController = flowCoordinator.GetPrivateField<SoloModeSelectionViewController>("_soloFreePlayFlowCoordinator"); soloFreePlayFlowCoordinator = flowCoordinator.GetPrivateField <SoloFreePlayFlowCoordinator>("_soloFreePlayFlowCoordinator"); detailViewController = soloFreePlayFlowCoordinator.GetPrivateField <StandardLevelDetailViewController>("_levelDetailViewController"); gameplaySetupViewController = soloFreePlayFlowCoordinator.GetPrivateField <GameplaySetupViewController>("_gameplaySetupViewController"); practiceController = soloFreePlayFlowCoordinator.GetPrivateField <PracticeViewController>("_practiceViewController"); beatmapDifficultyViewController = soloFreePlayFlowCoordinator.GetPrivateField <BeatmapDifficultyViewController>("_beatmapDifficultyViewControllerViewController"); listViewController = soloFreePlayFlowCoordinator.GetPrivateField <LevelListViewController>("_levelListViewController"); levelListView = listViewController.GetPrivateField <LevelListTableView>("_levelListTableView"); tableView = levelListView.GetPrivateField <TableView>("_tableView"); gameScenesManager = Resources.FindObjectsOfTypeAll <GameScenesManager>().FirstOrDefault(); standardLevelReturnToMenu = Resources.FindObjectsOfTypeAll <StandardLevelReturnToMenuController>().FirstOrDefault(); } catch (Exception e) { Console.WriteLine(e); } } if (isGameScene(scene)) { if (autoPlay) { } } Console.WriteLine(scene.name); }
protected override void DidActivate(bool firstActivation, ActivationType activationType) { if (firstActivation) { //Set up UI title = "Room Screen"; showBackButton = true; _playerDataModel = Resources.FindObjectsOfTypeAll <PlayerDataModel>().First(); _menuLightsManager = Resources.FindObjectsOfTypeAll <MenuLightsManager>().First(); _soloFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); _campaignFlowCoordinator = Resources.FindObjectsOfTypeAll <CampaignFlowCoordinator>().First(); _resultsViewController = Resources.FindObjectsOfTypeAll <ResultsViewController>().First(); _scoreLights = _soloFreePlayFlowCoordinator.GetField <MenuLightsPresetSO>("_resultsLightsPreset"); _redLights = _campaignFlowCoordinator.GetField <MenuLightsPresetSO>("_newObjectiveLightsPreset"); _defaultLights = _soloFreePlayFlowCoordinator.GetField <MenuLightsPresetSO>("_defaultLightsPreset"); _songSelection = BeatSaberUI.CreateViewController <SongSelection>(); _songSelection.SongSelected += songSelection_SongSelected; _splashScreen = BeatSaberUI.CreateViewController <SplashScreen>(); _songDetail = BeatSaberUI.CreateViewController <SongDetail>(); _songDetail.PlayPressed += songDetail_didPressPlayButtonEvent; _songDetail.DifficultyBeatmapChanged += songDetail_didChangeDifficultyBeatmapEvent; _playerList = BeatSaberUI.CreateViewController <PlayerList>(); } if (activationType == ActivationType.AddedToHierarchy) { tournamentMode = Match == null; if (tournamentMode) { _splashScreen.StatusText = $"Connecting to \"{Host.Name}\"..."; ProvideInitialViewControllers(_splashScreen); } else { //If we're not in tournament mode, then a client connection has already been made //by the room selection screen, so we can just assume Plugin.client isn't null //NOTE: This is *such* a hack. Oh my god. isHost = Match.Leader == Plugin.client.Self; _songSelection.SetSongs(SongUtils.masterLevelList); _playerList.Players = Match.Players; _splashScreen.StatusText = "Waiting for the host to select a song..."; if (isHost) { ProvideInitialViewControllers(_songSelection, _playerList); } else { ProvideInitialViewControllers(_splashScreen, _playerList); } } } //The ancestor sets up the server event listeners //It would be possible to recieve an event that does a ui update after this call //and before the rest of the ui is set up, if we did this at the top. //So, we do it last base.DidActivate(firstActivation, activationType); }
public override void Instantiate() { //We have to find our own target //TODO: Clean up time complexity issue. This is called for each new option SoloFreePlayFlowCoordinator sfpfc = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); GameplaySetupViewController gsvc = sfpfc.GetField <GameplaySetupViewController>("_gameplaySetupViewController"); RectTransform container = (RectTransform)gsvc.transform.Find(pageName).Find(panelName); gameObject = UnityEngine.Object.Instantiate(Resources.FindObjectsOfTypeAll <GameplayModifierToggle>().Where(g => g.transform.Find("BG"))?.Last().gameObject, container); gameObject.name = optionName; gameObject.layer = container.gameObject.layer; gameObject.transform.SetParent(container); gameObject.transform.localPosition = Vector3.zero; gameObject.transform.localScale = Vector3.one; gameObject.transform.rotation = Quaternion.identity; gameObject.SetActive(false); foreach (Transform t in container) { if (t.name.StartsWith("Separator")) { separator = UnityEngine.Object.Instantiate(t.gameObject, container); separator.name = "ExtraSeparator"; separator.SetActive(false); break; } } string ConflictText = "\r\n\r\n<size=60%><color=#ff0000ff><b>Conflicts </b></color>"; var currentToggle = gameObject.GetComponent <GameplayModifierToggle>(); if (currentToggle != null) { currentToggle.toggle.isOn = GetValue; currentToggle.toggle.onValueChanged.RemoveAllListeners(); currentToggle.toggle.onValueChanged.AddListener((bool e) => OnToggle?.Invoke(e)); currentToggle.name = optionName.Replace(" ", ""); GameplayModifierToggle[] gameplayModifierToggles = Resources.FindObjectsOfTypeAll <GameplayModifierToggle>(); if (conflicts.Count > 0) { hintText += ConflictText; foreach (string conflict in conflicts) { var conflictingModifier = gameplayModifierToggles.Where(t => t?.gameplayModifier?.modifierName == conflict).FirstOrDefault(); if (conflictingModifier) { if (!hintText.Contains(ConflictText)) { hintText += ConflictText; } hintText += Char.ConvertFromUtf32((char)0xE069) + conflict + Char.ConvertFromUtf32((char)0xE069); } } } GameplayModifierParamsSO _gameplayModifier = new GameplayModifierParamsSO(); _gameplayModifier.SetPrivateField("_modifierName", optionName); _gameplayModifier.SetPrivateField("_hintText", hintText); _gameplayModifier.SetPrivateField("_multiplier", multiplier); _gameplayModifier.SetPrivateField("_icon", optionIcon == null ? UIUtilities.BlankSprite : optionIcon); currentToggle.SetPrivateField("_gameplayModifier", _gameplayModifier); string currentDisplayName = Char.ConvertFromUtf32((char)0xE069) + optionName + Char.ConvertFromUtf32((char)0xE069); foreach (string conflictingModifierName in conflicts) { GameplayModifierToggle conflictToggle = gameplayModifierToggles.Where(t => t?.gameplayModifier?.modifierName == conflictingModifierName).FirstOrDefault(); if (conflictToggle) { if (!conflictToggle.gameplayModifier.hintText.Contains(ConflictText)) { conflictToggle.gameplayModifier.SetPrivateField("_hintText", conflictToggle.gameplayModifier.hintText + ConflictText); } if (!conflictToggle.gameplayModifier.hintText.Contains(currentDisplayName)) { conflictToggle.gameplayModifier.SetPrivateField("_hintText", conflictToggle.gameplayModifier.hintText + currentDisplayName); } conflictToggle.toggle.onValueChanged.AddListener((e) => { if (e) { currentToggle.toggle.isOn = false; } }); currentToggle.toggle.onValueChanged.AddListener((e) => { if (e) { conflictToggle.toggle.isOn = false; } }); } } if (hintText != String.Empty) { HoverHint hoverHint = currentToggle.GetPrivateField <HoverHint>("_hoverHint"); hoverHint.text = hintText; hoverHint.name = optionName; HoverHintController hoverHintController = Resources.FindObjectsOfTypeAll <HoverHintController>().First(); hoverHint.SetPrivateField("_hoverHintController", hoverHintController); } } initialized = true; }
public override void Instantiate() { try { //We have to find our own target //TODO: Clean up time complexity issue. This is called for each new option SoloFreePlayFlowCoordinator sfpfc = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); GameplaySetupViewController gsvc = sfpfc.GetField <GameplaySetupViewController>("_gameplaySetupViewController"); RectTransform container = (RectTransform)gsvc.transform.Find(pageName).Find(panelName); var volumeSettings = Resources.FindObjectsOfTypeAll <VolumeSettingsController>().FirstOrDefault(); gameObject = UnityEngine.Object.Instantiate(volumeSettings.gameObject, container); gameObject.name = optionName; gameObject.GetComponentInChildren <TMP_Text>().text = optionName; foreach (Transform t in container) { if (t.name.StartsWith("Separator")) { separator = UnityEngine.Object.Instantiate(t.gameObject, container); separator.name = "ExtraSeparator"; separator.SetActive(false); break; } } //Slim down the toggle option so it fits in the space we have before the divider (gameObject.transform as RectTransform).sizeDelta = new Vector2(50, (gameObject.transform as RectTransform).sizeDelta.y); //This magical nonsense is courtesy of Taz and his SettingsUI class VolumeSettingsController volume = gameObject.GetComponent <VolumeSettingsController>(); ListViewController newListSettingsController = (ListViewController)ReflectionUtil.CopyComponent(volume, typeof(ListSettingsController), typeof(ListViewController), gameObject); UnityEngine.Object.DestroyImmediate(volume); newListSettingsController.values = _options.Keys.ToList(); newListSettingsController.SetValue = OnChange; newListSettingsController.GetValue = () => { if (GetValue != null) { return(GetValue.Invoke()); } return(_options.Keys.ElementAt(0)); }; newListSettingsController.GetTextForValue = (v) => { if (_options.ContainsKey(v)) { return(_options[v] != null ? _options[v] : v.ToString()); } return("UNKNOWN"); }; //Initialize the controller, as if we had just opened the settings menu newListSettingsController.Init(); var value = newListSettingsController.gameObject.transform.Find("Value"); var valueText = value.Find("ValueText"); TMP_Text valueTextObject = valueText.GetComponent <TMP_Text>(); valueTextObject.lineSpacing = -50; valueTextObject.alignment = TextAlignmentOptions.CenterGeoAligned; var nameText = newListSettingsController.gameObject.transform.Find("NameText"); nameText.localScale = new Vector3(0.85f, 0.85f, 0.85f); value.localScale = new Vector3(0.7f, 0.7f, 0.7f); if (hintText != String.Empty) { BeatSaberUI.AddHintText(nameText as RectTransform, hintText); } var dec = value.Find("DecButton"); dec.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); var inc = value.Find("IncButton"); inc.transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); value.localPosition -= new Vector3(8, 0.3f); gameObject.SetActive(false); initialized = true; } catch (Exception e) { Console.WriteLine($"Exception when trying to instantiate list option {e.ToString()}"); } }
public void Build() { string pageName = String.Empty, panelName = String.Empty; GameOption.GetPanelNames(panel, ref pageName, ref panelName); //Grab necessary references SoloFreePlayFlowCoordinator sfpfc = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); GameplaySetupViewController gsvc = sfpfc.GetField <GameplaySetupViewController>("_gameplaySetupViewController"); //Get reference to the switch container RectTransform page = (RectTransform)gsvc.transform.Find(pageName); Destroy(page.gameObject.GetComponent <HorizontalLayoutGroup>()); Destroy(page.gameObject.GetComponent <ContentSizeFitter>()); _panelContainer = (RectTransform)page.Find(panelName); if (!_panelContainer.gameObject.GetComponent <ContentSizeFitter>()) { var fitter = _panelContainer.gameObject.AddComponent <ContentSizeFitter>(); fitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained; fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; } // Make the player height option the same height as other options var height = _panelContainer.Find("PlayerHeight"); if (height) { var staticLights = _panelContainer.Find("StaticLights"); (height as RectTransform).sizeDelta = (staticLights as RectTransform).sizeDelta; var title = height.Find("Title"); if (title) { (title as RectTransform).sizeDelta = new Vector2((title as RectTransform).sizeDelta.x, 1); title.localPosition += new Vector3(0, 0.5f); var text = title.gameObject.GetComponentInChildren <TextMeshProUGUI>(); text.alignment = TextAlignmentOptions.MidlineLeft; text.enableWordWrapping = false; } var measure = height.Find("MeassureButton"); measure.localScale *= 0.6f; measure.localPosition += new Vector3(5f, 0); var reset = height.Find("ResetButton"); reset.localScale *= 0.6f; } if (!initialized) { //Get references to the original switches, so we can later duplicate then destroy them GameOption.GetOptionTransforms(panel, _panelContainer, ref _defaultOptions[0], ref _defaultOptions[1], ref _defaultOptions[2], ref _defaultOptions[3]); foreach (Transform t in _panelContainer) { if (t.name.StartsWith("Separator")) { _defaultSeparators.Add(t); } } _defaultSeparators.Reverse(); //Create up button _pageUpButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "PageUpButton")), _panelContainer); _pageUpButton.transform.SetParent(_panelContainer.parent); _pageUpButton.transform.localScale = Vector3.one / 2; _pageUpButton.transform.localPosition = new Vector3(_pageUpButton.transform.localPosition.x, -2.2f, _pageUpButton.transform.localPosition.z); _pageUpButton.interactable = true; //(_pageUpButton.transform as RectTransform).sizeDelta = new Vector2((_pageUpButton.transform.parent as RectTransform).sizeDelta.x, 3.5f); _pageUpButton.onClick.RemoveAllListeners(); _pageUpButton.onClick.AddListener(delegate() { Instance[panel].ChangePage(--Instance[panel]._pageIndex, _panelContainer, Instance[panel]._defaultOptions[0], Instance[panel]._defaultOptions[1], Instance[panel]._defaultOptions[2], Instance[panel]._defaultOptions[3]); }); //Create down button _pageDownButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "PageDownButton")), _panelContainer); _pageDownButton.transform.SetParent(_panelContainer.parent); _pageDownButton.transform.localScale = Vector3.one / 2; _pageDownButton.transform.localPosition = new Vector3(_pageDownButton.transform.localPosition.x, -34.3f, _pageDownButton.transform.localPosition.z); _pageDownButton.interactable = true; //(_pageDownButton.transform as RectTransform).sizeDelta = new Vector2((_pageDownButton.transform.parent as RectTransform).sizeDelta.x, (_pageDownButton.transform as RectTransform).sizeDelta.y); _pageDownButton.onClick.RemoveAllListeners(); _pageDownButton.onClick.AddListener(delegate() { Instance[panel].ChangePage(++Instance[panel]._pageIndex, _panelContainer, Instance[panel]._defaultOptions[0], Instance[panel]._defaultOptions[1], Instance[panel]._defaultOptions[2], Instance[panel]._defaultOptions[3]); }); RefreshScrollButtons(); Instance[panel]._pageIndex = 0; initialized = true; } //Create custom options foreach (MenuInfo menu in Instance[panel]._customMenus.Values) { foreach (GameOption option in menu.options) { if (!option.initialized) { option.Instantiate(); } } } // Then add conflict text foreach (MenuInfo menu in Instance[panel]._customMenus.Values) { foreach (GameOption option in menu.options) { if (option is ToggleOption && option.initialized) { (option as ToggleOption).SetupConflictText(); } } } }
public void Build() { //Grab necessary references SoloFreePlayFlowCoordinator sfpfc = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); GameplaySetupViewController gsvc = sfpfc.GetField <GameplaySetupViewController>("_gameplaySetupViewController"); //Get reference to the switch container RectTransform container = (RectTransform)gsvc.transform.Find("GameplayModifiers").Find("RightColumn"); if (!initialized) { //container.sizeDelta = new Vector2(container.sizeDelta.x, container.sizeDelta.y + 7f); //Grow container so it aligns properly with text //Get references to the original switches, so we can later duplicate then destroy them Transform noFail = container.Find("NoFail"); Transform noObstacles = container.Find("NoObstacles"); Transform noBombs = container.Find("NoBombs"); Transform slowerSong = container.Find("SlowerSong"); //Get references to other UI elements we need to hide //Transform divider = (RectTransform)_govc.transform.Find("Switches").Find("Separator"); //Transform defaults = (RectTransform)_govc.transform.Find("Switches").Find("DefaultsButton"); //Create up button _pageUpButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "PageUpButton")), container); _pageUpButton.transform.parent = container.parent; _pageUpButton.transform.localScale = Vector3.one / 2; _pageUpButton.transform.localPosition -= new Vector3(0, 2f); _pageUpButton.interactable = true; //(_pageUpButton.transform as RectTransform).sizeDelta = new Vector2((_pageUpButton.transform.parent as RectTransform).sizeDelta.x, 3.5f); _pageUpButton.onClick.RemoveAllListeners(); _pageUpButton.onClick.AddListener(delegate() { Instance.ChangePage(--Instance._listIndex, container, noFail, noObstacles, noBombs, slowerSong); //Nice responsive scroll buttons if (Instance._listIndex <= 0) { _pageUpButton.gameObject.SetActive(false); } if (Instance.customOptions.Count > 0) { _pageDownButton.gameObject.SetActive(true); } }); //Create down button _pageDownButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "PageDownButton")), container); _pageDownButton.transform.parent = container.parent; _pageDownButton.transform.localScale = Vector3.one / 2; _pageDownButton.transform.localPosition -= new Vector3(0, 7f); _pageDownButton.interactable = true; //(_pageDownButton.transform as RectTransform).sizeDelta = new Vector2((_pageDownButton.transform.parent as RectTransform).sizeDelta.x, (_pageDownButton.transform as RectTransform).sizeDelta.y); _pageDownButton.onClick.RemoveAllListeners(); _pageDownButton.onClick.AddListener(delegate() { Instance.ChangePage(++Instance._listIndex, container, noFail, noObstacles, noBombs, slowerSong); //Nice responsive scroll buttons if (Instance._listIndex >= 0) { _pageUpButton.gameObject.SetActive(true); } if (((Instance.customOptions.Count + 4 - 1) / 4) - Instance._listIndex <= 0) { _pageDownButton.gameObject.SetActive(false); } }); _pageUpButton.gameObject.SetActive(false); _pageDownButton.gameObject.SetActive(Instance.customOptions.Count > 0); //Unfortunately, due to weird object creation for versioning, this doesn't always //happen when the scene changes Instance._listIndex = 0; initialized = true; } //Create custom options foreach (GameOption option in Instance.customOptions) { option.Instantiate(); } }
protected override void DidActivate(bool firstActivation, ActivationType activationType) { if (activationType == ActivationType.AddedToHierarchy) { title = Plugin.Name; navigationController = BeatSaberUI.CreateViewController <GenericNavigationController>(); navigationController.didFinishEvent += (_) => mainFlowCoordinator.InvokeMethod("DismissFlowCoordinator", this, null, false); if (soloFreePlayFlowCoordinator == null) { soloFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().First(); } if (_additionalContentModel == null) { _additionalContentModel = Resources.FindObjectsOfTypeAll <AdditionalContentModelSO>().First(); } if (_primaryLevelCollection == null) { _primaryLevelCollection = _additionalContentModel.alwaysOwnedPacks.First(x => x.packID == "OstVol1").beatmapLevelCollection as BeatmapLevelCollectionSO; } if (_secondaryLevelCollection == null) { _secondaryLevelCollection = _additionalContentModel.alwaysOwnedPacks.First(x => x.packID == "OstVol2").beatmapLevelCollection as BeatmapLevelCollectionSO; } if (_extrasLevelCollection == null) { _extrasLevelCollection = _additionalContentModel.alwaysOwnedPacks.First(x => x.packID == "Extras").beatmapLevelCollection as BeatmapLevelCollectionSO; } if (beatmapLevelPackCollection == null) { beatmapLevelPackCollection = soloFreePlayFlowCoordinator.GetField <IBeatmapLevelPackCollection>("_levelPackCollection"); } if (centerViewController == null) { centerViewController = BeatSaberUI.CreateViewController <CenterViewController>(); centerViewController.GenerateButtonPressed += () => { centerViewController.SetUIType(CenterViewController.UIType.ProgressBar); GeneratePlaylistWithMinTime(centerViewController.GetTimeValue(), centerViewController.UseOnlyPreferredDifficulty ? centerViewController.PreferredDifficulty : (BeatmapDifficulty?)null, (playlist) => { var duration = 0f; foreach (var song in playlist) { duration += song.songDuration; Logger.Debug($"PLAYLIST ITEM: {song.songName} ({song.songDuration})"); } Logger.Debug($"TOTAL DURATION: {duration}"); centerViewController.SetUIType(CenterViewController.UIType.GenerationButton); //Launch first level Config.Enabled = true; Plugin.instance.loadedLevels = new Queue <IBeatmapLevel>(playlist); var firstMap = SongHelpers.GetClosestDifficultyPreferLower(Plugin.instance.loadedLevels.First(), centerViewController.PreferredDifficulty); SongStitcher.songSwitched -= SongSwitched; SongStitcher.songSwitched += SongSwitched; var playerDataModel = Resources.FindObjectsOfTypeAll <PlayerDataModelSO>().First(); MenuTransitionsHelperSO menuTransitionHelper = Resources.FindObjectsOfTypeAll <MenuTransitionsHelperSO>().FirstOrDefault(); menuTransitionHelper.StartStandardLevel(firstMap, playerDataModel.currentLocalPlayer.gameplayModifiers, playerDataModel.currentLocalPlayer.playerSpecificSettings, null, "Menu", false, null, SongFinished); }); }; } ProvideInitialViewControllers(navigationController); SetViewControllersToNavigationConctroller(navigationController, new VRUIViewController[] { centerViewController }); } }
public static async void PlaySong(IPreviewBeatmapLevel level, BeatmapCharacteristicSO characteristic, BeatmapDifficulty difficulty, PlaySong packet) { flow = (SoloFreePlayFlowCoordinator)Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First().GetField("_soloFreePlayFlowCoordinator"); Action <IBeatmapLevel> SongLoaded = (loadedLevel) => { Logger.Debug("G"); MenuTransitionsHelper _menuSceneSetupData = Resources.FindObjectsOfTypeAll <MenuTransitionsHelper>().First(); IDifficultyBeatmap diffbeatmap = loadedLevel.beatmapLevelData.GetDifficultyBeatmap(characteristic, difficulty); Logger.Debug("L"); GameplaySetupViewController gameplaySetupViewController = (GameplaySetupViewController)typeof(SinglePlayerLevelSelectionFlowCoordinator).GetField("_gameplaySetupViewController", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(flow); Logger.Debug("D"); OverrideEnvironmentSettings environmentSettings = gameplaySetupViewController.environmentOverrideSettings; ColorScheme scheme = gameplaySetupViewController.colorSchemesSettings.GetSelectedColorScheme(); //GameplayModifiers modifiers = gameplaySetupViewController.gameplayModifiers; PlayerSpecificSettings settings = gameplaySetupViewController.playerSettings; //TODO: re add modifier customizability PracticeSettings practiceSettings = ConvertPractice(packet.practiceSettings); GameplayModifiers modifiers = ConvertModifiers(packet.gameplayModifiers, gameplaySetupViewController.gameplayModifiers); Logger.Debug(diffbeatmap.level.levelID + " " + scheme.colorSchemeId); _menuSceneSetupData.StartStandardLevel( "Solo", diffbeatmap, diffbeatmap.level, environmentSettings, scheme, modifiers, settings, practiceSettings, "Menu", false, null, new Action <StandardLevelScenesTransitionSetupDataSO, LevelCompletionResults>((StandardLevelScenesTransitionSetupDataSO q, LevelCompletionResults r) => { }) ); }; if (flow == null || flow.gameObject == null || !flow.gameObject.activeInHierarchy) { Button button = Resources.FindObjectsOfTypeAll <Button>().Where(x => x != null && x.name == "SoloButton").First(); button.onClick.Invoke(); } if ((level is PreviewBeatmapLevelSO && await HasDLCLevel(level.levelID)) || level is CustomPreviewBeatmapLevel) { Logger.Debug("Loading DLC/Custom level..."); var result = await GetLevelFromPreview(level); if (!(result?.isError == true)) { SongLoaded(result?.beatmapLevel); return; } Logger.Debug("You Suck Idiot"); } else if (level is BeatmapLevelSO) { Logger.Debug("Reading OST data without songloader..."); SongLoaded(level as IBeatmapLevel); } else { Logger.Debug($"Skipping unowned DLC ({level.songName})"); } }