private void LunchGame(object sender, RoutedEventArgs e) { if (RacePlayer1.Text == RacePlayer2.Text) { MessageBoxResult msg = MessageBox.Show("Players must have different races"); return; } GameCreator gc = new GameCreator(); gc.setPeopleJ1(RacePlayer1.Text); gc.setPeopleJ2(RacePlayer2.Text); GameBuilder gb; switch (TypeOfGame.Text) { case "Demo Game": gb = new DemoGameBuilder(); break; case "Small Game": gb = new SmallGameBuilder(); break; case "Classic Game": gb = new ClassicGameBuilder(); break; default: gb = new DemoGameBuilder(); break; } gc.gameBuilder = gb; gc.createGame(); parent.game = gc.getGame(); parent.game.list_players[0].name = NamePlayer1.Text; parent.game.list_players[1].name = NamePlayer2.Text; PageGame pg = new PageGame(); score scJ1 = new score(parent.game.list_players[0]); score scJ2 = new score(parent.game.list_players[1]); parent.center.Navigate(pg); parent.ScoreJ1.Navigate(scJ1); parent.ScoreJ2.Navigate(scJ2); parent.ScoreJ1.Visibility = Visibility.Visible; parent.ScoreJ2.Visibility = Visibility.Visible; parent.listScore.Add(scJ1); parent.listScore.Add(scJ2); }
public unsafe void TestDemoBuilder() { GameCreator gc = new GameCreator(); gc.setPeopleJ1("elf"); gc.setPeopleJ2("human"); GameBuilder gb = new DemoGameBuilder(); gc.gameBuilder = gb; gc.createGame(); Game game = gc.getGame(); Assert.AreEqual(game.maxTurnNumber, 5); }