Beispiel #1
0
        private void PlayerPBox_Click(object sender, EventArgs e)
        {
            //Get the selected card from the picture box
            int        whichCard;
            PictureBox whichClicked = (PictureBox)sender;

            whichCard = Crazy_Eights_Game.WhichCard((Card)whichClicked.Tag);
            Card Selected = Crazy_Eights_Game.GetPlayerHand().GetCard(whichCard);

            if (Crazy_Eights_Game.IsEight(Selected)) //If the selected card is an eight, load suit selection form
            {
                SuitSelection suitSelection = new SuitSelection();
                DialogResult  result        = suitSelection.ShowDialog();
                Card          card          = new Card();
                if (result == DialogResult.OK)
                {
                    card = suitSelection.GetSelection();
                }
                Crazy_Eights_Game.PlayerTurn(Selected, card);
                Crazy_Eights_Game.ComputerTurn();
                InstructionText.Text = yourTurnText;
            }
            else
            {
                bool check = Crazy_Eights_Game.PlayerTurn(Selected);
                if (check)
                {
                    Crazy_Eights_Game.ComputerTurn();
                    InstructionText.Text = yourTurnText;
                }
                else //If no card is played, change instruction text
                {
                    InstructionText.Text = wrongCard;
                }
            }
            RefreshScreen();
        }