diff --git a/CustomJSONData/CustomEventCallbackController.cs b/CustomJSONData/CustomEventCallbackController.cs index 5290cc3..d8a046d 100644 --- a/CustomJSONData/CustomEventCallbackController.cs +++ b/CustomJSONData/CustomEventCallbackController.cs @@ -75,6 +75,8 @@ private void LateUpdate() return; } + bool start = false; + foreach (CustomEventCallbackData customEventCallbackData in _customEventCallbackData) { while (customEventCallbackData.nextEventIndex < BeatmapData.customEventsData.Count) @@ -85,6 +87,14 @@ private void LateUpdate() break; } + // Events are before/during start + // This should only be done if the starting time is 0 + if (customEventData.time <= SpawningStartTime && SpawningStartTime == 0) + { + start = true; + // TODO: Pause the song so the audio doesn't play while loading? + } + // skip events before song start if (customEventData.time >= SpawningStartTime || customEventCallbackData.callIfBeforeStartTime) { @@ -94,6 +104,16 @@ private void LateUpdate() customEventCallbackData.nextEventIndex++; } } + + // Restart the song since we were loading for events + // this *should* fix the issues caused by the map running in the background while events were loading + if (!start || AudioTimeSource is not AudioTimeSyncController implAudioTimeSource) + { + return; + } + + implAudioTimeSource.StartSong(0); + implAudioTimeSource.Resume(); } public class CustomEventCallbackData