Esempio n. 1
0
        private void AddPlayerButton_Click(object sender, EventArgs e)
        {
            string currentUserName = UserNameTextBox.Text;

            if (currentUserName == "")
            {
                MessageBox.Show("Please enter a Name");
                return;
            }
            if (!PlayerList.DoesPlayerExist(currentUserName))
            {
                listBox1.Items.Add(PlayerList.NumberOfPlayers + ")  " + currentUserName);
                Player newPlayer = new Player(currentUserName);
                PlayerList.AddPlayerInVector(newPlayer);

                UserNameTextBox.Clear();
                if (PlayerList.IsGameFull())
                {
                    AddPlayerButton.Hide();
                    UserNameTextBox.Hide();
                }

                if (PlayerList.AreEnoughPlayers())
                {
                    StartButton.Show();
                }
            }
            else
            {
                MessageBox.Show("This username is already used");
            }
        }
Esempio n. 2
0
        void SetupMethod()
        {
            AddPlayerButton.Show();
            NameLabel.Show();
            NameField.Show();
            DoneButton.Show();

            CurrentGame.Setup();

            DoneButton.Hide();
            AddPlayerButton.Hide();
            NameLabel.Hide();
            NameField.Hide();
            SetupGameButton.Hide();
            RunGameButton.Show();
        }