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); } }
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); }