protected virtual async UniTask RollbackToStateAsync(GameStateMap state) { rollbackTaskQueue.Enqueue(state); OnRollbackStarted?.Invoke(); while (rollbackTaskQueue.Peek() != state) { await AsyncUtils.WaitEndOfFrame; } await LoadAllServicesFromStateAsync <IStatefulService <GameStateMap>, GameStateMap>(state); await PerformOnGameDeserializeTasksAsync(state); rollbackTaskQueue.Dequeue(); OnRollbackFinished?.Invoke(); }
private async Task RollbackToStateAsync(GameStateMap state) { rollbackTaskQueue.Enqueue(state); OnRollbackStarted?.Invoke(); while (rollbackTaskQueue.Peek() != state) { await waitForFrame; } await LoadAllServicesFromStateAsync <IStatefulService <GameStateMap>, GameStateMap>(state); foreach (var task in onGameDeserializeTasks) { await task(state); } rollbackTaskQueue.Dequeue(); OnRollbackFinished?.Invoke(); }
private async UniTask RollbackToStateAsync(GameStateMap state) { rollbackTaskQueue.Enqueue(state); OnRollbackStarted?.Invoke(); while (rollbackTaskQueue.Peek() != state) { await AsyncUtils.WaitEndOfFrame; } await LoadAllServicesFromStateAsync <IStatefulService <GameStateMap>, GameStateMap>(state); for (int i = onGameDeserializeTasks.Count - 1; i >= 0; i--) { await onGameDeserializeTasks[i](state); } rollbackTaskQueue.Dequeue(); OnRollbackFinished?.Invoke(); }