Ejemplo n.º 1
0
        protected void Validate(IIndexable<CardInstance> selectedCards)
        {
            if (selectedCards == null)
            {
                return;
            }

            if (selectedCards.Count == 0)
            {
                throw new InteractionValidationFailException("Zero-length array is not allowed.");
            }
            else if (Mode == SelectMode.Single && selectedCards.Count > 1)
            {
                throw new InteractionValidationFailException("Only one card can be selected.");
            }
            else if (!selectedCards.Unique())
            {
                throw new InteractionValidationFailException("The selected cards has duplicate.");
            }
            else if (selectedCards.Any(card => !Candidates.Contains(card)))
            {
                throw new InteractionValidationFailException("Some of the cards can't be selected.");
            }
        }