Пример #1
0
        public void requestMove(NetworkMessage boardMsg)
        {
            byte[] bytes = boardMsg.reader.ReadBytesAndSize();
            CommProtocol.StringMessage msg = Deserialize <Game.CommProtocol.StringMessage> (bytes);

            lastRawBoard = msg.msg;
            string formattedBoard = Connect4JsonParser.formatBoardMsgFromServer(msg.msg, msg.color);

            ClientPlayersHandler.onReceiveServerMsg(formattedBoard, msg.color);
        }
Пример #2
0
        public void handleGameStatus(NetworkMessage gameStatusMsg)
        {
            byte[]   bytes = gameStatusMsg.reader.ReadBytesAndSize();
            GameInfo msg   = Deserialize <GameInfo> (bytes);

            if (msg.gameOver && isGameOver == false)
            {
                BoardState finalState = getFinalState(msg.winnerColor);
                TCPLocalConnection.sendMessage(Connect4JsonParser.formatBoardMsgFromServer(lastRawBoard, msg.myColor, finalState));
                localRenderer.onGameOver(msg.winnerColor == PlayerColor.Yellow ? Piece.Yellow : Piece.Red);

                gameOver();
                CurrentGame.gameOver(getGameOverText(msg.winnerColor));
            }
        }