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); }
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(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); }
public void SetGameplayModifiers(GameplayModifiers modifiers) { if (_modifiersPanel != null) { _modifiersPanel.Init(modifiers); GameplayModifiersModelSO modifiersModel = Resources.FindObjectsOfTypeAll <GameplayModifiersModelSO>().First(); var modifiersParams = modifiersModel.GetModifierParams(modifiers); foreach (GameplayModifierToggle gameplayModifierToggle in _modifiersPanel.GetPrivateField <GameplayModifierToggle[]>("_gameplayModifierToggles")) { gameplayModifierToggle.toggle.isOn = modifiersParams.Contains(gameplayModifierToggle.gameplayModifier); } } }