Пример #1
0
        public IEnumerator DoOnLevelStart()
        {
            yield return(new WaitUntil(() => standardLevelGameplayManager.GetField <StandardLevelGameplayManager.GameState>("_gameState") == StandardLevelGameplayManager.GameState.Playing));

            yield return(new WaitUntil(() => Resources.FindObjectsOfTypeAll <GameEnergyCounter>().Any()));

            gameSongController = standardLevelGameplayManager.GetField <GameSongController>("_gameSongController");
            gameEnergyCounter  = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().First();

            //Prevent the gameEnergyCounter from invoking death by obstacle
            _oldObstacleEnergyDrainPerSecond = gameEnergyCounter.GetField <float>("_obstacleEnergyDrainPerSecond");
            gameEnergyCounter.SetField("_obstacleEnergyDrainPerSecond", 0f);

            //Unhook the functions in the energy counter that watch note events, so we can peek inside the process
            beatmapObjectManager = gameEnergyCounter.GetField <BeatmapObjectManager>("_beatmapObjectManager");

            beatmapObjectManager.noteWasMissedEvent -= gameEnergyCounter.HandleNoteWasMissedEvent;
            beatmapObjectManager.noteWasMissedEvent += beatmapObjectManager_noteWasMissedEvent;

            beatmapObjectManager.noteWasCutEvent -= gameEnergyCounter.HandleNoteWasCutEvent;
            beatmapObjectManager.noteWasCutEvent += beatmapObjectManager_noteWasCutEvent;

            //Unhook the level end event so we can reset everything before the level ends
            gameSongController.songDidFinishEvent -= standardLevelGameplayManager.HandleSongDidFinish;
            gameSongController.songDidFinishEvent += gameSongController_songDidFinishEvent;
        }
Пример #2
0
        public IEnumerator PauseOnStart()
        {
            //If we've disabled pause, we need to reenable it so we can pause for stream sync
            if (Plugin.DisablePause)
            {
                //We know pausecontroller will be guaranteed true here since we've already waited for it when disabling pause
                var guaranteedPauseController = pauseController;
                guaranteedPauseController.canPauseEvent -= AntiPause.HandlePauseControllerCanPause_AlwaysFalse;
                guaranteedPauseController.canPauseEvent += standardLevelGameplayManager.HandlePauseControllerCanPause;
            }
            else
            {
                yield return(new WaitUntil(() => standardLevelGameplayManager.GetField <StandardLevelGameplayManager.GameState>("_gameState") == StandardLevelGameplayManager.GameState.Playing));

                yield return(new WaitUntil(() => standardLevelGameplayManager.GetField <PauseController>("_pauseController").GetProperty <bool>("canPause")));
            }

            //Prevent players from unpausing with their menu buttons
            pauseMenuManager.didPressContinueButtonEvent -= pauseController.HandlePauseMenuManagerDidPressContinueButton;

            pauseController.Pause();

            //Wait for the pauseMenuManager to have started and set the pause menu text
            //The text we're checking for is the default text for that field
            yield return(new WaitUntil(() => pauseMenuManager.GetField <TextMeshProUGUI>("_levelNameText").text != @"Super Long Song Name\n<size=80%>ft great artist</size>"));

            pauseMenuManager.GetField <Button>("_restartButton").gameObject.SetActive(false);
            pauseMenuManager.GetField <Button>("_continueButton").gameObject.SetActive(false);
            pauseMenuManager.GetField <Button>("_backButton").gameObject.SetActive(false);
            pauseMenuManager.GetField <TextMeshProUGUI>("_beatmapDifficultyText").gameObject.SetActive(false);
            oldLevelText = pauseMenuManager.GetField <TextMeshProUGUI>("_levelNameText").text;
            pauseMenuManager.GetField <TextMeshProUGUI>("_levelNameText").text = "Please wait!\n<size=80%>Setting up synchronized streams!</size>";
        }
Пример #3
0
        public IEnumerator DoOnLevelStart()
        {
            yield return(new WaitUntil(() => standardLevelGameplayManager.GetField <StandardLevelGameplayManager.GameState>("_gameState") == StandardLevelGameplayManager.GameState.Playing));

            yield return(new WaitUntil(() => standardLevelGameplayManager.GetField <PauseController>("_pauseController").GetProperty <bool>("canPause")));

            var pauseController = standardLevelGameplayManager.GetField <PauseController>("_pauseController");

            pauseController.canPauseEvent -= standardLevelGameplayManager.HandlePauseControllerCanPause;
            pauseController.canPauseEvent += HandlePauseControllerCanPause_AlwaysFalse;

            if (Plugin.UseSync)
            {
                new GameObject("SyncController").AddComponent <SyncHandler>();
                Plugin.UseSync = false;
            }
        }
Пример #4
0
        public IEnumerator PauseOnStart()
        {
            //If we've disabled pause, we need to reenable it so we can pause for stream sync
            if (Plugin.DisablePause)
            {
                //We know pausecontroller will be guaranteed true here since we've already waited for it when disabling pause
                var guaranteedPauseController = pauseController;
                guaranteedPauseController.canPauseEvent -= AntiPause.HandlePauseControllerCanPause_AlwaysFalse;
                guaranteedPauseController.canPauseEvent += standardLevelGameplayManager.HandlePauseControllerCanPause;
            }
            else
            {
                yield return(new WaitUntil(() => standardLevelGameplayManager.GetField <StandardLevelGameplayManager.GameState>("_gameState") == StandardLevelGameplayManager.GameState.Playing));

                yield return(new WaitUntil(() => standardLevelGameplayManager.GetField <PauseController>("_pauseController").GetProperty <bool>("canPause")));
            }

            //Prevent players from unpausing with their menu buttons
            pauseMenuManager.didPressContinueButtonEvent -= pauseController.HandlePauseMenuManagerDidPressContinueButton;

            pauseController.Pause();

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

            //Wait for the pauseMenuManager to have started and set the pause menu text
            //The text we're checking for is the default text for that field
            yield return(new WaitUntil(() => levelBar.GetField <TextMeshProUGUI>("_songNameText").text != "!Not Defined!"));

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

            levelBar.hide = false;
            levelBar.GetField <TextMeshProUGUI>("_difficultyText").gameObject.SetActive(false);
            oldLevelText  = levelBar.GetField <TextMeshProUGUI>("_songNameText").text;
            oldAuthorText = levelBar.GetField <TextMeshProUGUI>("_authorNameText").text;
            levelBar.GetField <TextMeshProUGUI>("_songNameText").text   = "请稍等";
            levelBar.GetField <TextMeshProUGUI>("_authorNameText").text = "正在同步直播信号";
        }