private void ResultsViewController_DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) { if (_data.disabled) { _campaignFlowCoordinator.InvokeMethod <object, FlowCoordinator>("SetBottomScreenViewController", _siraSubmissionView, ViewController.AnimationType.In); _siraSubmissionView.Enabled(true); _siraSubmissionView.SetText($"<size=115%><color=#f00e0e>{LOCAL_KEY.LocalizationGetOr("Score Submission Disabled By")}</color></size>\n{_data.Read()}"); } }
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); }