コード例 #1
0
    protected virtual void CreatCardUI(int i)
    {
        var card = cardFactory.GetCard(cards[i]);

        card.View.SetParent(transform).SetSortingOrder(i);
        cardsUI.Add(card);
    }
コード例 #2
0
        public IDeck GetDeck(List <Suit> excludedSuits = null, List <Rank> excludedRanks = null,
                             List <int> shuffleSeeds   = null)
        {
            foreach (Suit suit in Enum.GetValues(typeof(Suit)))
            {
                if (excludedSuits == null || !excludedSuits.Contains(suit))
                {
                    foreach (Rank rank in Enum.GetValues(typeof(Rank)))
                    {
                        if (excludedRanks == null || !excludedRanks.Contains(rank))
                        {
                            if (!_cachedCards.Any(a => a.Suit == suit && a.Rank == rank))
                            {
                                _cachedCards.Add(_cardFactory.GetCard(suit, rank));
                            }
                        }
                    }
                }
            }
            var deck = new SimpleDeck(_cachedCards.Where(a => (excludedSuits == null || !excludedSuits.Contains(a.Suit)) && (excludedRanks == null || !excludedRanks.Contains(a.Rank))));

            if (shuffleSeeds == null)
            {
                deck.Shuffle(0);
            }
            else
            {
                foreach (var shuffleSeed in shuffleSeeds)
                {
                    deck.Shuffle(shuffleSeed);
                }
            }
            return(deck);
        }
コード例 #3
0
 public ICard Process(decimal annualSalary)
 {
     //string annualAmount = annualSalary.ToString();
     //ICard card;
     //if (annualSalary < 10000)
     //{
     //    card = new SmartCard(annualAmount, _cardService);
     //}
     //else
     //{
     //    card = new TravelCard(annualAmount, _cardService);
     //}
     //return card;
     return(_cardFactory.GetCard(annualSalary));
 }