Example #1
0
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            List <PlayerWrapper> selectedWrappers = new List <PlayerWrapper>();

            foreach (var item in listBox2.SelectedItems)
            {
                PlayerWrapper temp = (PlayerWrapper)item;
                selectedWrappers.Add(temp);
            }
            if (selectedWrappers.Count == 1)
            {
                teams[selectedWrappers[0].TeamNumber - 1].RemoveMember(selectedWrappers[0].Player);
                listBox2.Items.Remove(selectedWrappers[0]);
                listBox1.Items.Add(selectedWrappers[0].Player);
                checkTeams();
            }
            checkLists();
        }
Example #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            int race = 0;

            if (radioButtonTerran.Checked)
            {
                race = Constants.Terran;
            }
            else if (radioButtonZerg.Checked)
            {
                race = Constants.Zerg;
            }
            else if (radioButtonProtoss.Checked)
            {
                race = Constants.Protoss;
            }
            else if (radioButtonRandom.Checked)
            {
                race = Constants.Random;
            }
            List <Player> selectedHumanPlayers = new List <Player>();

            foreach (var item in listBox1.SelectedItems)
            {
                Player temp = (Player)item;
                selectedHumanPlayers.Add(temp);
            }
            if (selectedHumanPlayers.Count == 1)
            {
                teams[(int)numericUpDownTeam.Value - 1].addMember(selectedHumanPlayers[0], race);
                PlayerWrapper playerWrapper = new PlayerWrapper(selectedHumanPlayers[0], race, (int)numericUpDownTeam.Value);
                listBox1.Items.Remove(selectedHumanPlayers[0]);
                listBox2.Items.Add(playerWrapper);
                checkTeams();
            }
            checkLists();
        }
Example #3
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     int race = 0;
     if (radioButtonTerran.Checked)
     {
         race = Constants.Terran;
     }
     else if (radioButtonZerg.Checked)
     {
         race = Constants.Zerg;
     }
     else if (radioButtonProtoss.Checked)
     {
         race = Constants.Protoss;
     }
     else if (radioButtonRandom.Checked)
     {
         race = Constants.Random;
     }
     List<Player> selectedHumanPlayers = new List<Player>();
     foreach (var item in listBox1.SelectedItems)
     {
         Player temp = (Player) item;
         selectedHumanPlayers.Add(temp);
     }
     if (selectedHumanPlayers.Count == 1)
     {
         teams[(int)numericUpDownTeam.Value - 1].addMember(selectedHumanPlayers[0], race);
         PlayerWrapper playerWrapper = new PlayerWrapper(selectedHumanPlayers[0], race, (int)numericUpDownTeam.Value);
         listBox1.Items.Remove(selectedHumanPlayers[0]);
         listBox2.Items.Add(playerWrapper);
         checkTeams();
     }
     checkLists();
 }