public void BindCards(Panel parent, List <Card> cards)
        {
            parent.Children.Clear();

            Image[] cardImages = new Image[cards.Count];
            for (int i = 0; i < cards.Count; i++)
            {
                Card c = cards[i];
                cardImages[i] = CardImageCreator.VisualizeCard(c, parent);
            }
        }
Exemple #2
0
 public void VisualizePlayer(Player player, Label name, Label score, Panel hold)
 {
     hold.Children.Clear();
     name.Content  = player.name;
     score.Content = player.Pairs.cards.Count / 2 + " pairs";
     foreach (Card card in player.Hand.cards)
     {
         card.IsFlipped = true;
         Image image = CardImageCreator.VisualizeCard(card, hold);
         image.Margin     = new Thickness(-20, 0, 0, 0);
         image.MouseDown += CardAsk;
     }
 }
Exemple #3
0
        public void VisualizeActivePlayer(bool cardsFlipped = false)
        {
            page.ActiveHand.Children.Clear();
            page.lblActivePlayerName.Content  = players[currPlayer].name;
            page.lblActivePlayerScore.Content = players[currPlayer].Pairs.cards.Count / 2 + " pairs";
            Deck hand = players[currPlayer].Hand;

            foreach (Card card in hand.cards)
            {
                card.IsFlipped = cardsFlipped;
                Image image = CardImageCreator.VisualizeCard(card, page.ActiveHand);
                image.Margin     = new Thickness(-hand.cards.Count * 4, 0, 0, 0);
                image.MouseDown += IndicateCardSelection;
            }
        }
        public void Initialize()
        {
            game = new BlackjackGame();
            game.InitializePlayers(playerAmo, playerNames, null);
            game.Start();

            // Display Cards
            // Buttons
            // Hit Btn

            // Center Card / Deck
            {
                Card c = new Card(1, 0);
                c.IsFlipped = true;
                var image = CardImageCreator.VisualizeCard(c, centerPanel);
                Grid.SetColumn(image, 0);
                Grid.SetRow(image, 0);
                Grid.SetColumnSpan(image, 2);
                Grid.SetRowSpan(image, 2);
            }

            HideBlackJack();
            SetupAnte();
        }
Exemple #5
0
        public WarGamePage()
        {
            InitializeComponent();
            Card back = new Card(0, 0)
            {
                IsFlipped = true
            };
            Image     card;
            Thickness faceDownThick = new Thickness(0, 100, 0, 0);
            Thickness faceUpThick   = new Thickness(0, 0, 0, 100);

            card = CardImageCreator.VisualizeCard(back, grdParent);
            Grid.SetColumn(card, 0);
            card = CardImageCreator.VisualizeCard(back, grdParent);
            Grid.SetColumn(card, 4);

            imgP1FaceDown            = CardImageCreator.VisualizeCard(back, grdParent);
            imgP1FaceDown.Margin     = faceDownThick;
            imgP1FaceDown.Visibility = Visibility.Hidden;
            Grid.SetColumn(imgP1FaceDown, 1);
            imgP2FaceDown            = CardImageCreator.VisualizeCard(back, grdParent);
            imgP2FaceDown.Margin     = faceDownThick;
            imgP2FaceDown.Visibility = Visibility.Hidden;
            Grid.SetColumn(imgP2FaceDown, 3);

            imgP1FaceUp            = CardImageCreator.VisualizeCard(back, grdParent);
            imgP1FaceUp.Margin     = faceUpThick;
            imgP1FaceUp.Visibility = Visibility.Hidden;
            Grid.SetColumn(imgP1FaceUp, 1);
            imgP2FaceUp            = CardImageCreator.VisualizeCard(back, grdParent);
            imgP2FaceUp.Margin     = faceUpThick;
            imgP2FaceUp.Visibility = Visibility.Hidden;
            Grid.SetColumn(imgP2FaceUp, 3);

            UpdateUI();
        }