コード例 #1
0
        public bool Discard(PlayingCard Discarded)
        {
            // Find a card and put it in the discard pile.
            bool        result = false;
            PlayingCard deckCard;

            try
            {
                // Search by card name.
                deckCard              = cCurrentDeck.Find(p => p.CardName == Discarded.CardName);
                deckCard.Assigned     = CardAssignment.DiscardPile;
                deckCard.PlayerAssign = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
コード例 #2
0
        public bool ShuffleDeck(ImageList newDeck)
        {
            // Initialize an entire new deck from ImageList.
            bool        result = false;
            PlayingCard pCard;

            cCurrentDeck.Clear();
            try
            {
                foreach (string card in newDeck.Images.Keys)
                {
                    pCard          = new PlayingCard();
                    pCard.Assigned = CardAssignment.ActiveDeck;
                    pCard.CardName = card;
                    cCurrentDeck.Add(pCard);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }