public void handleGameInfo(NetworkMessage msg)
        {
            byte[]   bytes   = msg.reader.ReadBytesAndSize();
            GameInfo infoMsg = Game.ClientController.Deserialize <GameInfo> (bytes);;

            if (infoMsg.gameOver)
            {
                string gameOverString = TCP_API.APIStandardConstants.Fields.gameOver;
                TCPLocalConnection.sendMessage(gameOverString);
                isGameOver = true;
                UnetRoomConnector.shutdownCurrentConnection();

                string gameOverMsg;
                if (infoMsg.winnerColor == Game.PlayerColor.None)
                {
                    gameOverMsg = "It's a draw!";
                }
                else
                {
                    gameOverMsg = infoMsg.winnerColor + " won";
                }

                CurrentGame.gameOver(gameOverMsg);
            }
        }
        public void handleGameInfoMsg(NetworkMessage initMsg)
        {
            GameInfo msg = Deserialize <GameInfo> (initMsg.reader.ReadBytesAndSize());

            if (msg.gameOver)
            {
                isGameOver        = true;
                canSendServerMsg  = false;
                isListeningForTCP = false;


                UnetRoomConnector.shutdownCurrentConnection();

                string gameOverString = TCP_API.APIStandardConstants.Fields.gameOver;
                string gameOverMsg;
                //Debug.LogError ("Winner: " + msg.winnerColor);
                if (msg.winnerColor == Game.PlayerColor.None)
                {
                    gameOverMsg = "It's a draw!";
                    TCPLocalConnection.sendMessage(gameOverString + ": 0");
                }
                else
                {
                    gameOverMsg = msg.winnerColor + " won";
                    TCPLocalConnection.sendMessage(gameOverString + ": " + (msg.winnerColor == PlayerColor.Blue ? "1" : "-1"));
                }
                CurrentGame.gameOver(gameOverMsg);
            }
        }
Beispiel #3
0
 public void gameOver()
 {
     isGameOver       = true;
     canSendServerMsg = false;
     UnetRoomConnector.shutdownCurrentConnection();
     localGameUI.stopAllTimers();
     ClientPlayersHandler.killBots();
 }
Beispiel #4
0
 public static void restartCurrentGame()
 {
     UnetRoomConnector.shutdownCurrentConnection();
     Msf.Connection.SendMessage((short)ServerCommProtocl.RestartTrainingGame, gameSpecs.roomID, Msf.Helper.handleErrorResponse);
 }