public static void WinAndLoseResponse(Game game)
 {
     foreach (Player player in game.players)
     {
         WinStatus winStatus = getGameResult(game, player);
         SocketHelper.WriteToPlayer(player, Encapsulation.Serialize(Encapsulation.FromValue(new GameEnd {
             PlayerWinStatus = winStatus
         }, MessageType.GameEnd)));
     }
 }
        public static void GameInfoResponse(Game game)
        {
            Guid roundGuid = Guid.NewGuid();

            foreach (Player player in game.players)
            {
                SocketHelper.WriteToPlayer(player, Encapsulation.Serialize(Encapsulation.FromValue(new GameInfo {
                    playerId = player.id, UniqueId = game.UniqueId, FirstRoundGuid = roundGuid, BestOf = game.BestOf, BestOfScore = 0, TimeToAnswer = game.TimeToAnswer, EnnemyName = game.players.FirstOrDefault(p => p.id != player.id).name
                }, MessageType.GameInfo)));
            }
        }
        public static void NextRoundResponse(Game game)
        {
            Guid roundGuid = Guid.NewGuid();

            foreach (Player player in game.players)
            {
                WinStatus winStatus = getGameResult(game, player);
                SocketHelper.WriteToPlayer(player, Encapsulation.Serialize(Encapsulation.FromValue(new RoundInfo {
                    UniqueId = roundGuid, PlayerWinStatus = winStatus
                }, MessageType.NextRound)));
            }
        }
 public static void AnswerResponse(TcpClients client, Choice playerChoice, int TimeToAnswer)
 {
     SocketHelper.WriteToServer(client, Encapsulation.Serialize(Encapsulation.FromValue(new Answer {
         GameId = GameInfo.UniqueId, RoundId = GameInfo.RoundGuid, TimeToAnswer = TimeToAnswer, playerChoice = playerChoice
     }, MessageType.Answer)));
 }
 public static void SearchingResponse(TcpClients client)
 {
     SocketHelper.WriteToServer(client, Encapsulation.Serialize(Encapsulation.FromValue(new GenericMessage {
         Message = "Looking for a game"
     }, MessageType.Searching)));
 }
 public static void DiscoverResponse(TcpClients client)
 {
     SocketHelper.WriteToServer(client, Encapsulation.Serialize(Encapsulation.FromValue(new Discover {
         UserName = Environment.UserName
     }, MessageType.Discover)));
 }
 public static void DisconnectMessage(TcpClients client)
 {
     SocketHelper.WriteToServer(client, Encapsulation.Serialize(Encapsulation.FromValue(new GenericMessage {
         Message = "Disconnect"
     }, MessageType.Disconnect)));
 }
 public static void DisconnectResponse(Player player)
 {
     SocketHelper.WriteToPlayer(player, Encapsulation.Serialize(Encapsulation.FromValue(new GenericMessage {
         Message = "See you later :)"
     }, MessageType.Disconnect)));
 }
 public static void DiscoverResponse(Player player)
 {
     SocketHelper.WriteToPlayer(player, Encapsulation.Serialize(Encapsulation.FromValue(new GenericMessage {
         Message = "Give me your informations"
     }, MessageType.Discover)));
 }