static bool Prefix(MissionLevelDetailViewController __instance, MissionNode ____missionNode, TextMeshProUGUI ____missionText, TextMeshProUGUI ____songNameText, TextMeshProUGUI ____difficultyText, TextMeshProUGUI ____characteristicsText, ObjectiveListItemsList ____objectiveListItems, GameplayModifiersModelSO ____gameplayModifiersModel, GameObject ____modifiersPanelGO, GameplayModifierInfoListItemsList ____gameplayModifierInfoListItemsList) { if (____missionNode.missionData is CustomMissionDataSO) { CustomMissionDataSO missionData = (____missionNode.missionData as CustomMissionDataSO); CustomPreviewBeatmapLevel level = missionData.customLevel; ____missionText.text = Localization.Get("CAMPAIGN_MISSION") + " " + ____missionNode.formattedMissionNodeName; if (level == null) { ____songNameText.text = string.Format(Localization.Get("CAMPAIGN_SONG"), "SONG NOT FOUND"); ____difficultyText.text = string.Format(Localization.Get("CAMPAIGN_DIFFICULTY"), "NOT FOUND"); ____characteristicsText.text = string.Format(Localization.Get("CAMPAIGN_TYPE"), "NOT FOUND"); } else { ____songNameText.text = string.Format(Localization.Get("CAMPAIGN_SONG"), level.songName); ____difficultyText.text = string.Format(Localization.Get("CAMPAIGN_DIFFICULTY"), BeatmapDifficultyMethods.Name(missionData.beatmapDifficulty)); ____characteristicsText.text = string.Format(Localization.Get("CAMPAIGN_TYPE"), Localization.Get(missionData.beatmapCharacteristic.characteristicNameLocalizationKey)); } MissionObjective[] missionObjectives = missionData.missionObjectives; ____objectiveListItems.SetData((missionObjectives.Length == 0) ? 1 : missionObjectives.Length, delegate(int idx, ObjectiveListItem objectiveListItem) { if (idx == 0 && missionObjectives.Length == 0) { objectiveListItem.title = Localization.Get("CAMPAIGN_FINISH_LEVEL"); objectiveListItem.conditionText = ""; objectiveListItem.hideCondition = true; } else { MissionObjective missionObjective = missionObjectives[idx]; if (missionObjective.type.noConditionValue) { objectiveListItem.title = missionObjective.type.objectiveNameLocalized.Replace(" ", "\n"); objectiveListItem.hideCondition = true; } else { objectiveListItem.title = missionObjective.type.objectiveNameLocalized; objectiveListItem.hideCondition = false; ObjectiveValueFormatterSO objectiveValueFormater = missionObjective.type.objectiveValueFormater; objectiveListItem.conditionText = $"{MissionDataExtensions.Name(missionObjective.referenceValueComparisonType)} {objectiveValueFormater.FormatValue(missionObjective.referenceValue)}"; } } }); List <GameplayModifierParamsSO> modifierParamsList = ____gameplayModifiersModel.GetModifierParams(missionData.gameplayModifiers); ____modifiersPanelGO.SetActive(modifierParamsList.Count > 0); ____gameplayModifierInfoListItemsList.SetData(modifierParamsList.Count, delegate(int idx, GameplayModifierInfoListItem gameplayModifierInfoListItem) { GameplayModifierParamsSO gameplayModifierParamsSO = modifierParamsList[idx]; gameplayModifierInfoListItem.modifierIcon = gameplayModifierParamsSO.icon; gameplayModifierInfoListItem.modifierName = Localization.Get(gameplayModifierParamsSO.modifierNameLocalizationKey); gameplayModifierInfoListItem.modifierDescription = Localization.Get(gameplayModifierParamsSO.descriptionLocalizationKey); gameplayModifierInfoListItem.showSeparator = (idx != modifierParamsList.Count - 1); }); return(false); } return(true); }
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); }
static bool Prefix(MissionLevelDetailViewController __instance, MissionNode ____missionNode, LevelBar ____levelBar, ObjectiveListItemsList ____objectiveListItems, GameplayModifiersModelSO ____gameplayModifiersModel, GameObject ____modifiersPanelGO, GameplayModifierInfoListItemsList ____gameplayModifierInfoListItemsList) { if (____missionNode.missionData is CustomMissionDataSO) { CustomMissionDataSO missionData = (____missionNode.missionData as CustomMissionDataSO); CustomPreviewBeatmapLevel level = missionData.customLevel; if (level == null) { // TODO: Localization? ____levelBar.GetPrivateField <TextMeshProUGUI>("_songNameText").text = "SONG NOT FOUND"; ____levelBar.GetPrivateField <TextMeshProUGUI>("_difficultyText").text = "SONG NOT FOUND"; ____levelBar.GetPrivateField <TextMeshProUGUI>("_authorNameText").text = "SONG NOT FOUND"; } else { ____levelBar.Setup(level, missionData.beatmapCharacteristic, missionData.beatmapDifficulty); } MissionObjective[] missionObjectives = missionData.missionObjectives; ____objectiveListItems.SetData((missionObjectives.Length == 0) ? 1 : missionObjectives.Length, delegate(int idx, ObjectiveListItem objectiveListItem) { if (idx == 0 && missionObjectives.Length == 0) { objectiveListItem.title = Localization.Get("CAMPAIGN_FINISH_LEVEL"); objectiveListItem.conditionText = ""; objectiveListItem.hideCondition = true; } else { MissionObjective missionObjective = missionObjectives[idx]; if (missionObjective.type.noConditionValue) { objectiveListItem.title = missionObjective.type.objectiveNameLocalized.Replace(" ", "\n"); objectiveListItem.hideCondition = true; } else { objectiveListItem.title = missionObjective.type.objectiveNameLocalized; objectiveListItem.hideCondition = false; ObjectiveValueFormatterSO objectiveValueFormater = missionObjective.type.objectiveValueFormater; objectiveListItem.conditionText = $"{MissionDataExtensions.Name(missionObjective.referenceValueComparisonType)} {objectiveValueFormater.FormatValue(missionObjective.referenceValue)}"; } } }); List <GameplayModifierParamsSO> modifierParamsList = ____gameplayModifiersModel.GetModifierParams(missionData.gameplayModifiers); ____modifiersPanelGO.SetActive(modifierParamsList.Count > 0); ____gameplayModifierInfoListItemsList.SetData(modifierParamsList.Count, delegate(int idx, GameplayModifierInfoListItem gameplayModifierInfoListItem) { GameplayModifierParamsSO gameplayModifierParamsSO = modifierParamsList[idx]; gameplayModifierInfoListItem.modifierIcon = gameplayModifierParamsSO.icon; gameplayModifierInfoListItem.hoverHintText = Localization.Get(gameplayModifierParamsSO.modifierNameLocalizationKey) + " - " + Localization.Get(gameplayModifierParamsSO.descriptionLocalizationKey); }); return(false); } return(true); }
static bool Prefix(Action beforeSceneSwitchCallback, CampaignFlowCoordinator __instance, MissionSelectionNavigationController ____missionSelectionNavigationController, MenuTransitionsHelper ____menuTransitionsHelper, PlayerDataModel ____playerDataModel) { if (____missionSelectionNavigationController.selectedMissionNode.missionData is CustomMissionDataSO) { CustomMissionDataSO missionData = ____missionSelectionNavigationController.selectedMissionNode.missionData as CustomMissionDataSO; IDifficultyBeatmap difficultyBeatmap = BeatmapLevelDataExtensions.GetDifficultyBeatmap(Loader.BeatmapLevelsModelSO.GetBeatmapLevelIfLoaded(missionData.customLevel.levelID).beatmapLevelData, missionData.beatmapCharacteristic, missionData.beatmapDifficulty); GameplayModifiers gameplayModifiers = missionData.gameplayModifiers; MissionObjective[] missionObjectives = missionData.missionObjectives; PlayerSpecificSettings playerSpecificSettings = ____playerDataModel.playerData.playerSpecificSettings; ColorSchemesSettings colorSchemesSettings = ____playerDataModel.playerData.colorSchemesSettings; ColorScheme overrideColorScheme = colorSchemesSettings.overrideDefaultColors ? colorSchemesSettings.GetSelectedColorScheme() : null; ____menuTransitionsHelper.StartMissionLevel("", difficultyBeatmap, overrideColorScheme, gameplayModifiers, missionObjectives, playerSpecificSettings, beforeSceneSwitchCallback, __instance.HandleMissionLevelSceneDidFinish); return(false); } return(true); }