Parse() 공개 정적인 메소드

public static Parse ( Sanguosha.Core.Cards.Card card, int wrtPlayerId ) : CardItem
card Sanguosha.Core.Cards.Card
wrtPlayerId int
리턴 CardItem
예제 #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);
        }
예제 #2
0
        public static AskForCardUsageResponse Parse(int id, ISkill skill, List <Card> cards, List <Player> players, int wrtPlayerId)
        {
            AskForCardUsageResponse response = new AskForCardUsageResponse();

            response.Id        = id;
            response.SkillItem = SkillItem.Parse(skill);
            if (cards == null)
            {
                response.CardItems = null;
            }
            else
            {
                response.CardItems = new List <CardItem>();
                foreach (var card in cards)
                {
                    response.CardItems.Add(CardItem.Parse(card, wrtPlayerId));
                }
            }
            if (players == null)
            {
                response.PlayerItems = null;
            }
            else
            {
                response.PlayerItems = new List <PlayerItem>();
                foreach (var player in players)
                {
                    response.PlayerItems.Add(PlayerItem.Parse(player));
                }
            }
            return(response);
        }