Beispiel #1
0
        public void displayDeck()
        {
            grpBxDeck.Controls.Clear();
            for (int i = 0; i < durakDeck.remainingCard(); i++)
            {
                cbxCards        = new CardBoxComponent();
                cbxCards.Card   = durakDeck.GetCard(i);
                cbxCards.Left   = 5 + (i * 10);
                cbxCards.Top    = 12;
                cbxCards.Height = 60;
                cbxCards.Width  = 40;
                cbxCards.FaceUp = FaceStatus.Up;
                grpBxDeck.Controls.Add(cbxCards);
            }
            Label lblDeckCounter = new Label();

            lblDeckCounter.Top  = 200;
            lblDeckCounter.Left = 50;
            lblDeckCounter.Text = durakDeck.remainingCard().ToString();
            grpBxDeck.Controls.Add(lblDeckCounter);


            // For debugging
            Debug.WriteLine("Deck started");
            for (int i = 0; i < durakDeck.remainingCard(); i++)
            {
                Debug.WriteLine(durakDeck.GetCard(i));
            }
            Debug.WriteLine("Deck ended");
        }
Beispiel #2
0
        private void Card_Click(object sender, EventArgs e)
        {
            cbxCards = (CardBoxComponent)sender;
            Card humanDefendCard = cbxCards.Card;

            if (humanAttackTurn() == false)
            {
                if (humanDefend(humanDefendCard))
                {
                    btnAction.Text    = "...";
                    btnAction.Enabled = false;
                    playingField.clearPlayingField();
                    txtMoves.Text    = "Ai Discarded cards";
                    isHumanTurn      = true;
                    isHumanAttacking = true;
                }

                whoWin();


                displayPlayingCard();
                displayAiHand();
                displayHumanHand();
                displayDeck();
                refillCards();
            }
        }
Beispiel #3
0
        public void displayAiHand()
        {
            grpBxAi.Controls.Clear();

            for (int i = 0; i < playerHandAi.totalCards(); i++)
            {
                cbxCards        = new CardBoxComponent();
                cbxCards.Card   = durakAi.GetCard(i);
                cbxCards.Left   = 5 + (i * 20);
                cbxCards.Top    = 12;
                cbxCards.Height = 60;
                cbxCards.Width  = 40;
                cbxCards.FaceUp = FaceStatus.Up;
                grpBxAi.Controls.Add(cbxCards);
            }
        }
Beispiel #4
0
        public void displayPlayingCard()
        {
            grpBxPlayingField.Controls.Clear();

            for (int i = 0; i < playingField.totalCards(); i++)
            {
                cbxCards        = new CardBoxComponent();
                cbxCards.Card   = playingField.GetCard(i);
                cbxCards.Left   = 5 + (i * 45);
                cbxCards.Top    = 20;
                cbxCards.Height = 60;
                cbxCards.Width  = 40;
                cbxCards.FaceUp = FaceStatus.Up;
                grpBxPlayingField.Controls.Add(cbxCards);
            }
        }
Beispiel #5
0
        public void displayHumanHand()
        {
            grpBxHuman.Controls.Clear();

            for (int i = 0; i < playerHandHuman.totalCards(); i++)
            {
                cbxCards        = new CardBoxComponent();
                cbxCards.Card   = durakHuman.GetCard(i);
                cbxCards.Left   = 5 + (i * 20);
                cbxCards.Top    = 12;
                cbxCards.Height = 60;
                cbxCards.Width  = 40;
                cbxCards.FaceUp = FaceStatus.Up;
                grpBxHuman.Controls.Add(cbxCards);
                cbxCards.cardClicked += new EventHandler(Card_Click);
            }
        }