コード例 #1
0
        public void SelectRole(Connection connection, Request request)
        {
            try
            {
                Client loggedClient = CurrentClient(request);

                string role = request.Role();

                gameLogic.SelectRole(loggedClient, role);

                connection.SendMessage(BuildResponse(ResponseCode.Ok));
            }
            catch (ClientNotConnectedException e)
            {
                connection.SendMessage(BuildResponse(ResponseCode.Unauthorized, e.Message));
            }
            catch (NoMonstersInGameException e)
            {
                connection.SendMessage(BuildResponse(ResponseCode.BadRequest, e.Message));
            }
        }