public void Save(SaveGame saveGame)
        {
            // Don't allow games with the same name as a built in game????
            // Should we just save all games including built in the same way???

            repository.Save(saveGame);
        }
        public void InitializeBuiltInGames()
        {
            var builtInGames = new BuiltInSaveGames();
            foreach (var game in builtInGames.Games)
            {
                var saveGame = new SaveGame
                    {
                        Source = SavedGameSource.BuiltIn,
                        Name = game.Key,
                        CardNames = game.Value.Split(',').ToList()
                    };

                repository.Save(saveGame);
            }
        }
Example #3
0
        public void SaveAndCreateUserDefinedGame()
        {
            var newSavedGame = new SaveGame();

            newSavedGame.Name = "New Saved Game";
            newSavedGame.Source = SavedGameSource.UserDefined;
            newSavedGame.CardNames = new List<string>
                {
                    "Bridge",
                    "Duke",
                    "Great Hall",
                    "Harem",
                    "Ironworks",
                    "Masquerade",
                    "Nobles",
                    "Pawn",
                    "Scout",
                    "Upgrade"
                };

            var savedGames = new SaveGameManager(new MockSaveGameRepository());
            savedGames.Save(newSavedGame);
        }
 private List<Card> BuildCardListFromSavedGame(SaveGame saveGame)
 {
     var cards = new Cards();
     return saveGame.CardNames.Select(name => cards.Where(x => x.Name == name).FirstOrDefault()).ToList();
 }