Example #1
0
        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();
            }
        }
Example #2
0
        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();
            }
        }