public void Resume()
        {
            var pauseMenuManager = pauseController.GetField <PauseMenuManager>("_pauseMenuManager");

            pauseMenuManager.GetField <Button>("_restartButton").gameObject.SetActive(true);
            pauseMenuManager.GetField <Button>("_continueButton").gameObject.SetActive(true);
            pauseMenuManager.GetField <Button>("_backButton").gameObject.SetActive(true);

            var levelBar = pauseMenuManager.GetField <LevelBar>("_levelBar");

            levelBar.hide = false;
            levelBar.GetField <TextMeshProUGUI>("_difficultyText").gameObject.SetActive(true);
            levelBar.GetField <TextMeshProUGUI>("_songNameText").text   = oldLevelText;
            levelBar.GetField <TextMeshProUGUI>("_authorNameText").text = oldAuthorText;

            //Allow players to unpause in the future
            pauseMenuManager.didPressContinueButtonEvent += pauseController.HandlePauseMenuManagerDidPressContinueButton;

            //Resume the game
            pauseMenuManager.ContinueButtonPressed();

            //If we've disabled pause, we need to disable it again since we reenabled it earlier
            if (Plugin.DisablePause)
            {
                pauseController.canPauseEvent -= standardLevelGameplayManager.HandlePauseControllerCanPause;
                pauseController.canPauseEvent += AntiPause.HandlePauseControllerCanPause_AlwaysFalse;
            }
        }
예제 #2
0
        private async void ReloadBeatmap()
        {
            string filePath  = Path.Combine(_currentLevel.customLevelPath, _currentDiffBeatmap.beatmapFilename);
            string leveljson = File.ReadAllText(filePath);
            //Load new beatmapdata asynchronously
            BeatmapData newBeatmap = await _levelLoader.LoadBeatmapDataAsync(_currentLevel.customLevelPath, _currentDiffBeatmap.beatmapFilename, _currentLevel.standardLevelInfoSaveData, _cancelSource.Token);

            GameplayCoreSceneSetupData     gameSetup = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData;
            EnvironmentEffectsFilterPreset environmentEffectsFilterPreset = ((BeatmapDifficulty)(Enum.Parse(typeof(BeatmapDifficulty), _currentDiffBeatmap.difficulty)) == BeatmapDifficulty.ExpertPlus) ? gameSetup.playerSpecificSettings.environmentEffectsFilterExpertPlusPreset : gameSetup.playerSpecificSettings.environmentEffectsFilterDefaultPreset;

            newBeatmap = (BeatmapData)BeatmapDataTransformHelper.CreateTransformedBeatmapData(newBeatmap, _currentLevel, gameSetup.gameplayModifiers, gameSetup.practiceSettings, gameSetup.playerSpecificSettings.leftHanded, environmentEffectsFilterPreset, gameSetup.environmentInfo.environmentIntensityReductionOptions);
            //Hotswap Beatmap

            ResetTimeSync();
            DestroyObjects();
            ResetNoteCutSoundEffects();
            _callbackController.SetField("_spawningStartTime", _songStartTime);
            _callbackController.SetNewBeatmapData(newBeatmap);
            //Unpause
            if (_pauseController.GetField <bool>("_paused"))
            {
                CheckPracticePlugin();
                _pauseController.HandlePauseMenuManagerDidPressContinueButton();
            }
            _queuedLoad = false;
        }