예제 #1
0
 public void DisplayCard(model.Card a_card)
 {
     if (a_card.GetColor() == model.Card.Color.Hidden)
     {
         System.Console.WriteLine("Dolt Kort");
     }
     else
     {
         String[] colors = new String[(int)model.Card.Color.Count] { "Hjärter", "Spader", "Ruter", "Klöver" };
         String[] values = new String[(int)model.Card.Value.Count] { "två", "tre", "fyra", "fem", "sex", "sju", "åtta", "nio", "tio", "knekt", "dam", "kung", "ess" };
         System.Console.WriteLine("{0} {1}", colors[(int)a_card.GetColor()], values[(int)a_card.GetValue()]);
     }
 }
 public void DisplayCard(model.Card a_card)
 {
     System.Console.WriteLine("{0} of {1}", a_card.GetValue(), a_card.GetColor());
 }
        private void PositionCardPictureBoxToShowCorrectCardImage(model.Card a_card)
        {
            if (a_card.GetColor() != model.Card.Color.Hidden)
            {
                int[] cardPositions = new int[(int)model.Card.Value.Count] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
                int cardPosition = cardPositions[(int)a_card.GetValue()];

                if (cardPosition == 12) { cardPosition = 0; } // since ace is first in the image
                else { cardPosition += 1; } //+ one step since ace is first in the image

                int left = cardPosition * GetStandardDeckCardImageWidth() + cardPosition; // (int)Math.Round(cardPosition);
                int imageRow = -1;
                switch (a_card.GetColor())
                {
                    case model.Card.Color.Clubs:
                        imageRow = (int)StandardDeckImageCardColorRows.Clubs;
                        break;
                    case model.Card.Color.Diamonds:
                        imageRow = (int)StandardDeckImageCardColorRows.Diamonds;
                        break;
                    case model.Card.Color.Hearts:
                        imageRow = (int)StandardDeckImageCardColorRows.Hearts;
                        break;
                    case model.Card.Color.Spades:
                        imageRow = (int)StandardDeckImageCardColorRows.Spades;
                        break;
                }
                int top = imageRow * GetStandardDeckCardImageHeight();

                pictureBoxCard.Left = -left;
                pictureBoxCard.Top = -top;

                panelCard.Width = GetStandardDeckCardImageWidth();
                panelCard.Height = GetStandardDeckCardImageHeight();
            }
            else
            {
                //hidden card, making sure not shown
                UnShowCard();
            }
        }
예제 #4
0
        public override void DisplayCard(model.Card a_card, String playerStr = "")
        {
            playerStr = (playerStr == "" ? "" : String.Format("{0} got ", playerStr));

            System.Console.WriteLine("{0} of {1}", a_card.GetValue(), a_card.GetColor());
        }