Esempio n. 1
0
        void Decrypt()
        {
            byte[] byteArray = AES.DecryptAES128(safeData, encryptionKey);

            SWNetworkMessage message          = new SWNetworkMessage(byteArray);
            byte             poolOfCardsCount = message.PopByte();

            poolOfCards = message.PopByteArray(poolOfCardsCount).ToList();

            byte player1CardsCount = message.PopByte();

            player1Cards = message.PopByteArray(player1CardsCount).ToList();

            byte player2CardsCount = message.PopByte();

            player2Cards = message.PopByteArray(player2CardsCount).ToList();

            byte booksForPlayer1Count = message.PopByte();

            booksForPlayer1 = message.PopByteArray(booksForPlayer1Count).ToList();

            byte booksForPlayer2Count = message.PopByte();

            booksForPlayer2 = message.PopByteArray(booksForPlayer2Count).ToList();

            player1Id = message.PopUTF8ShortString();
            player2Id = message.PopUTF8ShortString();

            currentTurnPlayerId = message.PopUTF8ShortString();
            currentGameState    = message.PopInt32();

            selectedRank = message.PopInt32();
        }
Esempio n. 2
0
        public void ApplyByteArray(Byte[] byteArray)
        {
            SWNetworkMessage message          = new SWNetworkMessage(byteArray);
            byte             poolOfCardsCount = message.PopByte();

            poolOfCards = message.PopByteArray(poolOfCardsCount).ToList();

            byte player1CardsCount = message.PopByte();

            player1Cards = message.PopByteArray(player1CardsCount).ToList();

            byte player2CardsCount = message.PopByte();

            player2Cards = message.PopByteArray(player2CardsCount).ToList();

            numberOfBooksForPlayer1 = message.PopInt32();
            numberOfBooksForPlayer2 = message.PopInt32();

            player1Id = message.PopUTF8ShortString();
            player2Id = message.PopUTF8ShortString();

            currentTurnPlayerId = message.PopUTF8ShortString();
            currentGameState    = message.PopInt32();

            selectedRank = message.PopInt32();
        }
Esempio n. 3
0
        public void On3CardsSelectedRemoteEvent(SWNetworkMessage message)
        {
            /*    int intCard1Rank = message.PopInt32();
             *  int intCard1Suit = message.PopInt32();
             *  int intCard2Rank = message.PopInt32();
             *  int intCard2Suit = message.PopInt32();
             *  int intCard3Rank = message.PopInt32();
             *  int intCard3Suit = message.PopInt32();
             *  int intstring = int.Parse(intCard1Rank.ToString() + intCard1Suit.ToString() + intCard2Rank.ToString() + intCard2Suit.ToString() + intCard3Rank.ToString() + intCard3Suit.ToString());
             */
            byte card1 = message.PopByte();
            byte card2 = message.PopByte();
            byte card3 = message.PopByte();

            On3CardsSelected.Invoke(card1, card2, card3);
        }
Esempio n. 4
0
        public void OnCardPlayedRemoteEvent(SWNetworkMessage message)
        {
            byte value = message.PopByte();

            OnCardPlayed.Invoke(value);
        }
Esempio n. 5
0
        void Decrypt()
        {
            //int retries = 0;
            byte[] byteArray;

            /*while (true)
             * {
             *  try
             *  {
             *      byteArray = AES.DecryptAES128(safeData, encryptionKey);
             *      break;
             *  }
             *  catch (ArgumentNullException e)
             *  {
             *      if (retries < 2)
             *      {
             *          retries++;
             *          SetupVariables();
             *          byteArray = AES.DecryptAES128(safeData, encryptionKey);
             *      }
             *      else
             *          throw;
             *  }
             * }*/

            byteArray = safeData;

            SWNetworkMessage message          = new SWNetworkMessage(byteArray);
            byte             deckOfCardsCount = message.PopByte();

            deckOfCards = message.PopByteArray(deckOfCardsCount).ToList();

            byte player1HandCount = message.PopByte();

            player1Hand = message.PopByteArray(player1HandCount).ToList();

            byte player2HandCount = message.PopByte();

            player2Hand = message.PopByteArray(player2HandCount).ToList();

            byte player3HandCount = message.PopByte();

            player3Hand = message.PopByteArray(player3HandCount).ToList();

            byte player4HandCount = message.PopByte();

            player4Hand = message.PopByteArray(player4HandCount).ToList();

            player1Id = message.PopUTF8ShortString();
            player2Id = message.PopUTF8ShortString();
            player3Id = message.PopUTF8ShortString();
            player4Id = message.PopUTF8ShortString();

            player1Name = message.PopUTF8ShortString();
            player2Name = message.PopUTF8ShortString();
            player3Name = message.PopUTF8ShortString();
            player4Name = message.PopUTF8ShortString();

            player1Team = message.PopInt32();
            player2Team = message.PopInt32();
            player3Team = message.PopInt32();
            player4Team = message.PopInt32();

            player1Bid = message.PopUTF8ShortString();
            player2Bid = message.PopUTF8ShortString();
            player3Bid = message.PopUTF8ShortString();
            player4Bid = message.PopUTF8ShortString();

            currentPlayerId   = message.PopUTF8ShortString();
            playerToSkipId    = message.PopUTF8ShortString();
            highBidPlayerId   = message.PopUTF8ShortString();
            highTrickPlayerId = message.PopUTF8ShortString();
            currentGameState  = message.PopInt32();
            dealer            = message.PopUTF8ShortString();
            trump             = message.PopInt32();
            oppositeTrump     = message.PopInt32();
            ledSuit           = message.PopInt32();
            highBid           = message.PopInt32();
            team1Score        = message.PopInt32();
            team2Score        = message.PopInt32();
            team1Tricks       = message.PopInt32();
            team2Tricks       = message.PopInt32();
            winnerTeam        = message.PopInt32();
            playedCard        = message.PopByte();
            givenCard1        = message.PopByte();
            givenCard2        = message.PopByte();
            givenCard3        = message.PopByte();
            removedCard1      = message.PopByte();
            removedCard2      = message.PopByte();
            removedCard3      = message.PopByte();
            actionCount       = message.PopInt32();
            handCount         = message.PopInt32();
        }