Exemple #1
0
        public static AskForCardChoiceResponse Parse(int id, List <List <Card> > cards, int optionId, int wrtPlayerId)
        {
            AskForCardChoiceResponse response = new AskForCardChoiceResponse();

            response.Id = id;
            if (cards == null)
            {
                response.CardItems = null;
            }
            else
            {
                var cardItems = new List <List <CardItem> >();
                foreach (var cardDeck in cards)
                {
                    Trace.Assert(cardDeck != null);
                    if (cardDeck == null)
                    {
                        continue;
                    }
                    var items = new List <CardItem>();
                    foreach (var card in cardDeck)
                    {
                        items.Add(CardItem.Parse(card, wrtPlayerId));
                    }
                    cardItems.Add(items);
                }
                response.CardItems = NestedCardList.Parse(cardItems);
            }
            response.OptionId = optionId;
            return(response);
        }
Exemple #2
0
        public static NestedCardList Parse(List <List <CardItem> > cardList)
        {
            if (cardList == null)
            {
                return(null);
            }
            NestedCardList ncl = new NestedCardList();

            ncl.ListSizes    = new List <int>();
            ncl.AllCardItems = new List <CardItem>();
            foreach (var cards in cardList)
            {
                ncl.ListSizes.Add(cards.Count);
                ncl.AllCardItems.AddRange(cards);
            }
            return(ncl);
        }
Exemple #3
0
 public static NestedCardList Parse(List<List<CardItem>> cardList)
 {
     if (cardList == null) return null;
     NestedCardList ncl = new NestedCardList();
     ncl.ListSizes = new List<int>();
     ncl.AllCardItems = new List<CardItem>();
     foreach (var cards in cardList)
     {
         ncl.ListSizes.Add(cards.Count);
         ncl.AllCardItems.AddRange(cards);
     }
     return ncl;
 }