public void UpdateForm(Vehicle v, Vehicle.VehicleSection s) { mainForm = (Main)Application.OpenForms[0]; sectionForm = mainForm.SectionForm; selectedVehicle = v; selectedSection = s; if (mainForm.vehicleType == "Aero/Space") { sectionForm.Vf8Chk.Enabled = true; } chasSize = s.secChassis.chasSize; corSize = s.secCore.corSize; sectionForm.buildQualLbl.Text = "Build Quality " + s.quality + " (" + s.buildRoll + ")"; sectionForm.pCPXLbl.Text = "CPX(" + selectedVehicle.pilotCPX + ")"; sectionForm.mCPXLbl.Text = "MCPX(" + selectedVehicle.mechCPX + ")"; v.setTCHS(); v.SetTotalPP(); tCHS = v.tCHS; VehiclePerk.PopPerkList(v); VehicleFlaw.PopFlawList(v); // sectionForm.upDateHPslots(); sectionForm.TotPerkPointLbl.Text = "Total Perk Points: " + v.totalPP.ToString(); sectionForm.TempDescLbl.Text = tempLblBuilder(); sectionForm.spentPPLbl.Text = selectedSection.SectionPPSpent().ToString(); sectionForm.totalPPLbl.Text = selectedVehicle.GetTotalUsedPP().ToString(); sectionForm.pwrCrLbl.Text = "Power Core: " + selectedSection.secCore.corSize.ToString(); HardPoint.updateHP(); VehicleCheck(); SetArmor(); sectionForm.armAdjustTrk.Value = selectedSection.armorAdjust; SetBaseMobillity(); sectionForm.ElecPerkFormSet(); sectionForm.moveLbl.Text = "Move: " + selectedVehicle.GetMove(); sectionForm.costLbl.Text = "Cost: " + selectedVehicle.GetTotalCost().ToString("N") + " Cr"; sectionForm.ShieldsFormSet(); sectionForm.ProtPerkFormSet(); selectedSection.PopSecCompList(); sectionForm.CompartmentSpaceAdjust(); sectionForm.compartmentLayout.Controls.Clear(); sectionForm.sectionCompLayout.Controls.Clear(); foreach (Compartment x in selectedSection.compList) { x.AddCompButton(); x.addButtons(); } sectionForm.BuildElectricSystems(); sectionForm.BuildMiscSystems(); }
public HardPoint(string type) { mainForm = (Main)Application.OpenForms[0]; sectionForm = mainForm.SectionForm; weaponString = type; switch (type) { case "Manipulator Arm": hpSlots = 1; holdHPform = true; ppCost = (.5 * Math.Ceiling(mainForm.selectedSection.secChassis.chasSize)); weaponAbrev = "C-Arm"; break; case "Free Manipulator Arm": hpSlots = 1; weaponString = "Manipulator Arm"; holdHPform = true; ppCost = 0; weaponAbrev = "C-Arm"; break; case "Light HP": hpSlots = 1; ppCost = 2; weaponAbrev = "LHP"; break; case "Medium HP": hpSlots = 2; ppCost = 4; weaponAbrev = "MHP"; break; case "Heavy HP": hpSlots = 4; ppCost = 8; weaponAbrev = "HHP"; break; case "Ultra HP": hpSlots = 8; ppCost = 20; weaponAbrev = "UHP"; break; default: hpSlots = 0; ppCost = 0; break; } HPform(); if (holdHPform) { hpcomboBox.Enabled = false; } mainForm.selectedSection.hpList.Add(this); mainForm.selectedSection.SetHPperkCost(); sectionForm.spentPPLbl.Text = mainForm.selectedSection.SectionPPSpent().ToString(); sectionForm.totalPPLbl.Text = mainForm.selectedVehicle.GetTotalUsedPP().ToString(); hpString = weaponAbrev; //PopHPTbl(); //sectionForm.upDateHPslots(); nrow = new rowCreation(this, mainForm.selectedSection.hpList.Count); //mainForm.selectedSection.sectionLP = sectionForm.refTab ; PopHPTbl(); }
public rowCreation(HardPoint ih, int c) { mainForm = (Main)Application.OpenForms[0]; sectionForm = mainForm.SectionForm; col = c; inHp = ih; hpTypLbl = new Label() { Dock = DockStyle.Fill, Text = inHp.hpString }; weaponSelect = new ComboBox() { Dock = DockStyle.Fill, DisplayMember = "Text", ValueMember = "Value" }; weaponSelect.Items.Add(new { Text = Main.availWeapList[0].Name, Value = Main.availWeapList[0] }); foreach (VehWeapon v in Main.availWeapList) { if (inHp.weaponAbrev == v.HPTYPE) { weaponSelect.Items.Add(new { Text = v.Name, Value = v }); } } if (inHp.VehicleWeapon != null) { weaponSelect.SelectedItem = inHp.VehicleWeapon; weaponSelect.Text = inHp.VehicleWeapon.Name; } else { weaponSelect.SelectedItem = weaponSelect.Items[0]; } weaponSelect.SelectedIndexChanged += new EventHandler(VehWeapon_Selection); mainForm.selectedSection.sectionLP.RowCount++; mainForm.selectedSection.sectionLP.Height = mainForm.selectedSection.sectionLP.Height + 25; mainForm.selectedSection.sectionLP.RowStyles.Add(new RowStyle(SizeType.Absolute, 25f)); mainForm.selectedSection.sectionLP.Controls.Add(hpTypLbl, 0, col); if (inHp.holdHPform) { inHp.VehicleWeapon = new VehWeapon(inHp.weaponString, "", "", "", "", "", "", "", "", "", 0, 0); mainForm.selectedSection.sectionLP.Controls.Add(new Label() { Dock = DockStyle.Fill, Text = inHp.weaponString }); } else { mainForm.selectedSection.sectionLP.Controls.Add(weaponSelect, 1, col); } for (int i = 0; i < controls.Length; i++) { controls[i] = new Label() { Dock = DockStyle.Fill, Text = "", Font = new Font("Arial", 7, FontStyle.Regular) }; } mainForm.selectedSection.sectionLP.Controls.Add(controls[0], 2, col); mainForm.selectedSection.sectionLP.Controls.Add(controls[1], 3, col); mainForm.selectedSection.sectionLP.Controls.Add(controls[2], 4, col); mainForm.selectedSection.sectionLP.Controls.Add(controls[3], 5, col); mainForm.selectedSection.sectionLP.Controls.Add(controls[4], 6, col); mainForm.selectedSection.sectionLP.Controls.Add(controls[5], 7, col); if (inHp.VehicleWeapon != null) { controls[0].Text = inHp.VehicleWeapon.ACC; controls[1].Text = inHp.VehicleWeapon.DMG; controls[2].Text = inHp.VehicleWeapon.ROF; controls[3].Text = inHp.VehicleWeapon.AMMO + " / " + inHp.VehicleWeapon.AMMO_TYPE; controls[4].Text = inHp.VehicleWeapon.Range; controls[5].Text = inHp.VehicleWeapon.Special; } void VehWeapon_Selection(object sender, EventArgs e) { if ((weaponSelect.SelectedItem as dynamic).Value == inHp.VehicleWeapon) { return; } else { inHp.VehicleWeapon = (weaponSelect.SelectedItem as dynamic).Value; sectionForm.costLbl.Text = "Cost: " + mainForm.selectedVehicle.GetTotalCost().ToString("N") + " Cr"; controls[0].Text = inHp.VehicleWeapon.ACC; controls[1].Text = inHp.VehicleWeapon.DMG; controls[2].Text = inHp.VehicleWeapon.ROF; controls[3].Text = inHp.VehicleWeapon.AMMO + " / " + inHp.VehicleWeapon.AMMO_TYPE; controls[4].Text = inHp.VehicleWeapon.Range; controls[5].Text = inHp.VehicleWeapon.Special; inHp.PopHPTbl(); } } }