Example #1
0
 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)));
     }
 }
Example #2
0
        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)));
            }
        }
Example #3
0
        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)));
            }
        }
Example #4
0
 public static void DisconnectResponse(Player player)
 {
     SocketHelper.WriteToPlayer(player, Encapsulation.Serialize(Encapsulation.FromValue(new GenericMessage {
         Message = "See you later :)"
     }, MessageType.Disconnect)));
 }
Example #5
0
 public static void DiscoverResponse(Player player)
 {
     SocketHelper.WriteToPlayer(player, Encapsulation.Serialize(Encapsulation.FromValue(new GenericMessage {
         Message = "Give me your informations"
     }, MessageType.Discover)));
 }