Exemplo n.º 1
0
        public static void CheckGMPModifiers()
        {
            //   Log($"badNote: {energyCounter.GetField("_badNoteEnergyDrain")}");
            //   Log($"missNote: {energyCounter.GetField("_missNoteEnergyDrain")}");
            //   Log($"goodNote: {energyCounter.GetField("_goodNoteEnergyCharge")}");
            //   Log($"obstaclePerSec: {energyCounter.GetField("_obstacleEnergyDrainPerSecond")}");
            //   Log($"hitBomb: {energyCounter.GetField("_hitBombEnergyDrain")}");


            if (GMPUI.bulletTime || GMPUI.removeCrouchWalls || GMPUI.swapSabers || GMPUI.fiveLanes || GMPUI.angleShift || GMPUI.laneShift || GMPUI.sixLanes || GMPUI.fourLayers || GMPUI.reverse || GMPUI.chatIntegration || GMPUI.funky || GMPUI.oneColor || GMPUI.gnomeOnMiss || GMPUI.njsRandom || GMPUI.noArrows || GMPUI.randomSize || GMPUI.fixedNoteScale != 1f || GMPUI.offsetrandom)
            {
                //     ApplyPatches();
                UnityEngine.Random.InitState(Plugin.levelData.GameplayCoreSceneSetupData.difficultyBeatmap.beatmapData.notesCount);
                BS_Utils.Gameplay.ScoreSubmission.DisableSubmission("GameplayModifiersPlus");

                if (GMPUI.njsRandom || GMPUI.offsetrandom)
                {
                    SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.RandomNjsOrOffset());
                }

                if (GMPUI.removeCrouchWalls)
                {
                    if (levelData.GameplayCoreSceneSetupData.gameplayModifiers.enabledObstacleType != GameplayModifiers.EnabledObstacleType.NoObstacles)
                    {
                        levelData.GameplayCoreSceneSetupData.gameplayModifiers.enabledObstacleType = GameplayModifiers.EnabledObstacleType.FullHeightOnly;
                    }
                }
                if (GMPUI.sixLanes || GMPUI.fourLayers || GMPUI.fiveLanes || GMPUI.laneShift || GMPUI.angleShift)
                {
                    SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.ExtraLanes());
                }
                if (GMPUI.noArrows)
                {
                    SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.NoArrows());
                }
                if (GMPUI.swapSabers)
                {
                    Log("Testing Ground Active");
                    try
                    {
                        SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.TestingGround(10f));
                    }
                    catch (Exception ex)
                    {
                        Log(ex.ToString());
                    }
                }
                if (GMPUI.oneColor)
                {
                    Log("One Color Activating");
                    SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.OneColor());
                }

                if (GMPUI.reverse)
                {
                    Log("Map Reversal");
                    SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.PermaReverse());
                }

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

                        spawnController.noteWasCutEvent += delegate(BeatmapObjectSpawnController beatmapObjectSpawnController2, INoteController noteController, NoteCutInfo noteCutInfo)
                        {
                            if (!noteCutInfo.allIsOK)
                            {
                                SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.SpecialEvent());
                                Log("Gnoming");
                            }
                        };
                    }
                }

                modifiersInit = true;
            }

            if (GMPUI.tunnel)
            {
                Log("Tunnel Activating");
                SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.PermaEncasement(0f));
            }
        }
Exemplo n.º 2
0
        public static IEnumerator CheckGMPModifiers()
        {
            yield return(new WaitForSeconds(0.1f));

            if (GMPUI.EndlessMode || GMPUI.removeCrouchWalls || GMPUI.swapSabers || GMPUI.fiveLanes || GMPUI.angleShift || GMPUI.laneShift || GMPUI.sixLanes || GMPUI.fourLayers || GMPUI.reverse || GMPUI.chatIntegration || GMPUI.funky || GMPUI.njsRandom || GMPUI.noArrows || GMPUI.randomSize || GMPUI.fixedNoteScale != 1f || GMPUI.offsetrandom)
            {
                //     ApplyPatches();
                UnityEngine.Random.InitState(Plugin.levelData.GameplayCoreSceneSetupData.difficultyBeatmap.beatmapData.beatmapObjectsData.Count());
                BS_Utils.Gameplay.ScoreSubmission.DisableSubmission("GameplayModifiersPlus");

                if (GMPUI.njsRandom || GMPUI.offsetrandom)
                {
                    SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.RandomNjsOrOffset());
                }

                if (GMPUI.removeCrouchWalls)
                {
                    if (Plugin.levelData.GameplayCoreSceneSetupData.gameplayModifiers.enabledObstacleType != GameplayModifiers.EnabledObstacleType.NoObstacles)
                    {
                        Plugin.levelData.GameplayCoreSceneSetupData.gameplayModifiers.SetProperty("enabledObstacleType", GameplayModifiers.EnabledObstacleType.FullHeightOnly);
                    }
                }
                if (GMPUI.sixLanes || GMPUI.fourLayers || GMPUI.fiveLanes || GMPUI.laneShift || GMPUI.angleShift)
                {
                    bool notSafe  = false;
                    var  songdata = SongCore.Collections.RetrieveDifficultyData(BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap);
                    if (songdata == null)
                    {
                        notSafe = false;
                    }
                    else
                    {
                        if (songdata.additionalDifficultyData._requirements.Count() > 0)
                        {
                            notSafe = true;
                        }
                    }
                    if (!notSafe)
                    {
                        SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.ExtraLanes());
                    }
                    else
                    {
                        Plugin.log.Warn("Not activating Mapping Extensions Modifiers for Map with Requirements");
                    }
                }
                if (GMPUI.noArrows)
                {
                    SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.NoArrows());
                }
                if (GMPUI.swapSabers)
                {
                    Plugin.Log("Testing Ground Active");
                    try
                    {
                        Plugin.twitchPowers.StartCoroutine(TwitchPowers.TestingGround(10f));
                    }
                    catch (Exception ex)
                    {
                        Plugin.Log(ex.ToString());
                    }
                }

                if (GMPUI.reverse)
                {
                    Plugin.Log("Map Reversal");
                    SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.PermaReverse());
                }
            }

            if (GMPUI.tunnel)
            {
                Plugin.Log("Tunnel Activating");
                SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.PermaEncasement(0f));
            }

            if (GMPUI.EndlessMode)
            {
                BS_Utils.Gameplay.ScoreSubmission.DisableSubmission("GameplayModifiersPlus");
                new GameObject("GMP Endless Behavior").AddComponent <EndlessBehavior>();
            }
        }
Exemplo n.º 3
0
        public static void CheckGMPModifiers()
        {
            if (GMPUI.bulletTime || GMPUI.chatIntegration || GMPUI.funky || GMPUI.oneColor || GMPUI.gnomeOnMiss || GMPUI.njsRandom || GMPUI.noArrows || GMPUI.randomSize || GMPUI.fixedNoteScale != 1f)
            {
                //     ApplyPatches();
                BS_Utils.Gameplay.ScoreSubmission.DisableSubmission("GameplayModifiersPlus");

                if (GMPUI.njsRandom)
                {
                    SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.RandomNJS());
                }
                if (GMPUI.noArrows)
                {
                    SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.NoArrows());
                }
                if (GMPUI.swapSabers)
                {
                    Log("Testing Ground Active");
                    try
                    {
                        SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.TestingGround(5f));
                    }
                    catch (Exception ex)
                    {
                        Log(ex.ToString());
                    }
                }
                if (GMPUI.oneColor)
                {
                    Log("One Color Activating");
                    SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.OneColor());
                }


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

                        spawnController.noteWasCutEvent += delegate(BeatmapObjectSpawnController beatmapObjectSpawnController2, NoteController noteController, NoteCutInfo noteCutInfo)
                        {
                            if (!noteCutInfo.allIsOK)
                            {
                                SharedCoroutineStarter.instance.StartCoroutine(TwitchPowers.SpecialEvent());
                                Log("Gnoming");
                            }
                        };
                    }
                }
            }
        }
Exemplo n.º 4
0
        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));
                 *
                 * }
                 *
                 */
            }
        }