示例#1
0
        public virtual void AddCard(Card card)
        {
            CardLine line = lineCollection
                            .Where(p => p.Card.CardNumber == card.CardNumber)
                            .FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CardLine
                {
                    Card     = card,
                    Quantity = 1
                });
            }
            else
            {
                if (line.Card.CardType == "Extra Battler" || line.Card.CardType == "Extra Action")
                {
                    if (line.Quantity < 1)
                    {
                        line.Quantity++;
                    }
                }
                else if (line.Quantity < 3)
                {
                    line.Quantity++;
                }
            }
        }
示例#2
0
        public virtual void RemoveCard(Card card)
        {
            CardLine line = lineCollection
                            .Where(p => p.Card.CardNumber == card.CardNumber)
                            .FirstOrDefault();

            if (line != null)
            {
                if (line.Quantity > 0)
                {
                    line.Quantity--;
                }
                if (line.Quantity <= 0)
                {
                    RemoveLine(line.Card);
                }
            }
        }