DdsPlay.Model.Deck.FlipAllCards C# (CSharp) Method

FlipAllCards() public method

Method to toggle the visibility of all cards in the deck.
public FlipAllCards ( ) : void
return void
        public void FlipAllCards()
        {
            foreach (var t in Cards)
            {
                t.Visible = !t.Visible;
            }
        }

Usage Example

Example #1
0
        private void Start_Click(object sender, RoutedEventArgs e)
        {
            _dealer = new Deck(1, 13, GameShape.Game);

            _dealer.Shuffle(5);
            _dealer.MakeAllCardsDragable(false);
            _dealer.Enabled = true;
            _dealer.FlipAllCards();

            var pbn = Pbn.Text;

            // collection cards if any are out
            if (_dealer.Cards.Count < 52)
            {
                CollectCards();
            }
            _dealer.Shuffle(5);

            // deal 13 cards to each of the four players
            for (var cardCount = 0; cardCount < CardsPerPlayer; cardCount++)
            {
                _dealer.Draw(Player1Hand.Deck, 1);
                _dealer.Draw(Player2Hand.Deck, 1);
                _dealer.Draw(Player3Hand.Deck, 1);
                _dealer.Draw(Player4Hand.Deck, 1);
            }

            // turn over human player [4] hand
            Player4Hand.Deck.Sort();
            Player4Hand.Deck.MakeAllCardsDragable(true);
            Player4Hand.Deck.FlipAllCards();
        }