Ejemplo n.º 1
0
        // Get deck for player1 -- player2 only if Single player
        public void ProcessGetDeck(NetworkResponse response)
        {
            ResponseGetDeck args      = response as ResponseGetDeck;
            int             numFields = args.numFields;
            int             numCards  = args.numCards;
            DeckData        deck      = args.deck;

            //CardData card = deck.popCard();

            GameManager.player1.setDeck(deck);
            GameManager.player1.dealCard(3);
            // Don't allow player1 to move cards until they hasDeck
            GameManager.player1.hasDeck = true;
            GameManager.player2.dealDummyCard(3);
            // Only deal cards for opponent if
            if (Constants.SINGLE_PLAYER)
            {
                Debug.Log("Deal player2 Cards");
                GameManager.player2.setDeck(deck);
                GameManager.player2.dealCard(3);
            }

            Debug.Log("Protocols Deck Response: deck count: " + deck.getSize() +
                      " numCards: " + numCards + " num fields: " + numFields);
            //Debug.Log ("Card data: cardID: " + card.cardID + " diet Type: " +
            //          card.dietType + " SpeciesName: " + card.speciesName);
        }
Ejemplo n.º 2
0
        public void ProcessGetDeck(NetworkResponse response)
        {
            ResponseGetDeck args      = response as ResponseGetDeck;
            int             numFields = args.numFields;
            int             numCards  = args.numCards;
            DeckData        deck      = args.deck;
            CardData        card      = deck.popCard();

            Debug.Log("Deck Response: deck count: " + deck.getSize() +
                      " numCards: " + numCards + " num fields: " + numFields);
            Debug.Log("Card data: cardID: " + card.cardID + " diet Type: " +
                      card.dietType + " SpeciesName: " + card.speciesName);
        }
Ejemplo n.º 3
0
        public static NetworkResponse Parse(MemoryStream dataStream)
        {
            ResponseGetDeck response = new ResponseGetDeck();

            response.numCards  = DataReader.ReadInt(dataStream);
            response.numFields = DataReader.ReadInt(dataStream);

            for (int i = 0; i < response.numCards; i++)
            {
                int    cardID      = DataReader.ReadInt(dataStream);
                int    health      = DataReader.ReadInt(dataStream);
                int    attack      = DataReader.ReadInt(dataStream);
                int    level       = DataReader.ReadInt(dataStream);
                int    dietType    = DataReader.ReadInt(dataStream);
                string speciesName = DataReader.ReadString(dataStream);
                string description = DataReader.ReadString(dataStream);
                response.deck.pushCard(new CardData(cardID, health, attack, level,
                                                    dietType, speciesName, description));
            }
            response.deck.setBuilt(true);
            return(response);
        }
Ejemplo n.º 4
0
        public static NetworkResponse Parse(MemoryStream dataStream)
        {
            ResponseGetDeck response = new ResponseGetDeck();
            response.numCards =  DataReader.ReadInt(dataStream);
            response.numFields = DataReader.ReadInt (dataStream);

            for (int i = 0; i < response.numCards; i++){

            int cardID = DataReader.ReadInt (dataStream);
            int health = DataReader.ReadInt (dataStream);
            int attack = DataReader.ReadInt (dataStream);
            int level = DataReader.ReadInt (dataStream);
            int dietType = DataReader.ReadInt(dataStream);
            string speciesName = DataReader.ReadString(dataStream);
            string description = DataReader.ReadString (dataStream);
            response.deck.pushCard(new CardData(cardID, health, attack, level,
                                                dietType, speciesName, description));

            }
            response.deck.setBuilt(true);
            return response;
        }