public void CopyTo(Cards targetCards) { for(int index = 0; index < this.Count; index++) { targetCards[index] = this[index]; } }
public Game() { currentCard = 0; playDeck = new Deck(true); playDeck.LastCardDrawn += new LastCardDrawnHandler(Reshuffle); playDeck.Shuffle(); discardedCards = new Cards(); }
public Object Clone() { Cards newCards = new Cards(); foreach (Card sourceCard in List) { newCards.Add(sourceCard.Clone() as Card); } return newCards; }
public Player(string newName) { name = newName; hand = new Cards(); }
public void Shuffle() { //Card[] newDeck = new Card[52]; Cards newDeck = new Cards(); bool[] assigned = new bool[52]; Random sourceGen = new Random(); for(int i = 0; i < 52; i++) { int sourceCard = 0; bool foundCard = false; while (foundCard == false) { sourceCard = sourceGen.Next(52); if (assigned[sourceCard] == false) foundCard = true; } assigned[sourceCard] = true; //newDeck[sourceCard] = cards[i]; newDeck.Add(cards[sourceCard]); } newDeck.CopyTo(cards); }
private Deck(Cards newCards) { cards = newCards; }
public CardOutOfRangeException(Cards sourceDeckContens) : base("В колоде имеется лишь 52 карты!") { deckContens = sourceDeckContens; }