Esempio n. 1
0
        protected void GetHandCallback(Request request, ActionsSerializer response, object additionalData)
        {
            SendGetHandRequest = false;
            var data = new GetHandActionResponseSerializer(response.Actions[0].ActionData);

            data.Validate();

            int  index = 0;
            Card tmp;
            var  player = Game.GetPlayerAt(Position);

            List <int> C = new List <int>();
            List <int> D = new List <int>();
            List <int> H = new List <int>();
            List <int> S = new List <int>();

            foreach (var card in data.Cards)
            {
                tmp = new Card(
                    (CardFigure)card.Figure,
                    (CardColor)card.Color,
                    Position,
                    (CardState)card.State
                    );

                player.Hand[index] = tmp;
                index++;

                if (card.Color + 1 == 1)
                {
                    C.Add(card.Figure);
                }

                if (card.Color + 1 == 2)
                {
                    D.Add(card.Figure);
                }

                if (card.Color + 1 == 3)
                {
                    H.Add(card.Figure);
                }

                if (card.Color + 1 == 4)
                {
                    S.Add(card.Figure);
                }

                AILogic = new AI(C, D, H, S);
            }
        }
Esempio n. 2
0
        protected void GetGrandpaHandCallback(Request request, ActionsSerializer response, object additionalData)
        {
            var data = new GetHandActionResponseSerializer(response.Actions[0].ActionData);

            data.Validate();


            int  index = 0;
            Card tmp;
            var  player = Game.GetPlayerAt((PlayerTag)(((int)Position + 2) % 4));

            List <int> C = new List <int>();
            List <int> D = new List <int>();
            List <int> H = new List <int>();
            List <int> S = new List <int>();

            foreach (var card in data.Cards)
            {
                tmp = new Card(
                    (CardFigure)card.Figure,
                    (CardColor)card.Color,
                    (PlayerTag)(((int)Position + 2) % 4),
                    (CardState)card.State
                    );
                if (card.Color + 1 == 1)
                {
                    C.Add(card.Figure);
                }

                if (card.Color + 1 == 2)
                {
                    D.Add(card.Figure);
                }

                if (card.Color + 1 == 3)
                {
                    H.Add(card.Figure);
                }

                if (card.Color + 1 == 4)
                {
                    S.Add(card.Figure);
                }
                player.Hand[index] = tmp;
                index++;
            }

            AILogic.Grandpa_hand = new AI.Hand(C, D, H, S);
        }
Esempio n. 3
0
        protected void GetGrandpaHandCallback(Request request, ActionsSerializer response, object additionalData)
        {
            var data = new GetHandActionResponseSerializer(response.Actions[0].ActionData);

            data.Validate();
            GrandpaCards = new List <Card>();

            int  index = 0;
            Card tmp;
            var  player = Game.GetPlayerAt((PlayerTag)(((int)Position + 2) % 4));

            foreach (var card in data.Cards)
            {
                tmp = new Card(
                    (CardFigure)card.Figure,
                    (CardColor)card.Color,
                    (PlayerTag)(((int)Position + 2) % 4),
                    (CardState)card.State
                    );
                GrandpaCards.Add(tmp);
                player.Hand[index] = tmp;
                index++;
            }
        }
Esempio n. 4
0
        protected void GetHandCallback(Request request, ActionsSerializer response, object additionalData)
        {
            SendGetHandRequest = false;
            var data = new GetHandActionResponseSerializer(response.Actions[0].ActionData);

            data.Validate();

            int  index = 0;
            Card tmp;
            var  player = Game.GetPlayerAt(Position);

            foreach (var card in data.Cards)
            {
                tmp = new Card(
                    (CardFigure)card.Figure,
                    (CardColor)card.Color,
                    Position,
                    (CardState)card.State
                    );
                MyCards.Add(tmp);
                player.Hand[index] = tmp;
                index++;
            }
        }