コード例 #1
0
        public void SelectCards()
        {
            if (this.State != GameState.CardSelection)
            {
                throw new GameCreationException("This method can only be called during CardSelection!");
            }

            if (_Table != null)
            {
                _Table.TearDown();
            }

            this.CardsAvailable = Cards.CardCollection.GetAllCards(c => IsCardAllowed(c));
            Cards.CardCollection _CardsChosen = new Cards.CardCollection();

            if (this.Settings.Preset != null)
            {
                _CardsChosen = this.Settings.Preset.Cards;
            }
            else if (this.Settings.Constraints != null)
            {
                _CardsChosen.AddRange(this.Settings.Constraints.SelectCards(this.CardsAvailable, 10));
            }

            this.CardsAvailable.RemoveAll(card => _CardsChosen.Contains(card));
            _Table = new Table(this, this.Players.Count);
            _CardsChosen.ForEach(c => _Table.AddKingdomSupply(_Players, c.CardType));

            // should now have a list of cards that can be drawn from for things like Bane supplies

            _Table.SetupSupplies(this);
        }
コード例 #2
0
        private static List <Type> GetAllSerializingTypes(Cards.CardCollection cards)
        {
            List <Type> typeDict = new List <Type>()
            {
                typeof(Cards.Cost), typeof(Cards.Group), typeof(Cards.Category)
            };

            cards.ForEach(c => typeDict.AddRange(c.GetSerializingTypes()));
            return(typeDict);
        }