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();
        }
Example #2
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;
        }
Example #3
0
 private void ClearSoundEffects()
 {
     seManager.GetField <NoteCutSoundEffect.Pool, NoteCutSoundEffectManager>("_noteCutSoundEffectPool").Clear();
 }