internal static IEnumerator DelayedStart(BeatmapObjectSpawnController beatmapObjectSpawnController) { yield return(new WaitForEndOfFrame()); BeatmapObjectSpawnController = beatmapObjectSpawnController; // prone to breaking if anything else implements these interfaces BeatmapObjectManager beatmapObjectManager = _beatmapObjectSpawnAccessor(ref beatmapObjectSpawnController) as BeatmapObjectManager; BeatmapObjectCallbackController coreSetup = _callbackControllerAccessor(ref beatmapObjectSpawnController) as BeatmapObjectCallbackController; IAudioTimeSource = _audioTimeSourceAccessor(ref coreSetup); IReadonlyBeatmapData beatmapData = _beatmapDataAccessor(ref coreSetup); beatmapObjectManager.noteWasCutEvent -= NoteColorizer.ColorizeSaber; beatmapObjectManager.noteWasCutEvent += NoteColorizer.ColorizeSaber; if (Harmony.HasAnyPatches(HARMONYID)) { if (beatmapData is CustomBeatmapData customBeatmap) { if (ChromaConfig.Instance.EnvironmentEnhancementsEnabled) { EnvironmentEnhancementManager.Init(customBeatmap, beatmapObjectSpawnController.noteLinesDistance); } } // please let me kill legacy LegacyLightHelper.Activate(beatmapData.beatmapEventsData); } }
internal static IEnumerator DelayedStart(BeatmapObjectSpawnController beatmapObjectSpawnController) { yield return(new WaitForEndOfFrame()); BeatmapObjectSpawnController = beatmapObjectSpawnController; // prone to breaking if anything else implements these interfaces BeatmapObjectManager beatmapObjectManager = (BeatmapObjectManager)_beatmapObjectSpawnAccessor(ref beatmapObjectSpawnController); BeatmapObjectCallbackController coreSetup = (BeatmapObjectCallbackController)_callbackControllerAccessor(ref beatmapObjectSpawnController); IAudioTimeSource = _audioTimeSourceAccessor(ref coreSetup); IReadonlyBeatmapData beatmapData = _beatmapDataAccessor(ref coreSetup); beatmapObjectManager.noteWasCutEvent -= NoteColorizer.ColorizeSaber; beatmapObjectManager.noteWasCutEvent += NoteColorizer.ColorizeSaber; if (ChromaIsActive) { if (beatmapData is CustomBeatmapData customBeatmap) { if (ChromaConfig.Instance !.EnvironmentEnhancementsEnabled) { EnvironmentEnhancementManager.Init(customBeatmap, beatmapObjectSpawnController.noteLinesDistance); } } try { // please let me kill legacy LegacyLightHelper.Activate(beatmapData.beatmapEventsData); } catch (System.Exception e) { Plugin.Logger.Log("Could not run Legacy Chroma Lights"); Plugin.Logger.Log(e); } } }
internal static IEnumerator DelayedStart() { yield return(new WaitForEndOfFrame()); AudioTimeSyncController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().First(); BeatmapObjectSpawnController beatmapObjectSpawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().First(); BeatmapObjectManager beatmapObjectManager = _beatmapObjectSpawnAccessor(ref beatmapObjectSpawnController) as BeatmapObjectManager; SongBPM = beatmapObjectSpawnController.currentBpm; BeatmapObjectCallbackController coreSetup = Resources.FindObjectsOfTypeAll <BeatmapObjectCallbackController>().First(); IReadonlyBeatmapData beatmapData = coreSetup.GetField <IReadonlyBeatmapData, BeatmapObjectCallbackController>("_beatmapData"); beatmapObjectManager.noteWasCutEvent -= NoteColorizer.ColorizeSaber; beatmapObjectManager.noteWasCutEvent += NoteColorizer.ColorizeSaber; if (ChromaConfig.Instance.LightshowModifier) { foreach (BeatmapLineData b in beatmapData.beatmapLinesData) { BeatmapLineData refBeatmapLineData = b; _beatmapObjectsDataAccessor(ref refBeatmapLineData) = b.beatmapObjectsData.Where((source, index) => b.beatmapObjectsData[index].beatmapObjectType != BeatmapObjectType.Note).ToList(); } foreach (Saber saber in Resources.FindObjectsOfTypeAll <Saber>()) { saber.gameObject.SetActive(false); } BS_Utils.Gameplay.ScoreSubmission.DisableSubmission("Chroma"); if (ChromaConfig.Instance.PlayersPlace) { GameObject.Find("PlayersPlace")?.SetActive(false); } if (ChromaConfig.Instance.Spectrograms) { GameObject.Find("Spectrograms")?.SetActive(false); } if (ChromaConfig.Instance.BackColumns) { GameObject.Find("BackColumns")?.SetActive(false); } if (ChromaConfig.Instance.Buildings) { GameObject.Find("Buildings")?.SetActive(false); } } if (Harmony.HasAnyPatches(HARMONYID)) { if (beatmapData is CustomBeatmapData customBeatmap) { if (ChromaConfig.Instance.EnvironmentEnhancementsEnabled) { // Spaghetti code below until I can figure out a better way of doing this dynamic dynData = customBeatmap.beatmapCustomData; List <object> objectsToKill = Trees.at(dynData, "_environmentRemoval"); if (objectsToKill != null) { IEnumerable <GameObject> gameObjects = Resources.FindObjectsOfTypeAll <GameObject>(); foreach (string s in objectsToKill.Cast <string>()) { if (s == "TrackLaneRing" || s == "BigTrackLaneRing") { foreach (GameObject n in gameObjects.Where(obj => obj.name.Contains(s))) { if (s == "TrackLaneRing" && n.name.Contains("Big")) { continue; } n.SetActive(false); } } else { foreach (GameObject n in gameObjects .Where(obj => obj.name.Contains(s) && (obj.scene.name?.Contains("Environment") ?? false) && (!obj.scene.name?.Contains("Menu") ?? false))) { n.SetActive(false); } } } } } } // please let me kill legacy LegacyLightHelper.Activate(beatmapData.beatmapEventsData); } }
internal static IEnumerator DelayedStart(BeatmapObjectSpawnController beatmapObjectSpawnController) { yield return(new WaitForEndOfFrame()); BeatmapObjectSpawnController = beatmapObjectSpawnController; // prone to breaking if anything else implements these interfaces BeatmapObjectManager beatmapObjectManager = _beatmapObjectSpawnAccessor(ref beatmapObjectSpawnController) as BeatmapObjectManager; BeatmapObjectCallbackController coreSetup = _callbackControllerAccessor(ref beatmapObjectSpawnController) as BeatmapObjectCallbackController; IAudioTimeSource = _audioTimeSourceAccessor(ref coreSetup); IReadonlyBeatmapData beatmapData = _beatmapDataAccessor(ref coreSetup); beatmapObjectManager.noteWasCutEvent -= NoteColorizer.ColorizeSaber; beatmapObjectManager.noteWasCutEvent += NoteColorizer.ColorizeSaber; if (Harmony.HasAnyPatches(HARMONYID)) { if (beatmapData is CustomBeatmapData customBeatmap) { if (ChromaConfig.Instance.EnvironmentEnhancementsEnabled) { // Spaghetti code below until I can figure out a better way of doing this dynamic dynData = customBeatmap.beatmapCustomData; List <object> objectsToKill = Trees.at(dynData, ENVIRONMENTREMOVAL); // seriously what the f**k beat games // GradientBackground permanently yeeted because it looks awful and can ruin multi-colored chroma maps if (objectsToKill == null) { objectsToKill = new List <object>(); } objectsToKill.Add("GradientBackground"); if (objectsToKill != null) { IEnumerable <GameObject> gameObjects = Resources.FindObjectsOfTypeAll <GameObject>(); foreach (string s in objectsToKill.Cast <string>()) { if (s == "TrackLaneRing" || s == "BigTrackLaneRing") { foreach (GameObject n in gameObjects.Where(obj => obj.name.Contains(s))) { if (s == "TrackLaneRing" && n.name.Contains("Big")) { continue; } n.SetActive(false); } } else { foreach (GameObject n in gameObjects .Where(obj => obj.name.Contains(s) && (obj.scene.name?.Contains("Environment") ?? false) && (!obj.scene.name?.Contains("Menu") ?? false))) { n.SetActive(false); } } } } } } // please let me kill legacy LegacyLightHelper.Activate(beatmapData.beatmapEventsData); } }