Beispiel #1
0
        public Label createLabel(Card Card, int size)
        {
            Label newLabel = new Label();

            newLabel.Name = "lbl" + Hit.ToString();
            int y;

            if (Card.Rank == Rank.Ace)
            {
                newLabel.Text = "A";
            }
            else if (Card.Rank == Rank.Jack)
            {
                newLabel.Text = "J";
            }
            else if (Card.Rank == Rank.Queen)
            {
                newLabel.Text = "Q";
            }
            else if (Card.Rank == Rank.Queen)
            {
                newLabel.Text = "K";
            }
            else
            {
                newLabel.Text = Card.getPoints().ToString();
            }

            if (Card.Suit == Suit.Hearts)
            {
                newLabel.Image = Properties.Resources.hearts;
            }
            else if (Card.Suit == Suit.Spades)
            {
                newLabel.Image = Properties.Resources.spades;
            }
            else if (Card.Suit == Suit.Clubs)
            {
                newLabel.Image = Properties.Resources.clubs;
            }
            else if (Card.Suit == Suit.Diamonds)
            {
                newLabel.Image = Properties.Resources.diamonds;
            }
            //newLabel.Left = (size - 1) * 50;
            if (Turn == 0)
            {
                y = 350;
            }
            else
            {
                y = 50;
            }
            newLabel.Location = new Point((size) * 50 + 10, y);
            newLabel.Size     = new Size(50, 70);
            Hit++;
            return(newLabel);
        }
Beispiel #2
0
 public void Hand()
 {
     if (Turn == 0)  //carta giocatore
     {
         extractedCard = deck.extract(Position);
         PlayerScore  += extractedCard.getPoints();
         PlayerHand.Add(extractedCard);
         PlayerLabels.Add(createLabel(PlayerHand.Last(), PlayerLabels.Count));
         this.Controls.Add(PlayerLabels.Last());
         lblPlayerPoints.Text = PlayerScore.ToString();
         controlPoints();
     }
     else //carta pc
     {
         extractedCard = deck.extract(Position);
         PcScore      += extractedCard.getPoints();
         PcHand.Add(extractedCard);
         PcLabels.Add(createLabel(PcHand.Last(), PcLabels.Count));
         this.Controls.Add(PcLabels.Last());
         lblPcPoint.Text = PcScore.ToString();
         controlPoints();
     }
 }