Пример #1
0
        private void gameSongController_songDidFinishEvent()
        {
            //Reset the gameEnergyCounter death by obstacle value
            _oldObstacleEnergyDrainPerSecond = gameEnergyCounter.GetField <float>("_obstacleEnergyDrainPerSecond");
            gameEnergyCounter.SetField("_obstacleEnergyDrainPerSecond", 0f);

            //Rehook the functions in the energy counter that watch note events
            beatmapObjectManager = gameEnergyCounter.GetField <BeatmapObjectManager>("_beatmapObjectManager");

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

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

            //Rehook the level end event
            gameSongController.songDidFinishEvent += standardLevelGameplayManager.HandleSongDidFinish;
            gameSongController.songDidFinishEvent -= gameSongController_songDidFinishEvent;

            if (_wouldHaveFailed)
            {
                standardLevelGameplayManager.HandleGameEnergyDidReach0();
            }
            standardLevelGameplayManager.HandleSongDidFinish();
        }
Пример #2
0
        static bool Prefix(StandardLevelGameplayManager __instance, ref StandardLevelGameplayManager.GameState ____gameState)
        {
            //Logger.Trace("In StandardLevelGameplayManager.HandleSongDidFinish()");
            try
            {
                if (BailOutController.instance == null)
                {
                    return(true);
                }
                if (BailOutController.instance.numFails > 0)
                {
                    Logger.log.Debug("Fail detected in BailOutController, forcing level failed");
                    __instance.HandleGameEnergyDidReach0();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Logger.log.Error($"Error in StandardLevelGameplayManagerHandleSongDidFinish: {ex.Message}");
                Logger.log.Debug(ex);
            }

            return(true);
        }