public void SongFinished(StandardLevelScenesTransitionSetupDataSO standardLevelScenesTransitionSetupData, LevelCompletionResults results)
        {
            standardLevelScenesTransitionSetupData.didFinishEvent -= SongFinished;

            var map          = (standardLevelScenesTransitionSetupData.sceneSetupDataArray.First(x => x is GameplayCoreSceneSetupData) as GameplayCoreSceneSetupData).difficultyBeatmap;
            var localPlayer  = _playerDataModel.playerData;
            var localResults = localPlayer.GetPlayerLevelStatsData(map.level.levelID, map.difficulty, map.parentDifficultyBeatmapSet.beatmapCharacteristic);
            var highScore    = localResults.highScore < results.modifiedScore;

            //Disable HMD Only if it was enabled (or even if not. Doesn't matter to me)
            var customNotes = IPA.Loader.PluginManager.GetPluginFromId("CustomNotes");

            if (customNotes != null)
            {
                DisableHMDOnly();
            }

            //Send final score to Host
            if (Plugin.client.Connected)
            {
                Logger.Debug($"SENDING RESULTS: {results.modifiedScore}");

                var songFinished = new SongFinished();
                if (results.levelEndStateType == LevelCompletionResults.LevelEndStateType.Cleared)
                {
                    songFinished.Type = TournamentAssistantShared.Models.Packets.SongFinished.CompletionType.Passed;
                }
                if (results.levelEndStateType == LevelCompletionResults.LevelEndStateType.Failed)
                {
                    songFinished.Type = TournamentAssistantShared.Models.Packets.SongFinished.CompletionType.Failed;
                }
                if (results.levelEndAction == LevelCompletionResults.LevelEndAction.Quit)
                {
                    songFinished.Type = TournamentAssistantShared.Models.Packets.SongFinished.CompletionType.Quit;
                }

                songFinished.User = Plugin.client.Self as Player;

                songFinished.Beatmap                = new Beatmap();
                songFinished.Beatmap.LevelId        = map.level.levelID;
                songFinished.Beatmap.Difficulty     = (SharedConstructs.BeatmapDifficulty)map.difficulty;
                songFinished.Beatmap.Characteristic = new Characteristic();
                songFinished.Beatmap.Characteristic.SerializedName = map.parentDifficultyBeatmapSet.beatmapCharacteristic.serializedName;
                songFinished.Beatmap.Characteristic.Difficulties   = map.parentDifficultyBeatmapSet.difficultyBeatmaps.Select(x => (SharedConstructs.BeatmapDifficulty)x.difficulty).ToArray();

                songFinished.Score = results.modifiedScore;

                Plugin.client.Send(new Packet(songFinished));
            }

            if (results.levelEndStateType != LevelCompletionResults.LevelEndStateType.None)
            {
                _menuLightsManager.SetColorPreset(_scoreLights, true);
                _resultsViewController.Init(results, map, false, highScore);
                _resultsViewController.GetField <Button>("_restartButton").gameObject.SetActive(false);
                _resultsViewController.continueButtonPressedEvent += resultsViewController_continueButtonPressedEvent;
                PresentViewController(_resultsViewController, immediately: true);
            }
            else if (ShouldDismissOnReturnToMenu)
            {
                Dismiss();
            }
            else if (!Plugin.client.State.Matches.Contains(Match))
            {
                if (TournamentMode)
                {
                    SwitchToWaitingForCoordinatorMode();
                }
                else
                {
                    Dismiss();
                }
            }
        }
예제 #2
0
 private void PluginOnLevelDidFinishEvent(StandardLevelScenesTransitionSetupDataSO levelscenestransitionsetupdataso, LevelCompletionResults levelcompletionresults)
 {
 }
예제 #3
0
        private void BSEvents_levelLeft(StandardLevelScenesTransitionSetupDataSO arg1, LevelCompletionResults arg2)
        {
            SongService.LastSong = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap.level;

            _activityService.SubmitActivity(arg2);
        }
예제 #4
0
 private void BSEvents_levelCleared(StandardLevelScenesTransitionSetupDataSO arg1, LevelCompletionResults results)
 {
     PlayerUtils.GetPlatformUserData((username, userId) => CreateAndBackupScore(username, userId, arg1, results));
 }
예제 #5
0
 private void OnLevelDidFinishEvent(StandardLevelScenesTransitionSetupDataSO _, LevelCompletionResults levelCompletionResults)
 {
     LevelFinished?.Invoke(levelCompletionResults);
 }
예제 #6
0
 internal static void TriggerLevelFinishEvent(StandardLevelScenesTransitionSetupDataSO levelScenesTransitionSetupDataSO, LevelCompletionResults levelCompletionResults)
 {
     Logger.log.Debug("Solo/Party mode level finished.");
     LevelFinished?.RaiseEventSafe(levelScenesTransitionSetupDataSO, new SoloLevelFinishedEventArgs(levelScenesTransitionSetupDataSO, levelCompletionResults), nameof(LevelFinished));
     LevelDidFinishEvent?.Invoke(levelScenesTransitionSetupDataSO, levelCompletionResults);
 }