예제 #1
0
        public void Update()
        {
            if (_hasFailed && (Configuration.Instance.autoSkip || _vrControllersInputManager.MenuButtonDown()) && !_skipped)
            {
                // Stop the base coroutine and call the necessary functions to fail the level as quickly as possible
                if (_standardLevel)
                {
                    _standardLevelFailedController.StopAllCoroutines();
                    LevelCompletionResults.LevelEndAction levelEndAction = _standardInitData.autoRestart ? LevelCompletionResults.LevelEndAction.Restart : LevelCompletionResults.LevelEndAction.None;
                    LevelCompletionResults levelCompletionResults        = _prepareLevelCompletionResults.FillLevelCompletionResults(LevelCompletionResults.LevelEndStateType.Failed, levelEndAction);
                    _standardLevelSceneSetupData.Finish(levelCompletionResults);
                }
                else
                {
                    _missionLevelFailedController.StopAllCoroutines();
                    LevelCompletionResults.LevelEndAction levelEndAction = _missionInitData.autoRestart ? LevelCompletionResults.LevelEndAction.Restart : LevelCompletionResults.LevelEndAction.None;
                    LevelCompletionResults levelCompletionResults        = _prepareLevelCompletionResults.FillLevelCompletionResults(LevelCompletionResults.LevelEndStateType.Failed, levelEndAction);

                    MissionObjectiveResult[] results = _missionObjectiveCheckersManager.GetResults();
                    MissionCompletionResults missionCompletionReuslts = new MissionCompletionResults(levelCompletionResults, results);

                    _missionLevelSceneSetupData.Finish(missionCompletionReuslts);
                }

                _skipped = true;
            }
        }
예제 #2
0
 static bool Prefix(MissionCompletionResults missionCompletionResults, MissionNode missionNode, AchievementsEvaluationHandler __instance)
 {
     if (missionNode.missionData is CustomMissionDataSO)
     {
         __instance.ProcessMissionFinishData(missionNode, missionCompletionResults);
         IDifficultyBeatmap difficultyBeatmap = BeatmapLevelDataExtensions.GetDifficultyBeatmap(Loader.BeatmapLevelsModelSO.GetBeatmapLevelIfLoaded((missionNode.missionData as CustomMissionDataSO).customLevel.levelID).beatmapLevelData, missionNode.missionData.beatmapCharacteristic, missionNode.missionData.beatmapDifficulty);
         __instance.ProcessLevelFinishData(difficultyBeatmap, missionCompletionResults.levelCompletionResults);
         return(false);
     }
     return(true);
 }
예제 #3
0
 internal static void TriggerMissionFinishEvent(MissionLevelScenesTransitionSetupDataSO missionLevelScenesTransitionSetupDataSO, MissionCompletionResults missionCompletionResults)
 {
     MissionDidFinishEvent?.Invoke(missionLevelScenesTransitionSetupDataSO, missionCompletionResults);
 }
 public static void Postfix(MissionLevelScenesTransitionSetupDataSO missionLevelScenesTransitionSetupData, MissionCompletionResults missionCompletionResults)
 {
     SiraEvents.SendMissionEvent(missionLevelScenesTransitionSetupData, missionCompletionResults);
 }
예제 #5
0
 private void UploadCampaignData(MissionLevelScenesTransitionSetupDataSO data, MissionCompletionResults results) => UploadData(null, results.levelCompletionResults, true);
예제 #6
0
 internal static void TriggerMissionFinishEvent(MissionLevelScenesTransitionSetupDataSO missionLevelScenesTransitionSetupDataSO, MissionCompletionResults missionCompletionResults)
 {
     Logger.log.Debug("Campaign level finished.");
     LevelFinished?.RaiseEventSafe(missionLevelScenesTransitionSetupDataSO,
                                   new CampaignLevelFinishedEventArgs(missionLevelScenesTransitionSetupDataSO, missionCompletionResults),
                                   nameof(LevelFinished));
 }
 public CampaignLevelFinishedEventArgs(MissionLevelScenesTransitionSetupDataSO levelScenesTransitionSetupDataSO, MissionCompletionResults missionCompletionResults)
     : base(LevelType.Campaign, levelScenesTransitionSetupDataSO, missionCompletionResults?.levelCompletionResults)
 {
     MissionCompletionResults = missionCompletionResults;
 }
예제 #8
0
 private static void __instance_didFinishEvent(MissionLevelScenesTransitionSetupDataSO missionLevelScenesTransitionSetupDataSO, MissionCompletionResults missionCompletionResults)
 {
     Plugin.TriggerMissionFinishEvent(missionLevelScenesTransitionSetupDataSO, missionCompletionResults);
 }
예제 #9
0
 private void SiraEvents_MissionFinish(MissionLevelScenesTransitionSetupDataSO setupData, MissionCompletionResults results)
 {
     MissionLevelDidFinish?.Invoke(setupData, results);
     MissionLevelFinished?.Invoke(results);
 }
예제 #10
0
 internal static void SendMissionEvent(MissionLevelScenesTransitionSetupDataSO data, MissionCompletionResults results)
 {
     MissionFinish?.Invoke(data, results);
 }
        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);
                Resources.FindObjectsOfTypeAll <CustomCampaignFlowCoordinator>().First().LoadExternalModifiers((____missionSelectionNavigationController.selectedMissionNode.missionData as CustomMissionDataSO).challenge);
                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();
                 *
                 *  PlayerDataModel dataModel = freePlayCoordinator.GetPrivateField<PlayerDataModel>("_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);
                 * }
                 */
                if (!string.IsNullOrWhiteSpace(campaign.completionPost))
                {
                    CompleteSubmission submission = new CompleteSubmission();
                    submission.challengeHash = challenge.GetHash();
                    submission.score         = missionCompletionResults.levelCompletionResults.rawScore;
                    submission.userID        = APITools.UserID;
                    foreach (MissionObjectiveResult objective in missionCompletionResults.missionObjectiveResults)
                    {
                        Requirement requirement = new Requirement();
                        requirement.name  = objective.missionObjective.type.objectiveName;
                        requirement.value = objective.value;
                        submission.requirements.Add(requirement);
                    }
                    __instance.StartCoroutine(submission.Submit(campaign.completionPost));
                }
                __instance.StartCoroutine(CustomCampaignLeaderboard.SubmitScore(challenge, missionCompletionResults));
            }
            return(true);
        }