public void HandleMissionSelectionMapViewControllerDidSelectMissionLevel(MissionSelectionMapViewController viewController, MissionNode missionNode)
        {
            Challenge challenge = (missionNode.missionData as CustomMissionDataSO).challenge;

            _campaignChallengeLeaderbaordViewController.lastClicked = challenge;
            _campaignFlowCoordinator.InvokePrivateMethod("SetRightScreenViewController", new object[] { _campaignChallengeLeaderbaordViewController, ViewController.AnimationType.In });
            _campaignChallengeLeaderbaordViewController.UpdateLeaderboards();
            _challengeName.text      = challenge.name;
            _challengeName.alignment = TextAlignmentOptions.Bottom;
            List <GameplayModifierParamsSO> modParams = _gameplayModifiersModel.GetModifierParams(missionNode.missionData.gameplayModifiers);

            foreach (string modName in challenge.externalModifiers.Keys)
            {
                if (!ChallengeExternalModifiers.getInfo.ContainsKey(modName))
                {
                    continue;
                }
                foreach (ExternalModifierInfo modInfo in ChallengeExternalModifiers.getInfo[modName](challenge.externalModifiers[modName]))
                {
                    modParams.Add(APITools.CreateModifierParam(modInfo.icon, modInfo.name, modInfo.desc));
                }
            }
            foreach (UnlockableItem item in challenge.unlockableItems)
            {
                modParams.Add(item.GetModifierParam());
            }
            if (challenge.unlockMap)
            {
                modParams.Add(APITools.CreateModifierParam(Assets.UnlockableSongIcon, "Unlockable Song", "Unlock this song on completion"));
            }
            LoadModifiersPanel(modParams);
        }
        //Base game does a ton of stuff when everything gets enabled so this just makes sure that happens, without this some stuff will break
        IEnumerator InitializeMap()
        {
            MissionSelectionMapViewController map = Resources.FindObjectsOfTypeAll <MissionSelectionMapViewController>().First();
            bool mapState    = map.gameObject.activeSelf;
            bool parentState = map.transform.parent.gameObject.activeSelf;

            map.gameObject.SetActive(true);
            map.transform.parent.gameObject.SetActive(true);
            yield return(new WaitForFixedUpdate());

            map.gameObject.SetActive(mapState);
            map.transform.parent.gameObject.SetActive(parentState);
        }
 static bool Prefix(MissionNodeVisualController missionNodeVisualController, MissionSelectionMapViewController __instance, SongPreviewPlayer ____songPreviewPlayer)
 {
     if (missionNodeVisualController.missionNode.missionData is CustomMissionDataSO)
     {
         __instance.SetPrivateField("_selectedMissionNode", missionNodeVisualController.missionNode);
         CustomPreviewBeatmapLevel level = (missionNodeVisualController.missionNode.missionData as CustomMissionDataSO).customLevel;
         if (level != null)
         {
             ____songPreviewPlayer.CrossfadeTo(level.GetPreviewAudioClipAsync(CancellationToken.None).Result, level.previewStartTime, level.previewDuration);
         }
         __instance.GetPrivateField <Action <MissionSelectionMapViewController, MissionNode> >("didSelectMissionLevelEvent")(__instance, missionNodeVisualController.missionNode);
         return(false);
     }
     return(true);
 }
        protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling)
        {
            if (firstActivation)
            {
                SetTitle("Custom Campaigns");
                showBackButton = true;

                _campaignFlowCoordinator           = Resources.FindObjectsOfTypeAll <CampaignFlowCoordinator>().First();
                _missionMapAnimationController     = Resources.FindObjectsOfTypeAll <MissionMapAnimationController>().First();
                _missionNodesManager               = Resources.FindObjectsOfTypeAll <MissionNodesManager>().First();
                _missionStagesManager              = Resources.FindObjectsOfTypeAll <MissionStagesManager>().First();
                _missionConnectionsGenerator       = Resources.FindObjectsOfTypeAll <MissionConnectionsGenerator>().First();
                _missionSelectionMapViewController = Resources.FindObjectsOfTypeAll <MissionSelectionMapViewController>().First();
                _missionNodeSelectionManager       = Resources.FindObjectsOfTypeAll <MissionNodeSelectionManager>().First();
                _missionLevelDetailViewController  = Resources.FindObjectsOfTypeAll <MissionLevelDetailViewController>().First();
                _missionResultsViewController      = Resources.FindObjectsOfTypeAll <MissionResultsViewController>().First();

                _playButton    = _missionLevelDetailViewController.GetPrivateField <Button>("_playButton");
                _mapScrollView = _missionSelectionMapViewController.GetPrivateField <ScrollView>("_mapScrollView");
                _mapScrollViewItemsVisibilityController = _mapScrollView.GetComponent <ScrollViewItemsVisibilityController>();
                _backgroundImage = _mapScrollView.GetComponentsInChildren <Image>().First(x => x.name == "Map");
                _missionSelectionNavigationController = _campaignFlowCoordinator.GetPrivateField <MissionSelectionNavigationController>("_missionSelectionNavigationController");
                _gameplayModifierInfoListItemsList    = _missionLevelDetailViewController.GetPrivateField <GameplayModifierInfoListItemsList>("_gameplayModifierInfoListItemsList");
                _modifiersPanelGO       = _missionLevelDetailViewController.GetPrivateField <GameObject>("_modifiersPanelGO");
                _gameplayModifiersModel = _missionLevelDetailViewController.GetPrivateField <GameplayModifiersModelSO>("_gameplayModifiersModel");

                BSMLParser.instance.Parse(Utilities.GetResourceContent(Assembly.GetExecutingAssembly(), "BeatSaberCustomCampaigns.Views.challenge-detail.bsml"), _missionLevelDetailViewController.gameObject, this);

                _campaignProgressModel = _campaignFlowCoordinator.GetPrivateField <CampaignProgressModel>("_campaignProgressModel");

                _campaignListViewController                  = BeatSaberUI.CreateViewController <CampaignListViewController>();
                _campaignDetailViewController                = BeatSaberUI.CreateViewController <CampaignDetailViewController>();
                _campaignTotalLeaderboardViewController      = BeatSaberUI.CreateViewController <CampaignTotalLeaderboardViewController>();
                _campaignListNavigationController            = BeatSaberUI.CreateViewController <NavigationController>();
                _campaignListViewController.clickedCampaign += ShowDetails;
                _campaignDetailViewController.clickedPlay   += OpenCampaign;

                _campaignChallengeLeaderbaordViewController = BeatSaberUI.CreateViewController <CampaignChallengeLeaderboardViewController>();
                _unlockedItemsViewController = BeatSaberUI.CreateViewController <UnlockedItemsViewController>();
            }
            if (addedToHierarchy)
            {
                SetBaseCampaignEnabled(false);

                SetViewControllerToNavigationController(_campaignListNavigationController, _campaignListViewController);
                ProvideInitialViewControllers(_campaignListNavigationController);
            }
        }