/// <summary> /// Method shows PlayersForm for editing players /// </summary> private void ChangePlayers() { // if the current game is not finished yet if (!game.CheckGameFinished()) { MessageBox.Show("Please wait until the end of current game!"); return; } PlayersForm form = new PlayersForm(); form.GameStats = statistics; form.ShowDialog(); statistics = form.GameStats; if (form.ChangedPlayer) { // set the list of active players for a new game game.SetPlayerList(form.GetActivePlayers()); // start new game NewGame(); } }
private void MainForm_Load(object sender, EventArgs e) { // firstly, show the Players form PlayersForm form = new PlayersForm(); // if we added at least one player and pressed OK, then start: if (form.ShowDialog() == DialogResult.OK) { statistics = form.GameStats; // create new game object game = new BlackjackGame(); // initialize visualizer gamevisualizer = new CardTableVisualizer(game); gamevisualizer.PrepareGraphics(this.Width, this.Height, CreateGraphics()); // initialize controller: // pass the game and visualizer objects // and the FixGameResults() function as the function that will be called when the game's over gamecontroller = new CardTableController(game, gamevisualizer, FixGameResults); // set the list of active players for a new game game.SetPlayerList( form.GetActivePlayers() ); // start new game NewGame(); } else { Close(); } }
private void MainForm_Load(object sender, EventArgs e) { // firstly, show the Players form PlayersForm form = new PlayersForm(); // if we added at least one player and pressed OK, then start: if (form.ShowDialog() == DialogResult.OK) { statistics = form.GameStats; // create new game object game = new BlackjackGame(); // initialize visualizer gamevisualizer = new CardTableVisualizer(game); gamevisualizer.PrepareGraphics(this.Width, this.Height, CreateGraphics()); // initialize controller: // pass the game and visualizer objects // and the FixGameResults() function as the function that will be called when the game's over gamecontroller = new CardTableController(game, gamevisualizer, FixGameResults); // set the list of active players for a new game game.SetPlayerList(form.GetActivePlayers()); // start new game NewGame(); } else { Close(); } }
/// <summary> /// Method shows PlayersForm for editing players /// </summary> private void ChangePlayers() { // if the current game is not finished yet if ( !game.CheckGameFinished() ) { MessageBox.Show("Please wait until the end of current game!"); return; } PlayersForm form = new PlayersForm(); form.GameStats = statistics; form.ShowDialog(); statistics = form.GameStats; if (form.ChangedPlayer) { // set the list of active players for a new game game.SetPlayerList( form.GetActivePlayers() ); // start new game NewGame(); } }