private void SwitchToNextMap() { if (nextSong == null || nextBeatmap == null || nextMapDiffInfo == null) { return; } if (BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.playerSpecificSettings.staticLights) { nextBeatmap.SetProperty <BeatmapData, List <BeatmapEventData> >("_beatmapEventsData", new BeatmapEventData[0].ToList()); } AudioClip oldClip = GameObjects.songAudio.clip; TwitchPowers.ResetTimeSync(nextSong, 0f, nextSongInfo.songTimeOffset, 1f); TwitchPowers.ManuallySetNJSOffset(GameObjects.spawnController, nextMapDiffInfo.noteJumpMovementSpeed, nextMapDiffInfo.noteJumpStartBeatOffset, nextSongInfo.beatsPerMinute); // TwitchPowers.ClearCallbackItemDataList(callBackDataList); // DestroyNotes(); TwitchPowers.DestroyObjectsRaw(); TwitchPowers.ResetNoteCutSoundEffects(seManager); callbackController.SetField("_spawningStartTime", 0f); callbackController.SetNewBeatmapData(nextBeatmap); UpdatePauseMenu(); ClearSoundEffects(); //Destroying audio clip is actually bad idea // IPA.Utilities.Async.UnityMainThreadTaskScheduler.Factory.StartNew(() => { oldClip.UnloadAudioData(); AudioClip.Destroy(oldClip); }); Task.Run(PrepareNextSong); CheckIntroSkip(); ResetProgressUI(); }
public static void StaticLights() { BeatmapObjectCallbackController callbackController = Resources.FindObjectsOfTypeAll <BeatmapObjectCallbackController>().First(); BeatmapData beatmapData = callbackController.GetField <BeatmapData>("_beatmapData"); Plugin.Log("Grabbed BeatmapData"); float start = Plugin.songAudio.time; int? nextIndex = Resources.FindObjectsOfTypeAll <BeatmapObjectCallbackController>()?.FirstOrDefault()?.GetField <int>("_nextEventIndex"); BeatmapEventData[] newData = new BeatmapEventData[beatmapData.beatmapEventData.Length]; if (nextIndex.HasValue) { newData[nextIndex.Value] = new BeatmapEventData(start + .01f, BeatmapEventType.Event0, 1); newData[nextIndex.Value + 1] = new BeatmapEventData(start + .01f, BeatmapEventType.Event4, 1); } beatmapData.SetProperty("beatmapEventData", newData); }
public void Inject(BeatmapData beatmap) { List <BeatmapEventData> eventData = beatmap.beatmapEventData.ToList(); foreach (ChromaJSONEventData cev in chromaEvents) { BeatmapEventData baseData = cev.RegisterLink(); eventData.Add(baseData); } eventData = eventData.OrderBy(x => x.time).ToList(); beatmap.SetProperty("beatmapEventData", eventData.ToArray()); ChromaLogger.Log("***"); ChromaLogger.Log("***"); ChromaLogger.Log("Injected ChromaJSONBeatmap"); ChromaLogger.Log("***"); ChromaLogger.Log("***"); }