예제 #1
0
        public void SetInfo(Player thePlayer, Game theGame)
        {
            game       = theGame;
            player     = thePlayer;
            gamePlayer = game.PlayersCards[player] as Game.GamePlayer;

            // Don't show the score label if basic scoring is used
            if (game.Options.ScoringSystem == GameOptions.ScoringSystems.Basic)
            {
                scoreLabel.Visible = false;
            }


            nameLabel.Text  = player.Name;
            scoreLabel.Text = "Score: " + player.Score;

            //typeLabel.Text = Player.PlayerTypeToString(player.Type);
            typeBadge.Image = Player.PlayerTypeBadge(player.Type);

            turnsLabel.Text         = gamePlayer.NumberOfTurns.ToString();
            cardsPickedUpLabel.Text = gamePlayer.NumberOfCardsPickedUp.ToString();
            cardsPlayedLabel.Text   = gamePlayer.NumberOfCardsPlayed.ToString();

            ordinalLabel.Text = GetOrdinalStringForInt(player.Rank + 1);
            if (thePlayer.Team != 0)
            {
                TeamIndex.Text += " " + thePlayer.Team;
            }
        }
예제 #2
0
        public GameView(Game newGame, GameController gameController)
        {
            InitializeComponent();

            toolTip = new ToolTip();

            // Must redefine the background image to make the optimizing code work properly
            BackgroundImage = Properties.Resources.GameView;

            // Save the parameters
            game       = newGame;
            controller = gameController;



            // Create picture boxes for each card, and store them in a hash table
            foreach (Card c in game.Deck)
            {
                cardsViews.Add(c, createPictureBoxForCard(c));
            }



            // Add controls to their arrays

            playerLabels.Add(player1Label);
            playerLabels.Add(player2Label);
            playerLabels.Add(player3Label);
            playerLabels.Add(player4Label);

            playerComputerBadges.Add(player1ComputerBadge);
            playerComputerBadges.Add(player2ComputerBadge);
            playerComputerBadges.Add(player3ComputerBadge);
            playerComputerBadges.Add(player4ComputerBadge);


            // Set player name and type labels
            for (int i = 0; i < 4; i++)
            {
                if (i < game.Players.Count)
                {
                    playerLabels[i].Text          = game.Players[i].Name;
                    playerComputerBadges[i].Image = Player.PlayerTypeBadge(game.Players[i].Type);
                }

                else
                {
                    playerLabels[i].Visible         = false;
                    playerComputerBadges[i].Visible = false;
                }
            }


            // Set the game info message
            gameInfoMessage.Text = GameOptions.ScoringSystemToString(game.Options.ScoringSystem) + (game.Options.StopPlayingAfterFirst ? ",\r\nStopping after winner" : "");

            // Handle the form closing event
            FormClosing += new FormClosingEventHandler(GameView_FormClosing);

            // Set up the end game highlight flashing timer
            endGameHighlightTimer.Interval = 500;
            endGameHighlightTimer.Tick    += new EventHandler(endGameHighlightTimer_Tick);


            // Check if there's too many cards
            tooManyCards = game.NumberOfPlayers * game.Options.CardsForEachPlayer > 50;



            #if DEBUG
            debugControls.Visible = true;
            #endif
        }