Пример #1
0
        public async Task<Game> LoadGameAsync(string id)
        {
            var gameSave = await DataProvider.LoadGameAsync(id);
            IFieldGenerator generator = FieldGeneratorFactory.Create(gameSave.GeneratorParams);
            DateTime startTime = DateTime.UtcNow.Subtract(gameSave.Timer);

            var game = new Game(generator, gameSave.Width, gameSave.Height, startTime);
            var moveResults = new List<MoveResult>();

            foreach (var move in gameSave.PlayerMoves)
            {
                moveResults.Add(game.MakeMove(move));
            }
            return game;
        }