Beispiel #1
0
        private async Task PushRollbackSnapshotAsync(Commands.Command executedCommand)
        {
            var state = new GameStateMap();

            state.SaveDateTime = DateTime.Now;

            await SaveAllServicesToStateAsync <IStatefulService <GameStateMap>, GameStateMap>(state);

            foreach (var task in onGameSerializeTasks)
            {
                await task(state);
            }

            rollbackStateStack.Push(state);
        }
        public void PushRollbackSnapshot(bool allowPlayerRollback)
        {
            var state = new GameStateMap();

            state.SaveDateTime          = DateTime.Now;
            state.PlayerRollbackAllowed = allowPlayerRollback;

            SaveAllServicesToState <IStatefulService <GameStateMap>, GameStateMap>(state);

            for (int i = onGameSerializeTasks.Count - 1; i >= 0; i--)
            {
                onGameSerializeTasks[i](state);
            }

            rollbackStack.Push(state);
        }