internal void LoopMenu()
        {
            Init();
            bool exit = false;

            while (!exit)
            {
                Console.WriteLine(ClientUI.Title(clientUsername));
                int option = Menus.ClientControllerLoopMenu();
                if (option == 4)
                {
                    exit = true;
                }
                MapOptionToActionOfMainMenu(option);
                if (!exitGame)
                {
                    ClientUI.Clear();
                }
                if (exitGame)
                {
                    ClientUI.ClearBoard();
                }
                exitGame = false;
            }
        }
        private void Play()
        {
            exitGame = false;
            timesOut = false;
            LastPlayerWantsToLeave = false;
            int input = Menus.SelectRoleMenu();

            input--;
            string role = "";

            if (input == 0)
            {
                role = "Monster";
            }
            if (input == 1)
            {
                role = "Survivor";
            }
            if (input == 2)
            {
                goto End;
            }

            SocketConnection.SendMessage(BuildRequest(Command.SelectRole, role));

            var response = new Response(SocketConnection.ReadMessage());

            if (response.HadSuccess())
            {
                Console.WriteLine("You are now a " + role);
                ClientUI.Clear();
                JoinGame();
                goto End;
            }
            else
            {
                Console.WriteLine(response.ErrorMessage());
            }
            End :;
        }
 private void Init()
 {
     Console.WriteLine(ClientUI.Title());
     ConnectToServer();
     ClientUI.Clear();
 }
        private void JoinGame()
        {
            SocketConnection.SendMessage(BuildRequest(Command.JoinGame));

            var response = new Response(SocketConnection.ReadMessage());

            if (response.HadSuccess())
            {
                BoardUI.DrawBoard(clientUsername, response.GetPlayerPosition());
                Console.WriteLine("Action: ");

                if (timer == null)
                {
                    timer = new Thread(() => TimesOut());
                    timer.Start();
                }

                while (!exitGame && !timesOut)
                {
                    string myAction = Input.RequestInput();

                    if (timesOut)
                    {
                        goto End;
                    }

                    if (myAction.Equals("exit"))
                    {
                        RemovePlayerFromGame();
                        exitGame = true;
                    }
                    else
                    {
                        SocketConnection.SendMessage(BuildRequest(Command.DoAction, myAction));

                        var sendActionResponse = new Response(SocketConnection.ReadMessage());

                        if (sendActionResponse.HadSuccess())
                        {
                            List <string> actionResponse = sendActionResponse.GetDoActionResponse();
                            RefreshBoard(actionResponse);
                            ShowIfGameFinished(actionResponse, false);
                        }
                        else if (sendActionResponse.IsInvalidAction())
                        {
                            Console.WriteLine(sendActionResponse.ErrorMessage());
                            Console.WriteLine("Action: ");
                        }
                        else if (sendActionResponse.PlayerIsDead())
                        {
                            Console.WriteLine(sendActionResponse.ErrorMessage());
                            string st = AskServerIfGameHasFinished();
                            if (st != "GameFinished")
                            {
                                Console.WriteLine("Please wait until game has finished. Type any key to continue...");
                            }
                            else
                            {
                                goto End;
                            }
                        }
                        else
                        {
                            Console.WriteLine(sendActionResponse.ErrorMessage());
                            RemovePlayerFromGame();
                        }
                    }
                }
                ClientUI.Clear();
            }
            else if (response.GameIsFull())
            {
                Console.WriteLine(response.ErrorMessage());
            }
            else
            {
                Console.WriteLine(response.ErrorMessage());
                string aux = AskServerIfGameHasFinished();
            }
            End :;
        }