Beispiel #1
0
        private void GCSSFound(Scene scene, GameplayCoreSceneSetup gcss)
        {
            ChromaLogger.Log("Found GCSS!", ChromaLogger.Level.DEBUG);
            //Plugin.PlayReloadSound();

            _playerController = FindObjectOfType <PlayerController>();
            if (_playerController == null)
            {
                ChromaLogger.Log("Player Controller not found!", ChromaLogger.Level.WARNING);
            }

            /*if (!SceneUtils.IsTargetGameScene(scene.buildIndex)) {
             *  ChromaLogger.Log("Somehow we got to the point where we override a map, while not playing a map.  How did this happen?", ChromaLogger.Level.WARNING);
             *  return;
             * }*/

            if (gcss == null)
            {
                ChromaLogger.Log("Failed to obtain MainGameSceneSetup", ChromaLogger.Level.WARNING);
                return;
            }

            //GameplayCoreSetupData mgData = ReflectionUtil.GetPrivateField<MainGameSceneSetupData>(mgs, "_mainGameSceneSetupData");
            BS_Utils.Gameplay.LevelData levelData = BS_Utils.Plugin.LevelData;
            if (!levelData.IsSet)
            {
                ChromaLogger.Log("BS_Utils LevelData is not set", ChromaLogger.Level.WARNING);
                return;
            }
            PlayerSpecificSettings playerSettings = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.playerSpecificSettings;

            //Map

            BeatmapDataModel _beatmapDataModel = ReflectionUtil.GetField <BeatmapDataModel>(gcss, "_beatmapDataModel");

            if (_beatmapDataModel == null)
            {
                ChromaLogger.Log("{XXX} : NULL BEATMAP DATA MODEL", ChromaLogger.Level.ERROR);
            }
            if (_beatmapDataModel.beatmapData == null)
            {
                ChromaLogger.Log("{XXX} : NULL BEATMAP DATA MODEL BEATMAP DATA", ChromaLogger.Level.ERROR);
            }
            //BeatmapData beatmapData = CreateTransformedBeatmapData(mgData.difficultyLevel.beatmapData, mgData.gameplayOptions, mgData.gameplayMode);
            BeatmapData beatmapData = CreateTransformedBeatmapData(_beatmapDataModel.beatmapData, playerSettings, BaseGameMode.CurrentBaseGameMode);

            if (beatmapData != null)
            {
                _beatmapDataModel.beatmapData = beatmapData;
                ReflectionUtil.SetField(gcss, "_beatmapDataModel", _beatmapDataModel);
            }

            foreach (IChromaBehaviourExtension extension in extensions)
            {
                extension.PostInitialization(songBPM, beatmapData, playerSettings, scoreController);
            }

            //modes = GetModes(mgData.gameplayMode, chromaSong);

            if (ChromaConfig.DebugMode)
            {
                Console.WriteLine();
                Console.WriteLine();
                ChromaLogger.Log("Gamemode: " + BaseGameMode.CurrentBaseGameMode.ToString() + " -- Party: " + BaseGameMode.PartyMode, ChromaLogger.Level.DEBUG);
            }

            //ChromaLogger.Log("Modify Sabers was called", ChromaLogger.Level.DEBUG);

            ColourManager.RefreshLights();

            if (ChromaConfig.LightshowModifier)
            {
                foreach (Saber saber in GameObject.FindObjectsOfType <Saber>())
                {
                    saber.gameObject.SetActive(false);
                }
            }
        }