Пример #1
0
        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();
        }
Пример #2
0
            public SectionPrint()
            {
                Vehicle.VehicleSection s = Main.mainForm.selectedVehicle.sectionList[sectionIndex];
                sectionName = s.sectionName;
                armor       = s.secChassis.baseArmor + s.armorAdjust;
                shields     = s.GetShieldTotal();
                hPoints.AddRange(s.hpList);
                crs = s.secCore.corSize;
                chs = s.secChassis.chasSize;

                foreach (string x in s.electronicSystems)
                {
                    if (x != null)
                    {
                        eSystems.Add(new SerEsystem {
                            eSysString = x
                        });
                    }
                }
                foreach (string x in s.miscSystems)
                {
                    if (x != null)
                    {
                        mSystems.Add(new SerMsystem {
                            mSysString = x
                        });
                    }
                }
                foreach (string x in s.protPerkList)
                {
                    if (x != null)
                    {
                        protPerks.Add(new SerProt {
                            protString = x
                        });
                    }
                }
                foreach (Compartment x in s.compList)
                {
                    if (x.count > 0)
                    {
                        if (x.count < 2)
                        {
                            compList.Add(new SerCompart {
                                comp = x.name
                            });
                        }
                        else
                        {
                            compList.Add(new SerCompart {
                                comp = x.name + "(" + x.count + ")"
                            });
                        }
                    }
                }
            }
Пример #3
0
        public void buildButton_Click(object sender, EventArgs e)
        {
            selectedVehicle.PopSections();
            creatorLayout.Controls.Clear();
            selectedVehicle.TempBonusses();
            selectedMoveType.selectMove();
            foreach (Vehicle.VehicleSection currentSection in selectedVehicle.sectionList)
            {
                Label baseSpeed = new Label
                {
                    Text     = "Base Speed",
                    Location = new Point(89, 85),
                    Font     = new Font(Font, FontStyle.Regular),
                    AutoSize = true
                };
                Label totalCost = new Label
                {
                    Text     = "Base Cost",
                    Location = new Point(89, 100),
                    Font     = new Font(Font, FontStyle.Regular),
                    AutoSize = true
                };
                /////////////// CHASSIS LABELS /////////////////////////
                Label baseArmor = new Label
                {
                    Location = new Point(4, 23),
                    Font     = new Font(Font, FontStyle.Regular),
                    Margin   = new Padding(0),
                    Padding  = new Padding(0),
                    AutoSize = true
                };
                Label baseMan = new Label
                {
                    Location = new Point(4, 36),
                    Font     = new Font(Font, FontStyle.Regular),
                    Margin   = new Padding(0),
                    Padding  = new Padding(0),
                    AutoSize = true
                };
                Label maxHP = new Label
                {
                    Location = new Point(4, 49),
                    Font     = new Font(Font, FontStyle.Regular),
                    Margin   = new Padding(0),
                    Padding  = new Padding(0),
                    AutoSize = true
                };
                Label compMax = new Label
                {
                    Location = new Point(4, 62),
                    Font     = new Font(Font, FontStyle.Regular),
                    Margin   = new Padding(0),
                    Padding  = new Padding(0),
                    AutoSize = true
                };
                Label chasCost = new Label
                {
                    Location = new Point(4, 75),
                    Font     = new Font(Font, FontStyle.Regular),
                    Margin   = new Padding(0),
                    Padding  = new Padding(0),
                    AutoSize = true
                };

                //////////////////////////CORE LABELS////////////////

                Label perkPoints = new Label
                {
                    Location = new Point(4, 23),
                    Font     = new Font(Font, FontStyle.Regular),
                    Margin   = new Padding(0),
                    Padding  = new Padding(0),
                    AutoSize = true
                };
                Label maxArmor = new Label
                {
                    Location = new Point(4, 36),
                    Font     = new Font(Font, FontStyle.Regular),
                    Margin   = new Padding(0),
                    Padding  = new Padding(0),
                    AutoSize = true
                };
                Label hpSlots = new Label
                {
                    Location = new Point(4, 49),
                    Font     = new Font(Font, FontStyle.Regular),
                    Margin   = new Padding(0),
                    Padding  = new Padding(0),
                    AutoSize = true
                };
                Label crCost = new Label
                {
                    Location = new Point(4, 62),
                    Font     = new Font(Font, FontStyle.Regular),
                    Margin   = new Padding(0),
                    Padding  = new Padding(0),
                    AutoSize = true
                };

                ////////////////CPX PANEL/////////////////////
                Label pilCPX = new Label
                {
                    Location = new Point(1, 4),
                    Font     = new Font(Font, FontStyle.Regular),
                    Margin   = new Padding(0),
                    Padding  = new Padding(0),
                    AutoSize = true
                };
                Label mechCPX = new Label
                {
                    Location = new Point(64, 4),
                    Font     = new Font(Font, FontStyle.Regular),
                    Margin   = new Padding(0),
                    Padding  = new Padding(0),
                    AutoSize = true
                };
                ComboBox chasBox = new ComboBox();
                chasBox.Location = new Point(51, 25);
                chs.PrintChasList(chasBox, selectedVehicle);
                chasBox.SelectedIndexChanged += (o, i) =>
                {
                    //selectedChassis = chs.ChasList[chasBox.SelectedIndex];
                    foreach (Chassis c in chs.ChasList)
                    {
                        if (c.chasName == chasBox.SelectedItem.ToString())
                        {
                            currentSection.secChassis = c;
                            selectedChassis           = c;
                        }
                    }
                    baseArmor.Text = "Base Armor: " + currentSection.secChassis.baseArmor.ToString();
                    baseMan.Text   = "Base Mnv: " + currentSection.secChassis.baseMan.ToString();
                    maxHP.Text     = "Max HP: " + currentSection.secChassis.maxHP.ToString();
                    compMax.Text   = "Comp/Max: " + currentSection.secChassis.compSize.ToString() + "/ " + currentSection.secChassis.maxCompSize.ToString() + "M^2";
                    chasCost.Text  = "Cost: " + currentSection.secChassis.chasCost.ToString("n0") + " Cr";
                    if (currentSection.secCore != null)
                    {
                        mechCPX.Text   = "Mech CPX: " + mechCPXTest().ToString();
                        baseSpeed.Text = "Base Speed: " + baseSpeedTest().ToString();
                        totalCost.Text = "Base Cost: " + (currentSection.secChassis.chasCost + currentSection.secCore.corCost).ToString("n0") + " Cr";
                        ComboBox thisBox = (ComboBox)o;
                        foreach (Control x in thisBox.Parent.Controls)
                        {
                            if (x.Text == "Build")
                            {
                                ;
                            }
                            {
                                x.Enabled = true;
                            }
                        }
                    }
                };
                /////////SECTION GROUP BOX////////////////////
                GroupBox sectionGrpBox = new GroupBox
                {
                    Size = new Size(505, 120),
                    Text = currentSection.sectionName,
                    Name = currentSection.sectionName,
                    //default color
                    BackColor = Color.FromKnownColor(KnownColor.Control)
                };
                sectionGrpBox.MouseClick += (o, i) =>
                {
                    if (chasBox.Enabled == false)
                    {
                        selectedSection = currentSection;

                        // foreach (Vehicle.VehicleSection n in selectedVehicle.sectionList)
                        // {
                        // if (n.sectionName == sectionGrpBox.Name)
                        // {
                        //  selectedSection = n;
                        // }
                        //}
                        perkForm.UpdateForm(selectedVehicle, selectedSection);
                        SectionForm.testLabelName.Text = selectedSection.sectionName;
                        foreach (GroupBox n in creatorLayout.Controls)
                        {
                            if (n.Name == selectedSection.sectionName)
                            {
                                n.BackColor = Color.FromKnownColor(KnownColor.DarkGray);
                            }
                            else if (n.BackColor == Color.FromKnownColor(KnownColor.White) || n.BackColor == Color.FromKnownColor(KnownColor.DarkGray))
                            {
                                n.BackColor = Color.FromKnownColor(KnownColor.White);
                            }
                            else
                            {
                                //default color
                                n.BackColor = Color.FromKnownColor(KnownColor.Control);
                            }
                        }
                    }
                };
                Button removeSection = new Button
                {
                    Text     = "X",
                    Size     = new Size(20, 20),
                    Location = new Point(480, 10)
                };
                removeSection.MouseClick += (o, i) =>
                {
                    int x = selectedVehicle.sectionList.IndexOf(currentSection);
                    creatorLayout.Controls.RemoveAt(x);
                };

                ComboBox corBox = new ComboBox();
                corBox.Location = new Point(51, 52);
                crs.PrintCorList(corBox);
                corBox.SelectedIndexChanged += (o, i) =>
                {
                    selectedCore           = crs.CorList[corBox.SelectedIndex];
                    currentSection.secCore = crs.CorList[corBox.SelectedIndex];
                    perkPoints.Text        = "Perk Points: " + currentSection.secCore.corPerk.ToString();
                    maxArmor.Text          = "Max Armor: " + currentSection.secCore.maxArmor.ToString();
                    hpSlots.Text           = "HP Slots: " + currentSection.secCore.hp.ToString();
                    crCost.Text            = "Cost: " + currentSection.secCore.corCost.ToString("n0") + " Cr";
                    pilCPX.Text            = "Pilot CPX: " + currentSection.secCore.corCPX.ToString();
                    if (currentSection.secChassis != null)
                    {
                        mechCPX.Text   = "Mech CPX: " + mechCPXTest().ToString();
                        baseSpeed.Text = "Base Speed: " + baseSpeedTest().ToString();
                        totalCost.Text = "Base Cost: " + (currentSection.secChassis.chasCost + currentSection.secCore.corCost).ToString("n0") + " Cr";
                        ComboBox thisBox = (ComboBox)o;
                        foreach (Control x in thisBox.Parent.Controls)
                        {
                            if (x.Text == "Build")
                            {
                                ;
                            }
                            {
                                x.Enabled = true;
                            }
                        }
                    }
                };

                /////////////////BUILD SECTION BUTTON////////////////////////////////////

                Button buildSectionButton = new Button
                {
                    Location = new Point(6, 94),
                    Text     = "Build",
                    Enabled  = false
                };
                buildSectionButton.MouseClick += (o, i) =>
                {
                    currentSection.isBuilt = true;
                    chasBox.Enabled        = false;
                    corBox.Enabled         = false;
                    //////////////////Input Box///////////////////////TEMP
                    string input = Microsoft.VisualBasic.Interaction.InputBox("Enter Mechanical Design Roll \n" + QuallityString(),
                                                                              "Design Roll",
                                                                              "Enter Integer Roll Result ",
                                                                              0,
                                                                              0);
                    if (int.TryParse(input, out skillResult))
                    {
                        SectionForm.Show();
                        selectedSection = currentSection;
                        selectedSection.CalcSectionPP(skillResult);
                        selectedSection.isBuilt = true;
                        selectedVehicle.SetPilotCPX(selectedSection.secCore.corCPX);
                        selectedVehicle.SetMechCPX((int)mechCPXTest());
                        SectionForm.testLabelName.Text = selectedSection.sectionName;
                        perkForm.UpdateForm(selectedVehicle, selectedSection);

                        //skillResult = int.Parse(input);
                        /////////////////End Input Box//////////////////TEMP
                        if (selectedVehicle.tCHS >= selectedVehicle.sizeMin)
                        {
                            try
                            {
                                SectionForm.Show();
                            }
                            catch
                            {
                                throw;
                            }
                        }
                        else
                        {
                            SectionForm.Hide();
                        }
                    }



                    foreach (GroupBox n in creatorLayout.Controls)
                    {
                        if (n.Name == selectedSection.sectionName)
                        {
                            n.BackColor = Color.FromKnownColor(KnownColor.DarkGray);
                        }
                        else if (n.BackColor == Color.FromKnownColor(KnownColor.White) || n.BackColor == Color.FromKnownColor(KnownColor.DarkGray))
                        {
                            n.BackColor = Color.FromKnownColor(KnownColor.White);
                        }
                        else
                        {
                            //default color
                            n.BackColor = Color.FromKnownColor(KnownColor.Control);
                        }
                    }
                };
                Panel chasPanel = new Panel
                {
                    Location = new Point(200, 10),
                    Size     = new Size(129, 90)
                };

                Panel corPanel = new Panel
                {
                    Location = new Point(338, 10),
                    Size     = new Size(141, 79)
                };

                Panel cpxPanel = new Panel
                {
                    Location = new Point(338, 84),
                    Size     = new Size(141, 25)
                };

                sectionGrpBox.Controls.Add(chasBox);
                sectionGrpBox.Controls.Add(corBox);
                sectionGrpBox.Controls.Add(chasPanel);
                sectionGrpBox.Controls.Add(corPanel);
                sectionGrpBox.Controls.Add(cpxPanel);
                sectionGrpBox.Controls.Add(buildSectionButton);
                sectionGrpBox.Controls.Add(baseSpeed);
                sectionGrpBox.Controls.Add(totalCost);
                sectionGrpBox.Controls.Add(removeSection);
                creatorLayout.Controls.Add(sectionGrpBox);


                Label chasInfo = new Label
                {
                    Text     = "Chassis Info",
                    Location = new Point(20, 6),
                    Font     = new Font(Font, FontStyle.Bold),
                    AutoSize = true
                };
                Label corInfo = new Label
                {
                    Text     = "Core Info",
                    Location = new Point(20, 6),
                    Font     = new Font(Font, FontStyle.Bold),
                    AutoSize = true
                };


                chasPanel.Controls.Add(chasInfo);
                chasPanel.Controls.Add(baseArmor);
                chasPanel.Controls.Add(baseMan);
                chasPanel.Controls.Add(maxHP);
                chasPanel.Controls.Add(compMax);
                chasPanel.Controls.Add(chasCost);

                corPanel.Controls.Add(corInfo);
                corPanel.Controls.Add(perkPoints);
                corPanel.Controls.Add(maxArmor);
                corPanel.Controls.Add(hpSlots);
                corPanel.Controls.Add(crCost);

                cpxPanel.Controls.Add(pilCPX);
                cpxPanel.Controls.Add(mechCPX);
            }
        }