Represents a human player.
Inheritance: Belot.Player
Ejemplo n.º 1
0
        private void MenuNew_Click( object sender, EventArgs e )
        {
            this.Text = "";

            HumanPlayer pl1 = new HumanPlayer( Properties.Settings.Default.SouthName );
            ComputerPlayer pl2 = CreatePlayer( Properties.Settings.Default.NorthDll, Properties.Settings.Default.NorthName );
            ComputerPlayer pl3 = CreatePlayer( Properties.Settings.Default.EastDll, Properties.Settings.Default.EastName );
            ComputerPlayer pl4 = CreatePlayer( Properties.Settings.Default.WestDll, Properties.Settings.Default.WestName );

            if ( pl2 == null || pl3 == null || pl4 == null )
            {
                MessageBox.Show( "Player not properly configured. See 'Settings->Players' for details.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
                return;
            }

            pl1.AnnounceMaking += new HumanPlayer.AnnounceMakingHandler( HumanPlayerIsBidding );
            pl2.AnnounceMade += new ComputerPlayer.AnnounceMadeHandler( CompPlayerBidded );
            pl3.AnnounceMade += new ComputerPlayer.AnnounceMadeHandler( CompPlayerBidded );
            pl4.AnnounceMade += new ComputerPlayer.AnnounceMadeHandler( CompPlayerBidded );

            pl1.CardPlaying += new Player.CardPlayingHandler( HumanPlayerIsPlaying );
            pl2.CardPlayed += new Player.CardPlayedHandler( ComputerPlayerPlayed );
            pl3.CardPlayed += new Player.CardPlayedHandler( ComputerPlayerPlayed );
            pl4.CardPlayed += new Player.CardPlayedHandler( ComputerPlayerPlayed );

            pl1.CardsChanged += new Player.PlayerCardsChangedHandler( DrawCards );
            pl2.CardsChanged += new Player.PlayerCardsChangedHandler( DrawCards );
            pl3.CardsChanged += new Player.PlayerCardsChangedHandler( DrawCards );
            pl4.CardsChanged += new Player.PlayerCardsChangedHandler( DrawCards );

            pl1.CardCombinationAnnouncing += new HumanPlayer.CardCombinationAnnouncingHandler( HumanCardCombinationAnnouncing );
            pl2.CardCombinationAnnounced += new ComputerPlayer.CardCombinationAnnouncedHandler( CombinationAnnounced );
            pl3.CardCombinationAnnounced += new ComputerPlayer.CardCombinationAnnouncedHandler( CombinationAnnounced );
            pl4.CardCombinationAnnounced += new ComputerPlayer.CardCombinationAnnouncedHandler( CombinationAnnounced );

            this._game = new BelotGame( pl1, pl3, pl2, pl4 );
            this._game.BiddingCompleted += new BelotGame.BiddingCompletedHandler( BiddingCompleted );
            this._game.DealStarted += new BelotGame.DealEventHandler( DealStarted );
            this._game.DealCompleted += new BelotGame.DealEventHandler( DealCompleted );
            this._game.HandClosed += new BelotGame.HandClosedHandler( HandClosed );
            this._game.GameCompleted += new BelotGame.GameCompletedHandler( GameOver );

            this._game.CapotRemovesDouble = Properties.Settings.Default.CapotRemovesDouble;
            this._game.ExtraPointsAreDoubled = Properties.Settings.Default.ExtraPointsAreDoubled;

            this._game.StartGame();
        }
Ejemplo n.º 2
0
 private void HumanPlayerIsPlaying( Player player, PlayingManager manager )
 {
     SetPlayerActive( player );
     _currentHuman = ( HumanPlayer )player;
 }