Beispiel #1
0
 public void OnActiveSceneChanged(Scene prevScene, Scene nextScene)
 {
     Logger.log.Debug(nextScene.name);
     SharedCoroutineStarter.instance.StartCoroutine(LoadAudio());
     if (nextScene.name == "MenuViewControllers")
     {
         basicUIAudioManager = Resources.FindObjectsOfTypeAll <BasicUIAudioManager>().FirstOrDefault();
         if (_clickSounds != null)
         {
             ReflectionUtil.SetField(basicUIAudioManager, "_clickSounds", _clickSounds);
         }
     }
     if (nextScene.name == "GameCore")
     {
         noteCutSoundEffectManager = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().FirstOrDefault();
         noteCutSoundEffect        = Resources.FindObjectsOfTypeAll <NoteCutSoundEffect>().FirstOrDefault();
         bombCutSoundEffectManager = Resources.FindObjectsOfTypeAll <BombCutSoundEffectManager>().FirstOrDefault();
         if (_longCutEffectsAudioClips != null)
         {
             ReflectionUtil.SetField(noteCutSoundEffectManager, "_longCutEffectsAudioClips", _longCutEffectsAudioClips);
         }
         if (_shortCutEffectsAudioClips != null)
         {
             ReflectionUtil.SetField(noteCutSoundEffectManager, "_shortCutEffectsAudioClips", _shortCutEffectsAudioClips);
         }
         if (_badCutSoundEffectAudioClips != null)
         {
             ReflectionUtil.SetField(noteCutSoundEffect, "_badCutSoundEffectAudioClips", _badCutSoundEffectAudioClips);
         }
         if (_bombExplosionAudioClips != null)
         {
             ReflectionUtil.SetField(bombCutSoundEffectManager, "_bombExplosionAudioClips", _bombExplosionAudioClips);
         }
     }
 }
        private static void Postfix(NoteCutSoundEffectManager __instance)
        {
            NoodleCutSoundEffectManager noodleManager = __instance.gameObject.AddComponent <NoodleCutSoundEffectManager>();

            noodleManager.Init(__instance);
            NoteCutSoundEffectManagerHandleNoteWasSpawned.NoodleManager = noodleManager;
        }
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
        private static void Postfix(NoteCutSoundEffectManager __instance)
#pragma warning restore SA1313 // Parameter names should begin with lower-case letter
        {
            NoodleCutSoundEffectManager noodleManager = __instance.gameObject.AddComponent <NoodleCutSoundEffectManager>();

            noodleManager.Init(__instance);
            NoteCutSoundEffectManagerHandleNoteWasSpawned.NoodleManager = noodleManager;
        }
Beispiel #4
0
 private void LoadGameObjects()
 {
     levelFailController = Resources.FindObjectsOfTypeAll <StandardLevelFailedController>().LastOrDefault();
     spawnController     = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().LastOrDefault();
     spawnMovementData   = spawnController.GetField <BeatmapObjectSpawnMovementData, BeatmapObjectSpawnController>("_beatmapObjectSpawnMovementData");
     callbackController  = spawnController.GetField <BeatmapCallbacksController, BeatmapObjectSpawnController>("_beatmapCallbacksController");
     soundEffectManager  = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().LastOrDefault();
     audioTimeSync       = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().LastOrDefault();
     songAudio           = audioTimeSync.GetField <AudioSource, AudioTimeSyncController>("_audioSource");
 }
Beispiel #5
0
        private IEnumerator Setup()
        {
            yield return(new WaitForSeconds(0.1f));

            callbackController        = Resources.FindObjectsOfTypeAll <BeatmapObjectCallbackController>().LastOrDefault();
            originalSpawnMovementData = GameObjects.spawnController.GetField <BeatmapObjectSpawnMovementData, BeatmapObjectSpawnController>("_beatmapObjectSpawnMovementData");
            seManager         = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().LastOrDefault();
            progessController = Resources.FindObjectsOfTypeAll <SongProgressUIController>().LastOrDefault();
            pauseManager      = Resources.FindObjectsOfTypeAll <PauseMenuManager>().LastOrDefault();
            // switchTime = 20f;
            switchTime = GameObjects.songAudio.clip.length - 1f;
            Task.Run(PrepareNextSong);
        }
Beispiel #6
0
        IEnumerator Setup()
        {
            yield return(new WaitUntil(() => _scoreController = Resources.FindObjectsOfTypeAll <ScoreController>().FirstOrDefault()));

            yield return(new WaitUntil(() => _beatmapObjectSpawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().FirstOrDefault()));

            yield return(new WaitUntil(() => _noteCutSoundEffectManager = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().FirstOrDefault()));

            _scoreController.noteWasCutEvent    += OnNoteCut;
            _scoreController.noteWasMissedEvent += OnNoteMiss;
            var beatmapData = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap.beatmapData;

            id = notesCount = beatmapData?.notesCount + beatmapData?.bombsCount ?? 10000;
        }
Beispiel #7
0
        public void Start()
        {
            gameplayCoreSceneSetupData = gameplayCoreSceneSetup.GetProperty <GameplayCoreSceneSetupData>("sceneSetupData");
            noteCutSoundEffectManager  = gameplayCoreSceneSetup.GetField <NoteCutSoundEffectManager>("_noteCutSoundEffectManager");
            levelDetailViewController  = Resources.FindObjectsOfTypeAll <StandardLevelDetailViewController>().First();

            if (preferredDifficulty == null)
            {
                preferredDifficulty = gameplayCoreSceneSetupData.difficultyBeatmap.difficulty;
            }

            //Listen for restarts so that we can set up the playlist properly on restart
            var restartButton = pauseMenuManager.GetField <Button>("_restartButton");

            buttonBinder = new ButtonBinder();
            buttonBinder.AddBinding(restartButton, () => {
                playlist = new Queue <IPreviewBeatmapLevel>(playlist.Prepend(gameplayCoreSceneSetupData.difficultyBeatmap.level));
                Plugin.instance.loadedLevels = playlist;
            });
        }
        public static IEnumerator FetchObjects()
        {
            yield return(new WaitForSeconds(0.1f));

            soundEffectManager   = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().LastOrDefault();
            beatmapObjectManager = Resources.FindObjectsOfTypeAll <BeatmapObjectExecutionRatingsRecorder>().LastOrDefault().GetPrivateField <BeatmapObjectManager>("_beatmapObjectManager") as BasicBeatmapObjectManager;
            spawnController      = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().LastOrDefault();
            energyCounter        = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().LastOrDefault();
            ColorManager         = Resources.FindObjectsOfTypeAll <ColorManager>().LastOrDefault();
            pauseManager         = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().LastOrDefault();
            AudioTimeSync        = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().LastOrDefault();
            if (AudioTimeSync != null)
            {
                songAudio = AudioTimeSync.GetField <AudioSource>("_audioSource");
                if (songAudio == null)
                {
                    Plugin.Log("Audio null");
                }
            }
            Mixer = soundEffectManager.GetField <AudioManagerSO>("_audioManager");
            GameModifiersController.SetupSpawnCallbacks();
        }
Beispiel #9
0
        private IEnumerator DelayedSetup()
        {
            //Slight delay before grabbing needed objects
            yield return(new WaitForSeconds(0.1f));

            _timeSync                  = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().LastOrDefault(x => x.isActiveAndEnabled);
            _songAudio                 = _timeSync.GetField <AudioSource>("_audioSource");
            _levelLoader               = Resources.FindObjectsOfTypeAll <CustomLevelLoader>().First();
            _spawnController           = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().LastOrDefault(x => x.isActiveAndEnabled);
            _originalSpawnMovementData = _spawnController.GetField <BeatmapObjectSpawnMovementData>("_beatmapObjectSpawnMovementData");
            _pauseController           = Resources.FindObjectsOfTypeAll <PauseController>().LastOrDefault(x => x.isActiveAndEnabled);
            _callbackController        = Resources.FindObjectsOfTypeAll <BeatmapObjectCallbackController>().LastOrDefault(x => x.isActiveAndEnabled);
            _seManager                 = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().LastOrDefault(x => x.isActiveAndEnabled);
            _beatmapObjectManager      = _seManager.GetField <BeatmapObjectManager>("_beatmapObjectManager");
            _cancelSource              = new CancellationTokenSource();
            var level = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap.level;

            if (!(level is CustomPreviewBeatmapLevel))
            {
                yield break;
            }
            _currentLevel = level as CustomPreviewBeatmapLevel;

            //Get DifficultyBeatmap
            BeatmapDifficulty       levelDiff           = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap.difficulty;
            BeatmapCharacteristicSO levelCharacteristic = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap.parentDifficultyBeatmapSet.beatmapCharacteristic;

            _currentDiffBeatmap = _currentLevel.standardLevelInfoSaveData.difficultyBeatmapSets.First(
                x => x.beatmapCharacteristicName == levelCharacteristic.serializedName).difficultyBeatmaps.First(
                x => x.difficulty == levelDiff.ToString());

            _originalInitData = _timeSync.GetField <AudioTimeSyncController.InitData>("_initData");
            _songStartTime    = _originalInitData.startSongTime;
            //Initialize if everything successfully grabbed
            _init = true;
        }
 internal void Init(NoteCutSoundEffectManager noteCutSoundEffectManager)
 {
     _noteCutSoundEffectManager = noteCutSoundEffectManager;
 }
        public void OnActiveSceneChanged(Scene arg0, Scene scene)
        {
            if (scene.name == "MenuViewControllers")
            {
                activateDuringIsolated = false;
                Log("Switched to Menu");
                SharedCoroutineStarter.instance.StartCoroutine(GrabPP());

                var controllers = Resources.FindObjectsOfTypeAll <VRController>();
                if (controllers != null)
                {
                    foreach (VRController controller in controllers)
                    {
                        if (controller != null)
                        {
                            if (controller.ToString() == "ControllerLeft (VRController)")
                            {
                                leftController = controller;
                            }
                            if (controller.ToString() == "ControllerRight (VRController)")
                            {
                                rightController = controller;
                            }
                        }
                        //        Log(controller.ToString());
                    }
                    //                 Log("Left:" + leftController.ToString());
                    //                   Log("Right: " + rightController.ToString());
                }
            }



            if (scene.name == "GameCore")
            {
                RemovePatches();
            }
            if (_mainSettingsModel == null)
            {
                var menu = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().FirstOrDefault();
                if (menu != null)
                {
                    _mainSettingsModel = menu.GetField <MainSettingsModelSO>("_mainSettingsModel");
                    _mainSettingsModel.Load(true);
                    Log("RUMBLE: " + _mainSettingsModel.controllersRumbleEnabled.ToString());

                    if (!setDefaultRumble)
                    {
                        defaultRumble = _mainSettingsModel.controllersRumbleEnabled;
                        ModPrefs.SetInt("GameplayModifiersPlus", "GameRumbleSetting", _mainSettingsModel.controllersRumbleEnabled ? 1 : 0);
                        setDefaultRumble = true;
                        Log("Set Default Rumble Value");
                    }
                }
            }

            if (_mainSettingsModel != null)
            {
                defaultRumble = ModPrefs.GetInt("GameplayModifiersPlus", "GameRumbleSetting", -1, false) != 1 ? false : true;
                _mainSettingsModel.controllersRumbleEnabled.value = defaultRumble;
                _mainSettingsModel.Save();
            }


            paused = false;
            if (!customColorsInstalled)
            {
                if (colorA != null)
                {
                    colorA.SetColor(defColorA);
                }
                if (colorB != null)
                {
                    colorB.SetColor(defColorB);
                }
            }


            //        try
            //        {
            if (scene.name == "EmptyTransition")
            {
                Log("Resetting Chat Powers Object");
                if (chatPowers != null)
                {
                    GameObject.Destroy(chatPowers);
                }
            }
            if (chatPowers == null)
            {
                Log("Null Creation of Chat Powers Object");
                chatPowers = new GameObject("Chat Powers");
                GameObject.DontDestroyOnLoad(chatPowers);
                twitchPowers = chatPowers.AddComponent <TwitchPowers>();
            }

            //        }
            //        catch(Exception ex)
            //        {
            //           Log(ex.ToString());
            //        }

            GMPDisplay display = chatPowers.GetComponent <GMPDisplay>();

            if (display != null)
            {
                display.Destroy();
                GameObject.Destroy(display);
            }



            ReadPrefs();
            if (GMPUI.chatIntegration && twitchPluginInstalled)
            {
                if (twitchPowers != null)
                {
                    cooldowns.ResetCooldowns();
                    TwitchPowers.ResetPowers(false);
                    twitchPowers.StopAllCoroutines();
                }
                if (ChatConfig.resetChargesEachLevel)
                {
                    charges = 0;
                }
            }

            //    twitchCommands.StopAllCoroutines();
            haveSongNJS = false;
            if (soundIsPlaying == true)
            {
                gnomeSound.Stop();
            }
            soundIsPlaying = false;
            isValidScene   = false;
            playerInfo     = false;
            modifiersInit  = false;
            if (arg0.name == "EmpyTransition" && chatPowers != null)
            {
                GameObject.Destroy(chatPowers);
            }

            if (scene.name == "GameCore")
            {
                Log("Isolated: " + BS_Utils.Gameplay.Gamemode.IsIsolatedLevel);
                isValidScene = true;
                if (BS_Utils.Gameplay.Gamemode.IsIsolatedLevel && !activateDuringIsolated)
                {
                    Log("Isolated Level, not activating");
                    return;
                }
                //     Log("Pre GrabGrab");
                GameObject.Destroy(GameObject.Find("Color Setter"));
                soundEffectManager = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().FirstOrDefault();
                spawnController    = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().FirstOrDefault();
                energyCounter      = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().First();
                energyPanel        = Resources.FindObjectsOfTypeAll <GameEnergyUIPanel>().First();
                ColorManager       = Resources.FindObjectsOfTypeAll <ColorManager>().First();
                levelData          = BS_Utils.Plugin.LevelData;
                //    Log("Post GrabGrab");
                if (spawnController != null)
                {
                    spawnController.noteDidStartJumpEvent += SpawnController_ModifiedJump;
                    spawnController.noteWasCutEvent       += SpawnController_ScaleRemoveCut;
                    spawnController.noteWasMissedEvent    += SpawnController_ScaleRemoveMiss;
                }
                else
                {
                    Log("Spawn Controller Null");
                }
                //   Log("Post GrabGrab 2");
                currentSongSpeed = levelData.GameplayCoreSceneSetupData.gameplayModifiers.songSpeedMul;

                BS_Utils.Plugin.LevelDidFinishEvent += LevelData_didFinishEvent;
                //   Log("Post GrabGrab 3");
                if (!Multiplayer.MultiMain.multiActive.Value)
                {
                    if (GMPUI.chatIntegration && ChatConfig.maxCharges > 0 && twitchPluginInstalled)
                    {
                        chatPowers.AddComponent <GMPDisplay>();
                    }
                    if (GMPUI.chatIntegration && ChatConfig.timeForCharges > 0 && twitchPluginInstalled)
                    {
                        twitchPowers.StartCoroutine(TwitchPowers.ChargeOverTime());
                    }
                }
                //   Log("Post GrabGrab 4");


                pauseManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First();
                var colors = Resources.FindObjectsOfTypeAll <SimpleColorSO>();
                //    Log("Pre Color");
                foreach (SimpleColorSO color in colors)
                {
                    //     Log(color.name);
                    if (color.name == "BaseNoteColor1")
                    {
                        colorA = color;
                    }
                    if (color.name == "BaseNoteColor0")
                    {
                        colorB = color;
                    }
                }
                oldColorA.SetColor(colorA);
                oldColorB.SetColor(colorB);
                //      Log("Pre ChatInt");

                //      Log(colorA.color.ToString());
                if (GMPUI.chatIntegration && charges <= ChatConfig.maxCharges && twitchPluginInstalled)
                {
                    charges += ChatConfig.chargesPerLevel;
                    if (charges > ChatConfig.maxCharges)
                    {
                        charges = ChatConfig.maxCharges;
                    }
                    //          TryAsyncMessage("Current Charges: " + charges);
                }


                //  Log("Pre Audio/Player");
                //   ReflectionUtil.SetProperty(typeof(PracticePlugin.Plugin), "TimeScale", 1f);
                AudioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();
                if (AudioTimeSync != null)
                {
                    songAudio = AudioTimeSync.GetField <AudioSource>("_audioSource");
                    if (songAudio == null)
                    {
                        Log("Audio null");
                    }
                    //              Log("Object Found");
                }
                //Get Sabers
                player = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault();
                if (player != null)
                {
                    playerInfo = true;
                }
                else
                {
                    playerInfo = false;
                    Log("Player is null");
                }
                CheckGMPModifiers();
            }
        }
        private static bool Prefix(NoteCutSoundEffectManager __instance, BeatmapObjectData beatmapObjectData, ref AudioTimeSyncController ____audioTimeSyncController,
                                   ref float ____prevNoteATime, ref float ____prevNoteBTime, ref NoteCutSoundEffect ____prevNoteASoundEffect, ref NoteCutSoundEffect ____prevNoteBSoundEffect,
                                   ref NoteCutSoundEffect.Pool ____noteCutSoundEffectPool, ref PlayerController ____playerController, ref float ____beatAlignOffset,
                                   ref RandomObjectPicker <AudioClip> ____randomShortCutSoundPicker, ref RandomObjectPicker <AudioClip> ____randomLongCutSoundPicker,
                                   ref BeatmapObjectSpawnController ____beatmapObjectSpawnController)
        {
            if (beatmapObjectData.beatmapObjectType != BeatmapObjectType.Note)
            {
                return(false);
            }
            NoteData noteData  = (NoteData)beatmapObjectData;
            float    timeScale = ____audioTimeSyncController.timeScale;

            if (noteData.noteType != NoteType.NoteA && noteData.noteType != NoteType.NoteB)
            {
                return(false);
            }
            if ((noteData.noteType == NoteType.NoteA && ((noteData.time > ____prevNoteATime) && noteData.time < ____prevNoteATime + 0.001f)) || (noteData.noteType == NoteType.NoteB && ((noteData.time > ____prevNoteBTime) && noteData.time < ____prevNoteBTime + 0.001f)))
            {
                return(false);
            }
            bool flag = false;

            if (noteData.time < ____prevNoteATime + 0.001f || noteData.time < ____prevNoteBTime + 0.001f)
            {
                if (noteData.noteType == NoteType.NoteA && ____prevNoteBSoundEffect.enabled)
                {
                    ____prevNoteBSoundEffect.volumeMultiplier = 0.9f;
                    flag = true;
                }
                else if (noteData.noteType == NoteType.NoteB && ____prevNoteASoundEffect.enabled)
                {
                    ____prevNoteASoundEffect.volumeMultiplier = 0.9f;
                    flag = true;
                }
            }
            NoteCutSoundEffect noteCutSoundEffect = ____noteCutSoundEffectPool.Spawn();

            noteCutSoundEffect.transform.SetPositionAndRotation(__instance.transform.localPosition, Quaternion.identity);
            noteCutSoundEffect.didFinishEvent += __instance.HandleCutSoundEffectDidFinish;
            Saber saber = null;

            if (noteData.noteType == NoteType.NoteA)
            {
                ____prevNoteATime        = noteData.time;
                saber                    = ____playerController.leftSaber;
                ____prevNoteASoundEffect = noteCutSoundEffect;
            }
            else if (noteData.noteType == NoteType.NoteB)
            {
                ____prevNoteBTime        = noteData.time;
                saber                    = ____playerController.rightSaber;
                ____prevNoteBSoundEffect = noteCutSoundEffect;
            }
            if (noteData.noteType == NoteType.NoteA || noteData.noteType == NoteType.NoteB)
            {
                bool      flag2            = noteData.timeToPrevBasicNote < ____beatAlignOffset;
                AudioClip audioClip        = flag2 ? ____randomShortCutSoundPicker.PickRandomObject() : ____randomLongCutSoundPicker.PickRandomObject();
                float     volumeMultiplier = 1f;
                if (flag)
                {
                    volumeMultiplier = 0.9f;
                }
                else if (flag2)
                {
                    volumeMultiplier = 0.9f;
                }
                noteCutSoundEffect.Init(audioClip, (double)(noteData.time / timeScale) + ____audioTimeSyncController.dspTimeOffset, ____beatAlignOffset, ____beatmapObjectSpawnController.missedTimeOffset, noteData.timeToPrevBasicNote / timeScale, noteData.timeToNextBasicNote / timeScale, saber, noteData, __instance.handleWrongSaberTypeAsGood, volumeMultiplier, __instance.useTestAudioClip);
            }
            HashSet <NoteCutSoundEffect> activeItems         = ____noteCutSoundEffectPool.activeItems;
            NoteCutSoundEffect           noteCutSoundEffect2 = null;
            float num = float.MaxValue;

            foreach (NoteCutSoundEffect noteCutSoundEffect3 in activeItems)
            {
                if (noteCutSoundEffect3.noteData.time < num)
                {
                    num = noteCutSoundEffect3.noteData.time;
                    noteCutSoundEffect2 = noteCutSoundEffect3;
                }
            }
            if (activeItems.Count > 64)
            {
                noteCutSoundEffect2.StopPlayingAndFinish();
            }
            return(false);
        }
        private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
        {
            paused = false;
            if (!customColorsInstalled)
            {
                if (colorA != null)
                {
                    colorA.SetColor(defColorA);
                }
                if (colorB != null)
                {
                    colorB.SetColor(defColorB);
                }
            }


            //        try
            //        {
            if (scene.name == "EmptyTransition")
            {
                Log("Resetting Chat Powers Object");
                if (chatPowers != null)
                {
                    GameObject.Destroy(chatPowers);
                }
            }
            if (chatPowers == null)
            {
                Log("Null Creation of Chat Powers Object");
                chatPowers   = new GameObject("Chat Powers");
                twitchPowers = chatPowers.AddComponent <TwitchPowers>();
                GameObject.DontDestroyOnLoad(chatPowers);
            }

            //        }
            //        catch(Exception ex)
            //        {
            //           Log(ex.ToString());
            //        }

            GMPDisplay display = chatPowers.GetComponent <GMPDisplay>();

            if (display != null)
            {
                display.Destroy();
                GameObject.Destroy(display);
            }



            ReadPrefs();
            if (GMPUI.chatIntegration)
            {
                if (twitchPowers != null)
                {
                    cooldowns.ResetCooldowns();
                    TwitchPowers.ResetPowers(false);
                    twitchPowers.StopAllCoroutines();
                }
                if (Config.resetChargesperLevel)
                {
                    charges = 0;
                }
            }

            //    twitchCommands.StopAllCoroutines();
            haveSongNJS = false;

            invalidForScoring = false;
            if (soundIsPlaying == true)
            {
                gnomeSound.Stop();
            }
            soundIsPlaying = false;
            isValidScene   = false;
            playerInfo     = false;
            if (arg0.name == "EmpyTransition" && chatPowers != null)
            {
                GameObject.Destroy(chatPowers);
            }

            if (scene.name == ("Menu"))
            {
                Log("Switched to Menu");
                SharedCoroutineStarter.instance.StartCoroutine(GrabPP());


                if (_hasRegistered == false)
                {
                    TwitchConnection.Instance.StartConnection();
                    TwitchConnection.Instance.RegisterOnMessageReceived(TwitchConnection_OnMessageReceived);
                    _hasRegistered = true;
                }

                var controllers = Resources.FindObjectsOfTypeAll <VRController>();
                if (controllers != null)
                {
                    foreach (VRController controller in controllers)
                    {
                        if (controller != null)
                        {
                            if (controller.ToString() == "ControllerLeft (VRController)")
                            {
                                leftController = controller;
                            }
                            if (controller.ToString() == "ControllerRight (VRController)")
                            {
                                rightController = controller;
                            }
                        }
                        //        Log(controller.ToString());
                    }
                    Log("Left:" + leftController.ToString());
                    Log("Right: " + rightController.ToString());
                }
            }



            if (scene.name == "GameCore")
            {
                environmentColorsSetter = Resources.FindObjectsOfTypeAll <EnvironmentColorsSetter>().FirstOrDefault();
                soundEffectManager      = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().First();
                levelData       = Resources.FindObjectsOfTypeAll <StandardLevelSceneSetupDataSO>().First();
                spawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().First();
                energyCounter   = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().First();
                energyPanel     = Resources.FindObjectsOfTypeAll <GameEnergyUIPanel>().First();

                spawnController.noteDidStartJumpEvent += SpawnController_ModifiedJump;
                spawnController.noteWasCutEvent       += SpawnController_ScaleRemoveCut;
                spawnController.noteWasMissedEvent    += SpawnController_ScaleRemoveMiss;

                currentSongSpeed = levelData.gameplayCoreSetupData.gameplayModifiers.songSpeedMul;


                levelData.didFinishEvent += LevelData_didFinishEvent;



                if (GMPUI.njsRandom)
                {
                    twitchPowers.StartCoroutine(TwitchPowers.RandomNJS());
                }
                Log(GMPUI.swapSabers.ToString());
                if (GMPUI.noArrows)
                {
                    twitchPowers.StartCoroutine(TwitchPowers.NoArrows());
                }
                if (GMPUI.chatIntegration && Config.maxCharges > 0)
                {
                    chatPowers.AddComponent <GMPDisplay>();
                }
                if (Config.timeForCharges > 0)
                {
                    twitchPowers.StartCoroutine(TwitchPowers.ChargeOverTime());
                }

                pauseManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().First();
                var colors = Resources.FindObjectsOfTypeAll <SimpleColorSO>();
                foreach (SimpleColorSO color in colors)
                {
                    Log(color.name);
                    if (color.name == "Color0")
                    {
                        colorA = color;
                    }
                    if (color.name == "Color1")
                    {
                        colorB = color;
                    }
                }
                oldColorA.SetColor(colorA);
                oldColorB.SetColor(colorB);


                Log(colorA.color.ToString());
                if (GMPUI.chatIntegration && charges <= Config.maxCharges)
                {
                    charges += Config.chargesPerLevel;
                    if (charges > Config.maxCharges)
                    {
                        charges = Config.maxCharges;
                    }
                    //          TwitchConnection.Instance.SendChatMessage("Current Charges: " + charges);
                }



                //   ReflectionUtil.SetProperty(typeof(PracticePlugin.Plugin), "TimeScale", 1f);
                isValidScene  = true;
                AudioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();
                if (AudioTimeSync != null)
                {
                    songAudio = AudioTimeSync.GetField <AudioSource>("_audioSource");
                    if (songAudio != null)
                    {
                        Log("Audio not null");
                    }
                    Log("Object Found");
                }
                //Get Sabers
                player = Resources.FindObjectsOfTypeAll <PlayerController>().FirstOrDefault();
                if (player != null)
                {
                    leftSaber  = player.leftSaber;
                    rightSaber = player.rightSaber;

                    playerInfo = true;
                }
                else
                {
                    playerInfo = false;
                    Log("Player is null");
                }
                Log(leftSaber.handlePos.ToString());
                Log(leftSaber.saberBladeTopPos.ToString());

                if (GMPUI.swapSabers)
                {
                    Log("Testing Ground Active");
                    try
                    {
                        SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.TestingGround(5f));
                    }
                    catch (Exception ex)
                    {
                        Log(ex.ToString());
                    }
                }
                //  SharedCoroutineStarter.instance.StartCoroutine(SwapSabers(leftSaber, rightSaber));

                if (GMPUI.gnomeOnMiss == true)
                {
                    invalidForScoring = true;

                    if (spawnController != null)
                    {
                        spawnController.noteWasMissedEvent += delegate(BeatmapObjectSpawnController beatmapObjectSpawnController2, NoteController noteController)
                        {
                            if (noteController.noteData.noteType != NoteType.Bomb)
                            {
                                try
                                {
                                    twitchPowers.StartCoroutine(TwitchPowers.SpecialEvent());
                                    Log("Gnoming");
                                }
                                catch (Exception ex)
                                {
                                    Log(ex.ToString());
                                }
                            }
                        };

                        spawnController.noteWasCutEvent += delegate(BeatmapObjectSpawnController beatmapObjectSpawnController2, NoteController noteController, NoteCutInfo noteCutInfo)
                        {
                            if (!noteCutInfo.allIsOK)
                            {
                                twitchPowers.StartCoroutine(TwitchPowers.SpecialEvent());
                                Log("Gnoming");
                            }
                        };
                    }
                }
                if (GMPUI.bulletTime || GMPUI.chatIntegration || GMPUI.fixedNoteScale != 1f)
                {
                    invalidForScoring = true;
                }

                /*
                 * if(GMPUI.superHot == true)
                 * {
                 *  startGMPUI.superHot = false;
                 *  SharedCoroutineStarter.instance.StartCoroutine(Wait(1f));
                 *
                 * }
                 *
                 */
            }
        }