public void InitializeStates() { shipList = new List <PlanningShip> { new PlanningShip(5), new PlanningShip(4), new PlanningShip(3), new PlanningShip(3), new PlanningShip(2) }; currentShip = shipList[0]; shipRadioList = new List <RadioButton> { CarrierRadio, BattleshipRadio, CruiserRadio, SubRadio, DestroyerRadio }; CarrierRadio.Checked = true; shipCheckList = new List <Label> { CarrierCheck, BattleshipCheck, CruiserCheck, SubCheck, DestroyerCheck }; HorizontalRadio.Checked = true; //Initialize button grid for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { PlanningButton b = new PlanningButton((short)i, (short)j); b.Name = string.Format("Button{0}{1}", i, j); b.Text = string.Format("{0}{1}", i, j); b.Dock = DockStyle.Fill; PlanningTable.Controls.Add(b, i, j); b.Click += (sender, e) => ShipCoordButton_Click(sender, e, b.xCoord, b.yCoord); } } }
private void DestroyerRadio_CheckedChanged(object sender, EventArgs e) { currentShip = shipList[4]; }
private void CruiserRadio_CheckedChanged(object sender, EventArgs e) { currentShip = shipList[2]; }
private void SubRadio_CheckedChanged(object sender, EventArgs e) { currentShip = shipList[3]; }
private void BattleshipRadio_CheckedChanged(object sender, EventArgs e) { currentShip = shipList[1]; }