Esempio n. 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);
        }
Esempio n. 2
0
 public void SendCardChoice(ICardChoiceVerifier verifier, List <List <Card> > answer, AdditionalCardChoiceOptions options)
 {
     for (int i = 0; i < server.MaxClients; i++)
     {
         int j = 0;
         if (answer != null)
         {
             foreach (var cards in answer)
             {
                 foreach (Card c in cards)
                 {
                     if (verifier.Helper != null && (verifier.Helper.RevealCards || (verifier.Helper.AdditionalFineGrainedCardChoiceRevealPolicy != null && verifier.Helper.AdditionalFineGrainedCardChoiceRevealPolicy[j])))
                     {
                         if (c.Place.DeckType != DeckType.Equipment && c.Place.DeckType != DeckType.DelayedTools)
                         {
                             c.RevealOnce = true;
                         }
                     }
                 }
                 j++;
             }
         }
         server.SendPacket(i, AskForCardChoiceResponse.Parse(proxy.QuestionId, answer, options == null? 0 : options.OptionResult, i));
     }
 }
Esempio n. 3
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;
 }
Esempio n. 4
0
        public void TryAskForCardChoice(Prompt prompt, List <DeckPlace> sourceDecks, List <string> resultDeckNames, List <int> resultDeckMaximums, ICardChoiceVerifier verifier, AdditionalCardChoiceOptions options, CardChoiceRearrangeCallback callback)
        {
            List <List <Card> > answer;

            if (!IsPlayable)
            {
                if (IsUiDetached)
                {
                    return;
                }
                uiProxy.AskForCardChoice(prompt, sourceDecks, resultDeckNames, resultDeckMaximums, verifier, out answer, options, callback);
                return;
            }
            if (IsUiDetached || !uiProxy.AskForCardChoice(prompt, sourceDecks, resultDeckNames, resultDeckMaximums, verifier, out answer, options, callback) ||
                answer == null)
            {
                Trace.TraceInformation("Invalid answer");
                client.Send(AskForCardChoiceResponse.Parse(numQuestionsAsked, null, 0, client.SelfId));
            }
            else
            {
                client.Send(AskForCardChoiceResponse.Parse(numQuestionsAsked, answer, options == null ? 0 : options.OptionResult, client.SelfId));
            }
        }