Esempio n. 1
0
        private void btnStartBattle_Click(object sender, System.EventArgs e)
        {
            int nLength = lsbSelectedRobots.Items.Count;

            RobotListItem[] pRobots = new RobotListItem[nLength];
            for (int i = 0; i < nLength; i++)
            {
                pRobots[i] = (RobotListItem)lsbSelectedRobots.Items[i];
            }
            m_pParent.CreateBattle(pRobots, 3);
            Close();
        }
Esempio n. 2
0
		public Battle(frmMain pParentForm, Size tBattleFieldSize, RobotListItem[] pRobots, int nNumRounds)
		{
			m_pParentForm = pParentForm;
			m_nNumRounds = nNumRounds;
			m_tBattleFieldSize = tBattleFieldSize;

			m_nNumRobots = pRobots.Length;
			m_pRobots = new Robot[m_nNumRobots];
			m_pThreads = new Thread[m_nNumRobots];

			m_pWinners = new ArrayList();

			m_pRobotList = pRobots;

			m_nRoundNum = 1;

			CreateRound();
		}
Esempio n. 3
0
		private void btnStartBattle_Click(object sender, System.EventArgs e)
		{
			int nLength = lsbSelectedRobots.Items.Count;
			RobotListItem[] pRobots = new RobotListItem[nLength];
			for (int i = 0; i < nLength; i++)
			{
				pRobots[i] = (RobotListItem) lsbSelectedRobots.Items[i];
			}
			m_pParent.CreateBattle(pRobots, 3);
			Close();
		}
Esempio n. 4
0
		private void AddRange(ListBox pListBox, RobotListItem[] pItems)
		{
			int nLength = pItems.Length;
			for (int i = 0; i < nLength; i++)
			{
				pListBox.Items.Add(pItems[i]);
			}
		}
Esempio n. 5
0
		public void CreateBattle(RobotListItem[] pRobots, int nNumRounds)
		{
			m_pBattle = new Battle(this, pnlBattleGround.ClientSize, pRobots, nNumRounds);

			for (int i = 0; i < m_pBattle.Robots.Length; i++)
			{
				cboRobots.Items.Add(m_pBattle.Robots[i].Name);
			}
			cboRobots.SelectedIndex = 0;
		}
Esempio n. 6
0
		private string GetName(Type pType, int nIndex, RobotListItem[] pRobots)
		{
			int nLength = pRobots.Length;
			int nCounter = 1;
			bool bMultiple = false;
			for (int i = 0; i < nLength; i++)
			{
				if (pRobots[i].Name == pType.Name)
				{
					bMultiple = true;
					if (i < nIndex) nCounter++;
				}
			}
			if (!bMultiple)
			{
				return pType.Name;
			}
			else
			{
				return pType.Name + " (" + nCounter +  ")";
			}
		}