예제 #1
0
        private static void SendUpdatedGamesList(List <Message> result)
        {
            var clientConnectedMessage = new ClientConnectedMessage();

            clientConnectedMessage.Games = GameManager.RecieveAllGames();
            result.Add(clientConnectedMessage);
        }
예제 #2
0
        private static List <Message> HandleRetrieveAllGamesMessage(Message message)
        {
            var result = new List <Message>();
            var clientConnectedMessage = message as ClientConnectedMessage;

            clientConnectedMessage.Games = GameManager.RecieveAllGames();
            result.Add(clientConnectedMessage);

            return(result);
        }
예제 #3
0
        private static List <Message> HandleClientConnectedMessage(Message message, string userId)
        {
            var result = new List <Message>();
            var clientConnectedMessage = message as ClientConnectedMessage;

            if (!AbstractPlayers.Select(p => p.Id).Contains(userId))
            {
                AbstractPlayers.Add(new Player
                {
                    Id   = userId,
                    Name = message.Login
                });
            }

            clientConnectedMessage.Games = GameManager.RecieveAllGames();

            result.Add(clientConnectedMessage);
            return(result);
        }