From 59b9656c19c1998c1076fa194db2bb6c897411d1 Mon Sep 17 00:00:00 2001 From: FernTheDev <15272073+Fernthedev@users.noreply.github.com> Date: Mon, 27 Dec 2021 10:35:58 -0400 Subject: [PATCH 1/2] Restart song when loading events --- .../CustomEventCallbackController.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CustomJSONData/CustomEventCallbackController.cs b/CustomJSONData/CustomEventCallbackController.cs index 5290cc3..2ea092c 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,13 @@ private void LateUpdate() break; } + // Events are before/during start + if (customEventData.time <= SpawningStartTime) + { + 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 +103,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 From 4b3882cd36ba1bc8ddf203023a349100b1ab5ffc Mon Sep 17 00:00:00 2001 From: FernTheDev <15272073+Fernthedev@users.noreply.github.com> Date: Mon, 27 Dec 2021 12:32:41 -0400 Subject: [PATCH 2/2] Don't wait for events when seeking forward --- CustomJSONData/CustomEventCallbackController.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CustomJSONData/CustomEventCallbackController.cs b/CustomJSONData/CustomEventCallbackController.cs index 2ea092c..d8a046d 100644 --- a/CustomJSONData/CustomEventCallbackController.cs +++ b/CustomJSONData/CustomEventCallbackController.cs @@ -88,7 +88,8 @@ private void LateUpdate() } // Events are before/during start - if (customEventData.time <= SpawningStartTime) + // 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?