Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CustomJSONData/CustomEventCallbackController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ private void LateUpdate()
return;
}

bool start = false;

foreach (CustomEventCallbackData customEventCallbackData in _customEventCallbackData)
{
while (customEventCallbackData.nextEventIndex < BeatmapData.customEventsData.Count)
Expand All @@ -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)
{
Expand All @@ -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
Expand Down