// receive all cards from another container, empty the donor public void AcceptAllCards(CardContainer container) { if (container != null) { foreach (Card card in container.m_Cards) { AcceptCard(card); } container.ClearCards(); } }
// empty all containers, including the main deck public void ClearDecks() { m_Deck.ClearCards(); m_Stock.ClearCards(); m_Waste.ClearCards(); m_HomeHeart.ClearCards(); m_HomeDiamond.ClearCards(); m_HomeSpade.ClearCards(); m_HomeClub.ClearCards(); if (m_StackStock[0] == null) { // the chutes haven't been created yet, do it now for (int i = 0; i < m_StackStock.Length; i++) { m_StackStock[i] = new CardContainer(150 + i * 50, 140); m_StackChute[i] = new CardContainer(150 + i * 50, 150); } } else { // empty the existing chutes for (int i = 0; i < m_StackStock.Length; i++) { m_StackStock[i].ClearCards(); m_StackChute[i].ClearCards(); } } }