public override void LateUpdate() { BeatmapData beatmapData = _beatmapDataModel.beatmapData; if (beatmapData == null || owner == null || owner.playerInfo == null) { return; } for (int i = 0; i < _beatmapEarlyEventCallbackData.Count; i++) { BeatmapEventCallbackData beatmapEventCallbackData = _beatmapEarlyEventCallbackData[i]; while (beatmapEventCallbackData.nextEventIndex < beatmapData.beatmapEventData.Length) { BeatmapEventData beatmapEventData = beatmapData.beatmapEventData[beatmapEventCallbackData.nextEventIndex]; if (beatmapEventData.time - beatmapEventCallbackData.aheadTime >= owner.playerInfo.updateInfo.playerProgress) { break; } beatmapEventCallbackData.callback(beatmapEventData); beatmapEventCallbackData.nextEventIndex++; } } for (int j = 0; j < _beatmapObjectCallbackData.Count; j++) { _beatmapObjectDataCallbackCacheList.Clear(); BeatmapObjectCallbackData beatmapObjectCallbackData = _beatmapObjectCallbackData[j]; for (int k = 0; k < beatmapData.beatmapLinesData.Length; k++) { while (beatmapObjectCallbackData.nextObjectIndexInLine[k] < beatmapData.beatmapLinesData[k].beatmapObjectsData.Length) { BeatmapObjectData beatmapObjectData = beatmapData.beatmapLinesData[k].beatmapObjectsData[beatmapObjectCallbackData.nextObjectIndexInLine[k]]; if (beatmapObjectData.time - beatmapObjectCallbackData.aheadTime >= owner.playerInfo.updateInfo.playerProgress) { break; } if (beatmapObjectData.time >= _spawningStartTime) { for (int l = _beatmapObjectDataCallbackCacheList.Count; l >= 0; l--) { if (l == 0 || _beatmapObjectDataCallbackCacheList[l - 1].time <= beatmapObjectData.time) { _beatmapObjectDataCallbackCacheList.Insert(l, beatmapObjectData); break; } } } beatmapObjectCallbackData.nextObjectIndexInLine[k]++; } } foreach (BeatmapObjectData noteData in _beatmapObjectDataCallbackCacheList) { beatmapObjectCallbackData.callback(noteData); } } for (int m = 0; m < _beatmapLateEventCallbackData.Count; m++) { BeatmapEventCallbackData beatmapEventCallbackData2 = _beatmapLateEventCallbackData[m]; while (beatmapEventCallbackData2.nextEventIndex < beatmapData.beatmapEventData.Length) { BeatmapEventData beatmapEventData2 = beatmapData.beatmapEventData[beatmapEventCallbackData2.nextEventIndex]; if (beatmapEventData2.time - beatmapEventCallbackData2.aheadTime >= owner.playerInfo.updateInfo.playerProgress) { break; } beatmapEventCallbackData2.callback(beatmapEventData2); beatmapEventCallbackData2.nextEventIndex++; } } while (_nextEventIndex < beatmapData.beatmapEventData.Length) { BeatmapEventData beatmapEventData3 = beatmapData.beatmapEventData[_nextEventIndex]; if (beatmapEventData3.time >= owner.playerInfo.updateInfo.playerProgress) { break; } SendBeatmapEventDidTriggerEvent(beatmapEventData3); _nextEventIndex++; } }
public override void LateUpdate() { if (_beatmapData == null || owner == null || owner.playerInfo == null) { return; } if (_firstLateUpdate) { _firstLateUpdate = false; return; } if (_beatmapData == null) { return; } for (int i = 0; i < _beatmapObjectCallbackData.Count; i++) { _beatmapObjectDataCallbackCacheList.Clear(); BeatmapObjectCallbackData beatmapObjectCallbackData = _beatmapObjectCallbackData[i]; for (int j = 0; j < _beatmapData.beatmapLinesData.Length; j++) { while (beatmapObjectCallbackData.nextObjectIndexInLine[j] < _beatmapData.beatmapLinesData[j].beatmapObjectsData.Length) { BeatmapObjectData beatmapObjectData = _beatmapData.beatmapLinesData[j].beatmapObjectsData[beatmapObjectCallbackData.nextObjectIndexInLine[j]]; if (beatmapObjectData.time - beatmapObjectCallbackData.aheadTime >= owner.playerInfo.updateInfo.playerProgress) { break; } if (beatmapObjectData.time >= _spawningStartTime) { for (int k = _beatmapObjectDataCallbackCacheList.Count; k >= 0; k--) { if (k == 0 || _beatmapObjectDataCallbackCacheList[k - 1].time <= beatmapObjectData.time) { _beatmapObjectDataCallbackCacheList.Insert(k, beatmapObjectData); break; } } } beatmapObjectCallbackData.nextObjectIndexInLine[j]++; } } foreach (BeatmapObjectData noteData in _beatmapObjectDataCallbackCacheList) { beatmapObjectCallbackData.callback(noteData); } } for (int l = 0; l < _beatmapEventCallbackData.Count; l++) { BeatmapEventCallbackData beatmapEventCallbackData = _beatmapEventCallbackData[l]; while (beatmapEventCallbackData.nextEventIndex < _beatmapData.beatmapEventData.Length) { BeatmapEventData beatmapEventData = _beatmapData.beatmapEventData[beatmapEventCallbackData.nextEventIndex]; if (beatmapEventData.time - beatmapEventCallbackData.aheadTime >= owner.playerInfo.updateInfo.playerProgress) { break; } beatmapEventCallbackData.callback(beatmapEventData); beatmapEventCallbackData.nextEventIndex++; } } while (_nextEventIndex < _beatmapData.beatmapEventData.Length) { BeatmapEventData beatmapEventData2 = _beatmapData.beatmapEventData[_nextEventIndex]; if (beatmapEventData2.time >= owner.playerInfo.updateInfo.playerProgress) { break; } SendBeatmapEventDidTriggerEvent(beatmapEventData2); _nextEventIndex++; } this.GetPrivateField <Action>("callbacksForThisFrameWereProcessedEvent")?.Invoke(); }