Esempio n. 1
0
        static void Main(string[] args)
        {
            bool save = false;

            GameBuilder builder = new GameBuilder();

            if (save)
            {
                builder.AddPlayer("Roger", "INFO");
                builder.AddPlayer("Bernard", "EII");
                builder.SetSize("Small");
                builder.UseDefaultFrequencies();
                Game game = builder.Build();
                game.Save("save01.dat");
            }
            else
            {
                Game game = builder.LoadGame("save01.dat");
                //Console.Write(game.Map);
                Console.WriteLine(game.CurrentPlayer);
                Console.WriteLine(game.CurrentPlayer.Cities[0]);
                game.NextTurn();
                Console.WriteLine(game.CurrentPlayer);
                Console.WriteLine(game.CurrentPlayer.Cities[0]);
                game.Save("save01.dat");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Adds a player to the game builder if the control is visible, that is, if
 /// there is enough players to make use of this control.
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="player"></param>
 /// <param name="name"></param>
 /// <param name="civilization"></param>
 private void AddPlayerToGameBuilder(GameBuilder builder, StackPanel player, TextBox name, ComboBox civilization)
 {
     if (player.Visibility == Visibility.Visible)
     {
         builder.AddPlayer(name.Text, civilization.Text);
     }
 }