示例#1
0
        public void PlayCard(Card card)
        {
            if (card.IsPlayed)
                throw new InvalidOperationException("This card has been player before.");

            if (_round == null)
            {
                _round = new Round { BaseSuit = card.Suit };
                _round.RoundClosed += OnRoundClosed;
            }

            card.IsPlayed = true;
            var player = _cardsPlayers[card];
            _eventHandlerList[CardPlayedConstant].SafelyInvoke(this, new CardPlayerArgs
                                                                         {
                                                                             Card = card,
                                                                             Player = player,
                                                                             NextPlayer =
                                                                                 _players[
                                                                                     (_players.IndexOf(player) + 1) % 4]
                                                                         });
            _round.PlayCard(card);
        }
示例#2
0
 public void PlayCard(Card card)
 {
     _cards.Add(card);
     if (_cards.Count == 4 && RoundClosed != null)
         RoundClosed(this);
 }