コード例 #1
0
ファイル: OrdnanceTN.cs プロジェクト: EterniaLogic/Pulsar4x
        /// <summary>
        /// Ordnance Constructor.
        /// </summary>
        /// <param name="title">Name</param>
        /// <param name="Series">Series of missile</param>
        /// <param name="whMSP">Size devoted to Warhead</param>
        /// <param name="whTech">warhead tech</param>
        /// <param name="fuelMSP">Size devoted to fuel</param>
        /// <param name="AgilityMSP">Size devoted to agility</param>
        /// <param name="agilTech">Agility tech</param>
        /// <param name="activeMSP">Size devoted to actives</param>
        /// <param name="activeTech">Active tech</param>
        /// <param name="thermalMSP">Size devoted to thermal</param>
        /// <param name="thermalTech">thermal tech</param>
        /// <param name="emMSP">size devoted to EM</param>
        /// <param name="emTech">em tech</param>
        /// <param name="geoMSP">size devoted to geosurvey</param>
        /// <param name="geoTech">geo tech</param>
        /// <param name="aRes">Active sensor resolution</param>
        /// <param name="reactorTech">Reactor tech</param>
        /// <param name="armor">Armor amount</param>
        /// <param name="ECM">is ecm present?</param>
        /// <param name="ecmTech">ecm tech</param>
        /// <param name="enhanced">is warhead rad enhanced?</param>
        /// <param name="radTech">rad tech</param>
        /// <param name="laser">is laser warhead?</param>
        /// <param name="laserTech">laser tech</param>
        /// <param name="SubMunition">Secondary munition</param>
        /// <param name="SubMunitionCount">number of secondary munition</param>
        /// <param name="SeparationDist">release separation of secondary munition from target</param>
        /// <param name="Engine">Missile engine</param>
        /// <param name="missileEngineCount">number of missile engines</param>
        public OrdnanceDefTN(string title, OrdnanceSeriesTN Series,
                             float whMSP, int whTech, float fuelMSP, float AgilityMSP, int agilTech,
                             float activeMSP, int activeTech, float thermalMSP, int thermalTech, float emMSP, int emTech, float geoMSP, int geoTech, ushort aRes, int reactorTech,
                             float armorMSP, float ECMMSP, int ecmTech, bool enhanced, int radTech, bool laser, int laserTech, MissileEngineDefTN Engine, int missileEngineCount,
                             OrdnanceDefTN SubMunition = null, int SubMunitionCount = 0, int SeparationDist = -1)
        {
            /// <summary>
            /// Ignore these:
            /// </summary>
            Name = title;
            Id = Guid.NewGuid();
            crew = 0;
            isMilitary = true;
            isSalvaged = false;
            isDivisible = false;
            isElectronic = false;

            /// <summary>
            /// Size will be total MSP here rather than HS.
            /// </summary>
            size = 0;
            cost = 0;

            WMSP = whMSP;
            AgMSP = AgilityMSP;
            AcMSP = activeMSP;
            TMSP = thermalMSP;
            EMSP = emMSP;
            GMSP = geoMSP;

            /// <summary>
            /// Warhead handling section.
            /// </summary>
            Warhead = (int)Math.Floor(whMSP * (float)Constants.OrdnanceTN.warheadTech[whTech]);
            RadValue = Warhead;

            if (enhanced == true)
            {
                RadValue = Warhead * Constants.OrdnanceTN.radTech[radTech];
                Warhead = Warhead / Constants.OrdnanceTN.radTech[radTech];
                IsLaser = false;
            }
            else if (laser == true)
            {

                /// <summary>
                /// These weren't ever really implemented, so I'm not quite sure what to do with them. I'll have them use laser damage penetration and atmospheric reductions.
                /// </summary>
                Warhead = (int)Math.Floor(whMSP * (float)Constants.OrdnanceTN.laserTech[laserTech]);
                IsLaser = true;

                /// <summary>
                /// Laser warheads won't do radiation, but won't pierce atmosphere.
                /// </summary>
                RadValue = 0;

            }
            size = size + whMSP;

            /// <summary>
            /// Fuel handling Section.
            /// </summary>
            Fuel = fuelMSP * 2500.0f;
            FuelCost = Fuel;

            size = size + fuelMSP;


            /// <summary>
            /// Engine Handling.
            /// </summary>
            OrdnanceEngine = Engine;
            EngineCount = missileEngineCount;

            if (OrdnanceEngine != null)
            {
                TotalEnginePower = (OrdnanceEngine.enginePower * (float)EngineCount);
                TotalThermalSignature = (OrdnanceEngine.thermalSignature * (float)EngineCount);
                TotalFuelConsumption = (OrdnanceEngine.fuelConsumption * (float)EngineCount);

                /// <summary>
                /// Engine sizes are divided by 20 to make their formula work.
                /// </summary>
                size = size + (OrdnanceEngine.size * (float)EngineCount * 20.0f);
            }

            /// <summary>
            /// Agility Handling.
            /// </summary>
            Agility = (int)Math.Floor(AgilityMSP * (float)Constants.OrdnanceTN.agilityTech[agilTech]);
            size = size + AgilityMSP;



            /// <summary>
            /// Sensor Handling Section:
            /// </summary>
            ActiveStr = activeMSP * Constants.OrdnanceTN.activeTech[activeTech];
            size = size + activeMSP;

            if (ActiveStr != 0.0f)
            {
                ASD = new ActiveSensorDefTN(ActiveStr, (byte)Math.Floor(Constants.OrdnanceTN.passiveTech[emTech] * 20.0f), aRes);
            }

            ThermalStr = thermalMSP * Constants.OrdnanceTN.passiveTech[thermalTech];
            size = size + thermalMSP;

            if (ThermalStr != 0.0f)
            {
                THD = new PassiveSensorDefTN(ThermalStr, PassiveSensorType.Thermal);
            }

            EMStr = emMSP * Constants.OrdnanceTN.passiveTech[emTech];
            size = size + emMSP;

            if (EMStr != 0.0f)
            {
                EMD = new PassiveSensorDefTN(EMStr, PassiveSensorType.EM);
            }

            GeoStr = geoMSP * Constants.OrdnanceTN.geoTech[geoTech];
            size = size + geoMSP;

            ReactorValue = ((ActiveStr + ThermalStr + EMStr + GeoStr) / 5.0f);
            ReactorMSP = ReactorValue / Constants.OrdnanceTN.reactorTech[reactorTech];
            size = size + ReactorMSP;

            if (ECMMSP != 0.0f)
            {
                if (ECMMSP > 1.0f)
                    ECMMSP = 1.0f;

                ECMValue = (int)Math.Round((float)(ecmTech + 1) * 10.0f * ECMMSP);
                size = size + ECMMSP;
            }

            Armor = armorMSP;
            size = size + Armor;

            /// <summary>
            /// Do secondary missiles here.
            /// </summary>
            /// 
            if (SubMunition != null)
            {
                SubRelease = SubMunition;
                SubReleaseCount = SubMunitionCount;
                SubReleaseDistance = SeparationDist;
            }
            else
            {
                SubRelease = null;
                SubReleaseCount = -1;
                SubReleaseDistance = -1;
            }

            /// <summary>
            /// now that the size of the missile is known, we can see what its detection characteristics should be.
            /// </summary>
            DetectMSP = (int)Math.Floor(size);

            if (DetectMSP <= 6)
            {
                DetectMSP = 0;
            }
            else if (DetectMSP >= 20)
            {
                DetectMSP = 14;
            }
            else
            {
                DetectMSP = DetectMSP - 6;
            }

            if (Warhead == RadValue || RadValue == 0)
            {
                cost = cost + (decimal)((float)Warhead / 4.0f);
            }
            else
            {
                cost = cost + (decimal)((float)(Warhead * Constants.OrdnanceTN.radTech[radTech]) / 4.0f);
            }
            if (OrdnanceEngine != null)
            {
                cost = cost + (OrdnanceEngine.cost * EngineCount);
            }
            cost = cost + (decimal)((Agility) / 50.0f);
            cost = cost + (decimal)(ReactorValue * 3.0f);
            cost = cost + (decimal)(ThermalStr);
            cost = cost + (decimal)(EMStr);
            cost = cost + (decimal)(ActiveStr);
            cost = cost + (decimal)(GeoStr * 25.0f);
            cost = cost + (decimal)((float)Armor / 4.0f);
            cost = cost + (decimal)((float)ECMValue / 20.0f);

            minerialsCost = new decimal[Constants.Minerals.NO_OF_MINERIALS];
            for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
            {
                minerialsCost[mineralIterator] = 0;
            }

            if (Warhead == RadValue || RadValue == 0)
            {
                minerialsCost[(int)Constants.Minerals.MinerialNames.Tritanium] = (decimal)(((float)Warhead / 4.0f) + ((float)Armor / 4.0f));
            }
            else
            {
                minerialsCost[(int)Constants.Minerals.MinerialNames.Tritanium] = (decimal)((float)(Warhead * Constants.OrdnanceTN.radTech[radTech]) / 4.0f);
            }
            minerialsCost[(int)Constants.Minerals.MinerialNames.Gallicite] = (decimal)(OrdnanceEngine.cost * EngineCount) + (decimal)((float)Agility / 50.0f);
            minerialsCost[(int)Constants.Minerals.MinerialNames.Uridium] = (decimal)(ThermalStr + EMStr + ActiveStr + (GeoStr * 25.0f) + ((float)ECMValue / 20.0f));
            minerialsCost[(int)Constants.Minerals.MinerialNames.Boronide] = (decimal)(ReactorValue * 3.0f);

            if (SubMunition != null)
            {
                size = size + (SubMunition.size * SubMunitionCount);
                cost = cost + (SubMunition.cost * SubMunitionCount);

                for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                {
                    minerialsCost[mineralIterator] = minerialsCost[mineralIterator] + (SubMunition.minerialsCost[mineralIterator] * SubMunitionCount);
                }

                FuelCost = FuelCost + (SubMunition.FuelCost * SubMunitionCount);
            }

            isObsolete = false;

            MaxSpeed = (float)TotalEnginePower * (1000.0f / (size * 0.05f));

            if (MaxSpeed > Constants.OrdnanceTN.MaximumSpeed)
            {
                MaxSpeed = Constants.OrdnanceTN.MaximumSpeed;
            }

            /// <summary>
            /// Bombs dropped directly on target, or otherwise things I really don't want to move, but don't want to screw up TimeReq for.
            /// </summary>
            if (MaxSpeed == 0)
                MaxSpeed = 1;

            Manuever = 10.0f + (Agility / size);

            if (Series != null)
            {
                OrdSeries = Series;
                Series.AddMissileToSeries(this);
            }
        }
コード例 #2
0
ファイル: ShipTests.cs プロジェクト: EterniaLogic/Pulsar4x
        public void CollierOrdersTest()
        {
            Faction PlayerFaction1 = new Faction(0);

            StarSystem System1 = SystemGen.CreateSol();

            SystemBody pl1 = new SystemBody(System1.Stars[0], SystemBody.PlanetType.Terrestrial);
            SystemBody pl2 = new SystemBody(System1.Stars[0], SystemBody.PlanetType.Terrestrial);
            System1.Stars[0].Planets.Add(pl1);
            System1.Stars[0].Planets.Add(pl2);

            System1.Stars[0].Planets[0].Position.X = 1.0;
            System1.Stars[0].Planets[0].Position.Y = 1.0;

            System1.Stars[0].Planets[1].Position.X = 2.0;
            System1.Stars[0].Planets[1].Position.Y = 2.0;


            PlayerFaction1.AddNewShipDesign("Blucher");

            MissileEngineDefTN TestMissileEngine = new MissileEngineDefTN("Testbed", 5.0f, 1.0f, 1.0f, 1.0f);
            OrdnanceSeriesTN Series = new OrdnanceSeriesTN("BLANK STANDIN");
            OrdnanceDefTN TestMissile = new OrdnanceDefTN("Test Missile", Series, 1.0f, 0, 1.0f, 1.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 1, 0, 0.0f, 0.0f, 0, false, 0, false, 0, TestMissileEngine, 1);

            PlayerFaction1.ShipDesigns[0].AddEngine(PlayerFaction1.ComponentList.Engines[0], 1);
            PlayerFaction1.ShipDesigns[0].AddCrewQuarters(PlayerFaction1.ComponentList.CrewQuarters[0], 2);
            PlayerFaction1.ShipDesigns[0].AddFuelStorage(PlayerFaction1.ComponentList.FuelStorage[0], 2);
            PlayerFaction1.ShipDesigns[0].AddEngineeringSpaces(PlayerFaction1.ComponentList.EngineeringSpaces[0], 2);
            PlayerFaction1.ShipDesigns[0].AddOtherComponent(PlayerFaction1.ComponentList.OtherComponents[0], 1);
            PlayerFaction1.ShipDesigns[0].AddMagazine(PlayerFaction1.ComponentList.MagazineDef[0], 1);

            PlayerFaction1.ShipDesigns[0].SetPreferredOrdnance(TestMissile, 3);

            PlayerFaction1.AddNewTaskGroup("P1 TG 01", System1.Stars[0].Planets[0], System1);

            PlayerFaction1.TaskGroups[0].AddShip(PlayerFaction1.ShipDesigns[0], "Test Ship");

            PlayerFaction1.TaskGroups[0].Ships[0].Refuel(200000.0f);

            Population P1 = new Population(System1.Stars[0].Planets[0], PlayerFaction1,0);
            Population P2 = new Population(System1.Stars[0].Planets[1], PlayerFaction1,0);

            System1.Stars[0].Planets[0].Populations[0].LoadMissileToStockpile(TestMissile, 4);


            Order Load = new Order(Constants.ShipTN.OrderType.LoadOrdnanceFromColony, -1, -1, 0, System1.Stars[0].Planets[0].Populations[0]);
            Order Unload = new Order(Constants.ShipTN.OrderType.UnloadOrdnanceToColony, -1, -1, 0, System1.Stars[0].Planets[1].Populations[0]);

            PlayerFaction1.TaskGroups[0].IssueOrder(Load);
            PlayerFaction1.TaskGroups[0].IssueOrder(Unload);

            bool CK = System1.Stars[0].Planets[1].Populations[0].MissileStockpile.ContainsKey(TestMissile);
            Console.WriteLine("Missiles on P1 and P2:{0} {1}", System1.Stars[0].Planets[0].Populations[0].MissileStockpile[TestMissile],
                CK);


            while (PlayerFaction1.TaskGroups[0].TaskGroupOrders.Count > 0)
            {
                Console.WriteLine("Current Order Time: {0} {1}", PlayerFaction1.TaskGroups[0].TimeRequirement,
    PlayerFaction1.TaskGroups[0].TaskGroupOrders[0].orderTimeRequirement);

                PlayerFaction1.TaskGroups[0].FollowOrders(Constants.TimeInSeconds.TwentyMinutes);

                Console.WriteLine("Order Count: {0}", PlayerFaction1.TaskGroups[0].TaskGroupOrders.Count);
            }

            bool CK1 = System1.Stars[0].Planets[0].Populations[0].MissileStockpile.ContainsKey(TestMissile);
            bool CK2 = System1.Stars[0].Planets[1].Populations[0].MissileStockpile.ContainsKey(TestMissile);
            Console.WriteLine("Missiles on P1 and P2:{0} {1}", CK1,
                            CK2);

            if (CK1 == true)
            {
                Console.WriteLine("P1 Missiles {0}", System1.Stars[0].Planets[0].Populations[0].MissileStockpile[TestMissile]);
            }

            if (CK2 == true)
            {
                Console.WriteLine("P2 Missiles {0}", System1.Stars[0].Planets[1].Populations[0].MissileStockpile[TestMissile]);
            }

            CK = PlayerFaction1.TaskGroups[0].Ships[0].ShipOrdnance.ContainsKey(TestMissile);
            Console.WriteLine("Missile count on Ships[0] after unload :{0}", CK);
        }
コード例 #3
0
ファイル: ShipTests.cs プロジェクト: EterniaLogic/Pulsar4x
        public void OrdnanceTest()
        {
            /// <summary>
            /// Need to hook missiles into the distance table calculations, as well as sensor model.
            /// </summary>


            /// <summary>
            ///The Damage table MUST be initialized.
            /// </summary>
            DamageValuesTN.init();

            /// <summary>
            /// Factions ARE necessary.
            /// </summary>
            Faction PlayerFaction1 = new Faction(0);
            Faction PlayerFaction2 = new Faction(1);

            /// <summary>
            /// No StarSystem no contacts!
            /// </summary>
            StarSystem System1 = new StarSystem("This is not Sol", 0);
            System1.Populations = new BindingList<Population>();
            Star S1 = new Star();
            System1.Stars.Add(S1);

            PlayerFaction1.AddNewContactList(System1);
            PlayerFaction2.AddNewContactList(System1);

            /// <summary>
            /// No global RNG, no Damage or tohit.
            /// </summary>
            Random RNG = new Random();

            /// <summary>
            /// Planets and populations are needed for house keeping.
            /// </summary>
            SystemBody pl1 = new SystemBody(System1.Stars[0], SystemBody.PlanetType.Terrestrial);
            SystemBody pl2 = new SystemBody(System1.Stars[0], SystemBody.PlanetType.Terrestrial);
            pl1.Position.System = System1;
            pl2.Position.System = System1;
            System1.Stars[0].Planets.Add(pl1);
            System1.Stars[0].Planets.Add(pl2);

            Population P1 = new Population(System1.Stars[0].Planets[0], PlayerFaction1,0);
            Population P2 = new Population(System1.Stars[0].Planets[1], PlayerFaction2,0);

            System1.Stars[0].Planets[0].Position.X = 1.0;
            System1.Stars[0].Planets[0].Position.Y = 1.0;

            System1.Stars[0].Planets[1].Position.X = 1.04;
            System1.Stars[0].Planets[1].Position.Y = 1.04;


            PlayerFaction1.AddNewShipDesign("Blucher");
            PlayerFaction2.AddNewShipDesign("Tribal");

            MissileEngineDefTN TestMissileEngine = new MissileEngineDefTN("Testbed", 5.0f, 4.0f, 1.0f, 1.0f);

            OrdnanceSeriesTN Series = new OrdnanceSeriesTN("BLANK STANDIN");
            OrdnanceDefTN TestMissile = new OrdnanceDefTN("Test Missile", Series, 1.0f, 0, 1.0f, 1.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 1, 0, 0.0f, 0.0f, 0, false, 0, false, 0, TestMissileEngine, 1);

            ActiveSensorDefTN Spotter = new ActiveSensorDefTN("Spotter", 6.0f, 12, 6, 19, false, 1.0f, 0);
            ActiveSensorDefTN FControl = new ActiveSensorDefTN("FCtrl", 6.0f, 12, 6, 19, true, 1.0f, 0);

            PlayerFaction1.ShipDesigns[0].AddEngine(PlayerFaction1.ComponentList.Engines[0], 1);
            PlayerFaction1.ShipDesigns[0].AddCrewQuarters(PlayerFaction1.ComponentList.CrewQuarters[0], 2);
            PlayerFaction1.ShipDesigns[0].AddFuelStorage(PlayerFaction1.ComponentList.FuelStorage[0], 2);
            PlayerFaction1.ShipDesigns[0].AddEngineeringSpaces(PlayerFaction1.ComponentList.EngineeringSpaces[0], 2);
            PlayerFaction1.ShipDesigns[0].AddOtherComponent(PlayerFaction1.ComponentList.OtherComponents[0], 1);
            PlayerFaction1.ShipDesigns[0].AddMagazine(PlayerFaction1.ComponentList.MagazineDef[0], 1);
            PlayerFaction1.ShipDesigns[0].AddLauncher(PlayerFaction1.ComponentList.MLauncherDef[0], 1);
            PlayerFaction1.ShipDesigns[0].AddMFC(FControl, 1);
            PlayerFaction1.ShipDesigns[0].AddActiveSensor(Spotter, 1);

            PlayerFaction2.ShipDesigns[0].AddEngine(PlayerFaction1.ComponentList.Engines[0], 1);
            PlayerFaction2.ShipDesigns[0].AddCrewQuarters(PlayerFaction1.ComponentList.CrewQuarters[0], 2);
            PlayerFaction2.ShipDesigns[0].AddFuelStorage(PlayerFaction1.ComponentList.FuelStorage[0], 2);
            PlayerFaction2.ShipDesigns[0].AddEngineeringSpaces(PlayerFaction1.ComponentList.EngineeringSpaces[0], 2);
            PlayerFaction2.ShipDesigns[0].AddOtherComponent(PlayerFaction1.ComponentList.OtherComponents[0], 1);
            PlayerFaction2.ShipDesigns[0].NewArmor("Duranium", 5, 4);

            PlayerFaction1.ShipDesigns[0].SetPreferredOrdnance(TestMissile, 3);

            PlayerFaction1.AddNewTaskGroup("P1 TG 01", System1.Stars[0].Planets[0], System1);
            PlayerFaction2.AddNewTaskGroup("P2 TG 01", System1.Stars[0].Planets[1], System1);


            PlayerFaction1.TaskGroups[0].AddShip(PlayerFaction1.ShipDesigns[0], "Test Ship 1");
            PlayerFaction2.TaskGroups[0].AddShip(PlayerFaction2.ShipDesigns[0], "Test Ship 2");


            PlayerFaction1.TaskGroups[0].Ships[0].Refuel(200000.0f);
            PlayerFaction2.TaskGroups[0].Ships[0].Refuel(200000.0f);

            System1.Stars[0].Planets[0].Populations[0].LoadMissileToStockpile(TestMissile, 4);

            Order Load = new Order(Constants.ShipTN.OrderType.LoadOrdnanceFromColony, -1, -1, 0, System1.Stars[0].Planets[0].Populations[0]);

            PlayerFaction1.TaskGroups[0].IssueOrder(Load);

            while (PlayerFaction1.TaskGroups[0].TaskGroupOrders.Count > 0)
            {
                PlayerFaction1.TaskGroups[0].FollowOrders(Constants.TimeInSeconds.TwentyMinutes);
            }

            /// <summary>
            /// Magazine loading isn't handled anywhere.
            /// </summary>
            PlayerFaction1.TaskGroups[0].Ships[0].ShipMLaunchers[0].loadedOrdnance = TestMissile;

            PlayerFaction1.TaskGroups[0].Ships[0].ShipMLaunchers[0].AssignMFC(PlayerFaction1.TaskGroups[0].Ships[0].ShipMFC[0]);
            PlayerFaction1.TaskGroups[0].Ships[0].ShipMFC[0].assignLaunchTube(PlayerFaction1.TaskGroups[0].Ships[0].ShipMLaunchers[0]);

            PlayerFaction1.TaskGroups[0].Ships[0].ShipMFC[0].assignTarget(PlayerFaction2.TaskGroups[0].Ships[0]);
            PlayerFaction1.TaskGroups[0].Ships[0].ShipMFC[0].openFire = true;
            PlayerFaction1.TaskGroups[0].SetActiveSensor(0, 0, true);


            GameState.Instance.CurrentSecond += 10;
            GameState.Instance.LastTimestep = 10;

            PlayerFaction1.SensorSweep();



            bool ret = PlayerFaction1.TaskGroups[0].Ships[0].ShipFireWeapons(RNG);


            Console.WriteLine("Did we fire: {0} Detected Contacts:{1}", ret, PlayerFaction1.DetectedContactLists.Count);


            bool done = false;
            while (!done)
            {
                Console.WriteLine("TimeStep:{0} {1} Detected Contacts:{2}", GameState.Instance.CurrentSecond, GameState.Instance.LastTimestep, PlayerFaction1.DetectedContactLists.Count);

                PlayerFaction1.SensorSweep();

                PlayerFaction1.MissileGroups[0].ProcessOrder((uint)GameState.Instance.LastTimestep, RNG);

                Console.WriteLine("{0} {1} {2} {3} {4} {5} {6} {7}", PlayerFaction1.MissileGroups[0].currentHeading, PlayerFaction1.MissileGroups[0].currentSpeedX,
                    PlayerFaction1.MissileGroups[0].currentSpeedY, PlayerFaction1.MissileGroups[0].timeReq, PlayerFaction1.MissileGroups[0].dx, PlayerFaction1.MissileGroups[0].dy,
                    PlayerFaction1.MissileGroups[0].missiles.Count, PlayerFaction1.MissileGroups[0].missilesDestroyed);

                GameState.Instance.CurrentSecond += 5;
                GameState.Instance.LastTimestep = 5;






                if (PlayerFaction1.MissileGroups[0].missiles.Count == PlayerFaction1.MissileGroups[0].missilesDestroyed)
                {
                    PlayerFaction1.MissileGroups.Clear();
                    done = true;
                }
            }


            Console.WriteLine("Armor:");
            for (int loop = 0; loop < PlayerFaction2.TaskGroups[0].Ships[0].ShipArmor.armorColumns.Count; loop++)
            {
                Console.WriteLine("{0} ", PlayerFaction2.TaskGroups[0].Ships[0].ShipArmor.armorColumns[loop]);
            }

        }
コード例 #4
0
ファイル: Components.cs プロジェクト: EterniaLogic/Pulsar4x
        /// <summary>
        /// This Code, along with the DllImport allows for halting and resuming message sending during ResizeBegin and ResizeEnd. It was an attempt to eliminate cpu usage on window moves that did not work
        /// however. References in Components() must be uncommented for this to work, and the ResizeBegin and ResizeEnd functions must likewise have their contents uncommented.
        /// </summary>
        //private IntPtr eventMask;

        //[DllImport("user32", CharSet = CharSet.Auto)]
        //private extern static IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);

        public Components()
        {

            //eventMask = IntPtr.Zero;

            m_oComponentDesignPanel = new Panels.Component_Design();

            VM = new ComponentsViewModel();

            /// <summary>
            /// Bind factions to the empire selection combo box.
            /// </summary>
            m_oComponentDesignPanel.FactionComboBox.Bind(c => c.DataSource, VM, d => d.Factions);
            m_oComponentDesignPanel.FactionComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentFaction, DataSourceUpdateMode.OnPropertyChanged);
            m_oComponentDesignPanel.FactionComboBox.DisplayMember = "Name";
            VM.FactionChanged += (s, args) => _CurrnetFaction = VM.CurrentFaction;
            _CurrnetFaction = VM.CurrentFaction;
            m_oComponentDesignPanel.FactionComboBox.SelectedIndexChanged += (s, args) => m_oComponentDesignPanel.FactionComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oComponentDesignPanel.FactionComboBox.SelectedIndexChanged += new EventHandler(FactionComboBox_SelectedIndexChanged);


            /// <summary>
            /// Load the tech names. Commented out code commented out because it seizes control of the control away from the user for reasons I don't understand.
            /// </summary>
            m_oComponentDesignPanel.ResearchComboBox.Bind(c => c.DataSource, VM, d => d.RPTechs);
            //m_oComponentDesignPanel.ResearchComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentComponent, DataSourceUpdateMode.OnPropertyChanged);
            //m_oComponentDesignPanel.ResearchComboBox.DisplayMember = "Name";
            VM.ComponentChanged += (s, args) => _CurrnetComponent = VM.CurrentComponent;
            _CurrnetComponent = VM.CurrentComponent;
            //m_oComponentDesignPanel.ResearchComboBox.SelectedIndexChanged += (s, args) => m_oComponentDesignPanel.ResearchComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oComponentDesignPanel.ResearchComboBox.SelectedIndexChanged += new EventHandler(ResearchComboBox_SelectedIndexChanged);

            m_oComponentDesignPanel.TechComboBoxOne.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxThree.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxFour.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxFive.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxSix.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);
            m_oComponentDesignPanel.TechComboBoxSeven.SelectedIndexChanged += new EventHandler(TechComboBox_SelectedIndexChanged);

            m_oComponentDesignPanel.CloseButton.Click += new EventHandler(CloseButton_Click);

            m_oComponentDesignPanel.SizeTonsCheckBox.Click += new EventHandler(SizeTonsCheckBox_Click);

            m_oComponentDesignPanel.InstantButton.Click += new EventHandler(InstantButton_Click);

            m_oComponentDesignPanel.MissileButton.Click += new EventHandler(MissileButton_Click);

            m_oComponentDesignPanel.TurretButton.Click += new EventHandler(TurretButton_Click);

            //m_oComponentDesignPanel.ResizeBegin +=new EventHandler(ResizeBegin);
            //m_oComponentDesignPanel.ResizeEnd += new EventHandler(ResizeEnd);

            ActiveSensorProject = null;
            PassiveSensorProject = null;
            BeamFCProject = null;
            ReactorProject = null;
            ShieldProject = null;
            EngineProject = null;
            BeamProject = null;
            LauncherProject = null;
            MagazineProject = null;
            MissileEngineProject = null;
            JumpEngineProject = null;
        }
コード例 #5
0
ファイル: Components.cs プロジェクト: EterniaLogic/Pulsar4x
        /// <summary>
        /// Update the display/Name for the proposed component.
        /// </summary>
        private void BuildSystemParameters()
        {
            String Entry = "N/A";
            float Size = 0.0f;
            float Hard = 1.0f;
            float Boost = 1.0f;
            int FactTech = -1;

            m_oComponentDesignPanel.TechNameTextBox.Clear();
            m_oComponentDesignPanel.ParametersTextBox.Clear();

            #region BuildSystemParameters Switch
            switch ((ComponentsViewModel.Components)m_oComponentDesignPanel.ResearchComboBox.SelectedIndex)
            {
                #region Active Sensors / MFC
                case ComponentsViewModel.Components.ActiveMFC:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex != -1)
                    {


                        #region Size
                        /// <summary>
                        /// Pull size out of this mess.
                        /// </summary>
                        if (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex < 9)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex + 1) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex >= 9 && m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex <= 13)
                        {
                            Size = 1.0f + (float)((m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex - 9) * 2) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex >= 14 && m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex <= 25)
                        {
                            Size = 2.0f + (float)(((m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex - 14) * 25) / 100.0f);
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex > 25)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex - 21);
                        }
                        #endregion

                        #region Resolution
                        ushort Resolution = 501;
                        if (m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex < 20)
                        {
                            Resolution = (ushort)(m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex + 1);
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex >= 20 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex <= 55)
                        {
                            Resolution = (ushort)(20 + ((m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex - 19) * 5));
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex > 55)
                        {
                            Resolution = (ushort)(200 + ((m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex - 55) * 20));
                        }
                        #endregion

                        #region Hardening
                        /// <summary>
                        /// Get chance of destruction due to electronic damage.
                        /// </summary>
                        switch (m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex)
                        {
                            case 0:
                                Hard = 1.0f;
                                break;
                            case 1:
                                Hard = 0.7f;
                                break;
                            case 2:
                                Hard = 0.5f;
                                break;
                            case 3:
                                Hard = 0.4f;
                                break;
                            case 4:
                                Hard = 0.3f;
                                break;
                            case 5:
                                Hard = 0.25f;
                                break;
                            case 6:
                                Hard = 0.2f;
                                break;
                            case 7:
                                Hard = 0.15f;
                                break;
                            case 8:
                                Hard = 0.1f;
                                break;
                            default:
                                Hard = 1.0f;
                                break;
                        }
                        #endregion

                        bool isMFC = false;

                        if (m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex == 0)
                        {
                            Entry = "Active Search Sensor MR";
                            isMFC = false;
                        }
                        else
                        {
                            Entry = "Missile Fire Control FC";
                            isMFC = true;
                        }

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ActiveSensorStrength];

                        /// <summary>
                        /// More sanity checking as give all does not do this. I might not want to hard code all of this however.
                        /// </summary>
                        if (FactTech > 11)
                            FactTech = 11;

                        int AS = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.EMSensorSensitivity];

                        if (FactTech > 11)
                            FactTech = 11;

                        int EM = FactTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        ActiveSensorProject = new ActiveSensorDefTN(Entry, Size, Constants.SensorTN.ActiveStrength[AS],
                                                                               Constants.SensorTN.PassiveStrength[EM],
                                                                               Resolution, isMFC,
                                                                               Hard, (byte)(m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex + 1));

                        int mkm = (int)Math.Floor((float)ActiveSensorProject.maxRange / 100.0f);

                        Entry = String.Format("{0}{1}-R{2}", Entry, mkm, Resolution);

                        if (Hard != 1.0f)
                        {
                            Entry = String.Format("{0} ({1}%)", Entry, (Hard * 100.0f));
                        }

                        ActiveSensorProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = ActiveSensorProject.Name;

                        Entry = String.Format("Active Sensor Strength: {0} Sensitivity Modifier: {1}%\n", (ActiveSensorProject.activeStrength * ActiveSensorProject.size), ((float)ActiveSensorProject.eMRecv * 10.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Sensor Size: {0} Tons  Sensor HTK: {1}\n", (ActiveSensorProject.size * 50.0f), ActiveSensorProject.htk);
                        else
                            Entry = String.Format("Sensor Size: {0} HS  Sensor HTK: {1}\n", ActiveSensorProject.size, ActiveSensorProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);


                        int RangeFormat = (ActiveSensorProject.maxRange * 10);
                        string FormattedRange = RangeFormat.ToString("#,##0");



                        Entry = String.Format("Resolution: {0}    Maximum Range vs {1} ton object (or larger): {2},000 km\n", ActiveSensorProject.resolution, (ActiveSensorProject.resolution * 50), FormattedRange);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (Resolution == 1)
                        {
                            RangeFormat = ActiveSensorProject.GetActiveDetectionRange(0, 0) * 10;
                            if (RangeFormat < 100)
                            {
                                int Range1 = (int)((float)ActiveSensorProject.maxRange * 10000.0f * (float)Math.Pow((0.33 / (float)Resolution), 2.0f));
                                FormattedRange = Range1.ToString("#,##0");
                                Entry = String.Format("Range vs Size 6 Missile (or smaller): {0} km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                                int Range2 = (int)((float)ActiveSensorProject.maxRange * 10000.0f * (float)Math.Pow((0.40 / (float)Resolution), 2.0f));
                                FormattedRange = Range2.ToString("#,##0");
                                Entry = String.Format("Range vs Size 8 Missile: {0} km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                                int Range3 = (int)((float)ActiveSensorProject.maxRange * 10000.0f * (float)Math.Pow((0.60 / (float)Resolution), 2.0f));
                                FormattedRange = Range3.ToString("#,##0");
                                Entry = String.Format("Range vs Size 12 Missile: {0} km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                            }
                            else
                            {

                                FormattedRange = RangeFormat.ToString("#,##0");
                                Entry = String.Format("Range vs Size 6 Missile (or smaller): {0},000 km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                                RangeFormat = ActiveSensorProject.GetActiveDetectionRange(0, 2) * 10;
                                FormattedRange = RangeFormat.ToString("#,##0");
                                Entry = String.Format("Range vs Size 8 Missile: {0},000 km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                                RangeFormat = ActiveSensorProject.GetActiveDetectionRange(0, 4) * 10;
                                FormattedRange = RangeFormat.ToString("#,##0");
                                Entry = String.Format("Range vs Size 12 Missile: {0},000 km\n", FormattedRange);
                                m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                            }
                        }
                        else
                        {
                            RangeFormat = ActiveSensorProject.GetActiveDetectionRange(19, -1) * 10;
                            FormattedRange = RangeFormat.ToString("#,##0");
                            Entry = String.Format("Range vs 1000 ton object: {0},000 km\n", FormattedRange);
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                            RangeFormat = ActiveSensorProject.GetActiveDetectionRange(4, -1) * 10;
                            FormattedRange = RangeFormat.ToString("#,##0");
                            Entry = String.Format("Range vs 250 ton object: {0},000 km\n", FormattedRange);
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }

                        Entry = String.Format("Chance of destruction by electronic damage: {0}%\n", (Hard * 100.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", ActiveSensorProject.cost, ActiveSensorProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (ActiveSensorProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, ActiveSensorProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP\n", ActiveSensorProject.cost * 10);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                    }

                    break;
                #endregion

                #region Beam Fire Control
                case ComponentsViewModel.Components.BFC:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxSeven.SelectedIndex != -1)
                    {

                        #region Get Stats
                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.BeamFireControlRange];

                        if (FactTech > 11)
                            FactTech = 11;

                        int BR = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.BeamFireControlTracking];

                        if (FactTech > 11)
                            FactTech = 11;

                        int BT = FactTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        float modR = 1.0f;

                        switch (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex)
                        {
                            case 0:
                                modR = 1.0f;
                                break;
                            case 1:
                                modR = 1.5f;
                                break;
                            case 2:
                                modR = 2.0f;
                                break;
                            case 3:
                                modR = 3.0f;
                                break;
                            case 4:
                                modR = 0.5f;
                                break;
                            case 5:
                                modR = 4.0f;
                                break;
                            case 6:
                                modR = 0.34f;
                                break;
                            case 7:
                                modR = 0.25f;
                                break;
                            default:
                                modR = 1.0f;
                                break;
                        }

                        float modT = 1.0f;

                        switch (m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex)
                        {
                            case 0:
                                modT = 1.0f;
                                break;
                            case 1:
                                modT = 1.25f;
                                break;
                            case 2:
                                modT = 0.5f;
                                break;
                            case 3:
                                modT = 1.5f;
                                break;
                            case 4:
                                modT = 2.0f;
                                break;
                            case 5:
                                modT = 3.0f;
                                break;
                            case 6:
                                modT = 4.0f;
                                break;
                            default:
                                modT = 1.0f;
                                break;
                        }

                        switch (m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex)
                        {
                            case 0:
                                Hard = 1.0f;
                                break;
                            case 1:
                                Hard = 0.7f;
                                break;
                            case 2:
                                Hard = 0.5f;
                                break;
                            case 3:
                                Hard = 0.4f;
                                break;
                            case 4:
                                Hard = 0.3f;
                                break;
                            case 5:
                                Hard = 0.25f;
                                break;
                            case 6:
                                Hard = 0.2f;
                                break;
                            case 7:
                                Hard = 0.15f;
                                break;
                            case 8:
                                Hard = 0.1f;
                                break;
                            default:
                                Hard = 1.0f;
                                break;
                        }

                        bool isPDC = false;
                        if (m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex == 0)
                            isPDC = false;
                        else
                            isPDC = true;

                        bool isFighter = false;
                        if (m_oComponentDesignPanel.TechComboBoxSeven.SelectedIndex == 0)
                            isFighter = false;
                        else
                            isFighter = true;

                        #endregion


                        BeamFCProject = new BeamFireControlDefTN("Fire Control S", BR, BT,
                                                                 modR, modT, isPDC, isFighter, Hard, (byte)(m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex + 1));

                        Entry = "N/A";
                        if (BeamFCProject.size >= 10.0f)
                            Entry = String.Format("{0}{1} {2}-{3}", BeamFCProject.Name, BeamFCProject.size, (BeamFCProject.range / 1000.0f), BeamFCProject.tracking);
                        else
                            Entry = String.Format("{0}0{1} {2}-{3}", BeamFCProject.Name, BeamFCProject.size, (BeamFCProject.range / 1000.0f), BeamFCProject.tracking);

                        if (Hard != 1.0f)
                        {
                            Entry = String.Format("{0} H{1}", Entry, (Hard * 100.0f));
                        }

                        if (isPDC == true)
                        {
                            Entry = String.Format("PDC {0}", Entry);
                        }
                        else if (isFighter == true && isPDC == false)
                        {
                            Entry = String.Format("{0} (FTR)", Entry);
                        }

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;
                        BeamFCProject.Name = Entry;

                        String FormattedRange = BeamFCProject.range.ToString("#,##0");
                        Entry = String.Format("50% Accuracy at Range: {0} km     Tracking Speed: {1} km/s\n", FormattedRange, BeamFCProject.tracking);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Size: {0} Tons    HTK: {1}    Cost: {2}    Crew: {3}\n", (BeamFCProject.size * 50.0f), BeamFCProject.htk, BeamFCProject.cost, BeamFCProject.crew);
                        else
                            Entry = String.Format("Size: {0} HS    HTK: {1}    Cost: {2}    Crew: {3}\n", BeamFCProject.size, BeamFCProject.htk, BeamFCProject.cost, BeamFCProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Chance of destruction by electronic damage: {0}%\n", (Hard * 100.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamFCProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamFCProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP\n", BeamFCProject.cost * 10);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region CIWS
                case ComponentsViewModel.Components.CIWS:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex != -1)
                    {
                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.GaussCannonROF];
                        if (FactTech > 6)
                            FactTech = 6;

                        int GR = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.BeamFireControlRange];

                        if (FactTech > 11)
                            FactTech = 11;

                        int BR = FactTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.BeamFireControlTracking];

                        if (FactTech > 11)
                            FactTech = 11;

                        int BT = FactTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ActiveSensorStrength];

                        if (FactTech > 11)
                            FactTech = 11;

                        int AS = FactTech - m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.TurretTracking];

                        if (FactTech > 11)
                            FactTech = 11;

                        int TT = FactTech - m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ECCM];

                        if (FactTech > 10)
                            FactTech = 10;

                        int ECCM = FactTech - m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex;

                        Entry = "CIWS";

                        CloseInProject = new CIWSDefTN(Entry, GR, BR, BT, AS, TT, ECCM);

                        Entry = String.Format("CIWS-{0}", (CloseInProject.tracking / 100)); ;
                        CloseInProject.Name = Entry;
                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Rate of Fire: {0} shots every 5 seconds\n", CloseInProject.rOF);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        float GearCount = (float)CloseInProject.tracking / Constants.BFCTN.BeamFireControlTracking[CloseInProject.turretGearTech];
                        float FCfactor = ((float)Constants.BFCTN.BeamFireControlRange[CloseInProject.beamFCRangeTech] * 1000.0f) / 20000.0f;
                        float CIWS_ECCM = 0.0f;
                        if (CloseInProject.eCCM != 0)
                            CIWS_ECCM = 0.5f;

                        String TurretSize = String.Format("{0:N2}", (GearCount * 0.5f));
                        String FCSize = String.Format("{0:N4}", (1.0f / FCfactor));
                        String SensorSize = String.Format("{0:N4}", (3.0f / (float)Constants.SensorTN.ActiveStrength[CloseInProject.activeStrengthTech]));
                        String ECCMSize = String.Format("{0}", CIWS_ECCM);

                        Entry = String.Format("Dual GC: 5HS Turret: {0} HS    Fire Control: {1} HS    Sensor {2} HS    ECCM: {3}\n", TurretSize, FCSize, SensorSize, ECCMSize);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Overall Size: {0:N1} Tons    HTK: {1}\n", (CloseInProject.size * 50.0f), CloseInProject.htk);
                        else
                            Entry = String.Format("Overall Size: {0:N1} HS    HTK: {1}\n", CloseInProject.size, CloseInProject.htk);

                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Tracking Speed: {0} km/s     ECCM Level: {1}\n", CloseInProject.tracking, CloseInProject.eCCM);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", CloseInProject.cost, CloseInProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (CloseInProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, CloseInProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Base Chance to Hit: 50%\nDevelopment Cost for Project: {0}RP\n", CloseInProject.cost * 10);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Cloak
                case ComponentsViewModel.Components.Cloak:
                    break;
                #endregion

                #region EM
                case ComponentsViewModel.Components.EM:

                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        #region Size
                        /// <summary>
                        /// Pull size out of this mess.
                        /// </summary>
                        if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex < 9)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex + 1) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex >= 9 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex <= 13)
                        {
                            Size = 1.0f + (float)((m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 9) * 2) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex >= 14 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex <= 25)
                        {
                            Size = 2.0f + (float)(((m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 14) * 25) / 100.0f);
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex > 25)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 21);
                        }
                        #endregion

                        #region Hardening
                        /// <summary>
                        /// Get chance of destruction due to electronic damage.
                        /// </summary>
                        switch (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex)
                        {
                            case 0:
                                Hard = 1.0f;
                                break;
                            case 1:
                                Hard = 0.7f;
                                break;
                            case 2:
                                Hard = 0.5f;
                                break;
                            case 3:
                                Hard = 0.4f;
                                break;
                            case 4:
                                Hard = 0.3f;
                                break;
                            case 5:
                                Hard = 0.25f;
                                break;
                            case 6:
                                Hard = 0.2f;
                                break;
                            case 7:
                                Hard = 0.15f;
                                break;
                            case 8:
                                Hard = 0.1f;
                                break;
                        }
                        #endregion

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.EMSensorSensitivity];

                        if (FactTech > 11)
                            FactTech = 11;

                        int EM = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        Entry = "EM Detection Sensor EM";
                        PassiveSensorProject = new PassiveSensorDefTN(Entry, Size, Constants.SensorTN.PassiveStrength[EM], PassiveSensorType.EM, Hard,
                                                                     (byte)(m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex + 1));

                        if (Hard == 1.0f)
                            Entry = String.Format("{0}{1}-{2}", Entry, Size, PassiveSensorProject.rating);
                        else
                            Entry = String.Format("{0}{1}-{2}({3}%)", Entry, Size, PassiveSensorProject.rating, (Hard * 100.0f));

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("EM Sensitivity: {0}\n", PassiveSensorProject.rating);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Sensor Size: {0} Tons    Sensor HTK: {1}\n", (PassiveSensorProject.size * 50.0f), PassiveSensorProject.htk);
                        else
                            Entry = String.Format("Sensor Size: {0} HS    Sensor HTK: {1}\n", PassiveSensorProject.size, PassiveSensorProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Chance of destruction by electronic damage: {0}%\n", (Hard * 100.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", PassiveSensorProject.cost, PassiveSensorProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (PassiveSensorProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, PassiveSensorProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP", (PassiveSensorProject.cost * 10));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);


                    }



                    break;
                #endregion

                #region Engines
                case ComponentsViewModel.Components.Engine:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex != -1)
                    {

                        #region Engine Name

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.EngineBaseTech];

                        if (FactTech > 12)
                            FactTech = 12;

                        int EngineBase = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;


                        switch (EngineBase)
                        {
                            case 0:
                                Entry = "Conventional Engine";
                                break;
                            case 1:
                                Entry = "Nuclear Thermal Engine";
                                break;
                            case 2:
                                Entry = "Nuclear Pulse Engine";
                                break;
                            case 3:
                                Entry = "Ion Drive";
                                break;
                            case 4:
                                Entry = "Magneto-Plasma Drive";
                                break;
                            case 5:
                                Entry = "Internal Fusion Drive";
                                break;
                            case 6:
                                Entry = "Magnetic Fusion Drive";
                                break;
                            case 7:
                                Entry = "Inertial Fusion Drive";
                                break;
                            case 8:
                                Entry = "Solid-Core Antimatter Drive";
                                break;
                            case 9:
                                Entry = "Gas-Core Antimatter Drive";
                                break;
                            case 10:
                                Entry = "Plasma-Core Antimatter Drive";
                                break;
                            case 11:
                                Entry = "Beam-Core Antimatter Drive";
                                break;
                            case 12:
                                Entry = "Photonic Drive";
                                break;
                        }

                        #endregion

                        #region Power Mod
                        int MinPowerTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MinEnginePowerMod];
                        int MaxPowerTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MaxEnginePowerMod];

                        if (MinPowerTech > 5)
                            MinPowerTech = 5;
                        if (MaxPowerTech > 5)
                            MaxPowerTech = 5;

                        int minPower = 50;
                        switch (MinPowerTech)
                        {
                            case 0:
                                minPower = 40;
                                break;
                            case 1:
                                minPower = 30;
                                break;
                            case 2:
                                minPower = 25;
                                break;
                            case 3:
                                minPower = 20;
                                break;
                            case 4:
                                minPower = 15;
                                break;
                            case 5:
                                minPower = 10;
                                break;
                        }

                        float Power = (float)(minPower + (5 * m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex)) / 100.0f;

                        #endregion

                        #region Fuel Consumption

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.FuelConsumption];

                        if (FactTech > 12)
                            FactTech = 12;

                        int FC = FactTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        #endregion

                        #region Thermal Reduction

                        int TR = m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex;

                        #endregion

                        #region HyperDrive

                        float HD = -1.0f;
                        if (m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex != 0)
                        {
                            FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.HyperdriveSizeMod];

                            if (FactTech > 10)
                                FactTech = 10;

                            HD = Constants.EngineTN.HyperDriveSize[(FactTech - (m_oComponentDesignPanel.TechComboBoxSix.SelectedIndex - 1))];
                        }

                        #endregion

                        EngineProject = new EngineDefTN(Entry, Constants.EngineTN.EngineBase[EngineBase], Power, Constants.EngineTN.FuelConsumption[FC],
                                                        Constants.EngineTN.ThermalReduction[TR], (byte)(TR + 1), (m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex + 1), HD);

                        Entry = String.Format("{0} EP {1}", EngineProject.enginePower, Entry);


                        if (EngineProject.isMilitary == false)
                        {
                            Entry = String.Format("Commercial {0}", Entry);
                        }
                        else
                        {
                            Entry = String.Format("Military {0}", Entry);
                        }

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;
                        EngineProject.Name = Entry;

                        Entry = String.Format("Engine Power: {0}     Fuel Use Per Hour: {1:N2} Litres\n", EngineProject.enginePower, EngineProject.fuelUsePerHour);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Fuel Consumption per Engine Power Hour: {0:N3} Litres\n", (EngineProject.fuelUsePerHour / EngineProject.enginePower));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Engine Size: {0} Tons    Engine HTK: {1}\n", (EngineProject.size * 50.0f), EngineProject.htk);
                        else
                            Entry = String.Format("Engine Size: {0} HS    Engine HTK: {1}\n", EngineProject.size, EngineProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Thermal Signature: {0}     Exp Chance: {1}\n", EngineProject.thermalSignature, EngineProject.expRisk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", EngineProject.cost, EngineProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (EngineProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, EngineProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (EngineProject.isMilitary == true)
                        {
                            Entry = String.Format("Military Engine\n");
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }
                        if (EngineProject.hyperDriveMod != -1.0f)
                        {
                            Entry = String.Format("Hyper Drive\n");
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (EngineProject.cost * 10));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                    }
                    break;
                #endregion

                #region Gauss Cannon
                case ComponentsViewModel.Components.Gauss:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        int GaussROF = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.GaussCannonROF];
                        int GaussVel = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.GaussCannonVelocity];

                        if (GaussROF > 6)
                            GaussROF = 6;

                        if (GaussVel > 5)
                            GaussVel = 5;

                        int GR = GaussROF - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        int GV = GaussVel - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        int GA = m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        Entry = String.Format("Gauss Cannon R{0}-{1}", (GV + 1), (Constants.BeamWeaponTN.GaussAccuracy[GA] * 100.0f));
                        BeamProject = new BeamDefTN(Entry, ComponentTypeTN.Gauss, (byte)GA, (byte)GV, (byte)GR, 1.0f);

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Damage Output 1     Rate of Fire: {0} shots every 5 seconds     Range Modifier: {1}\n", BeamProject.shotCount, (BeamProject.weaponRangeTech + 1));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        String FormattedRange = BeamProject.range.ToString("#,###0");
                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Max Range {0} km     Size: {1} Tons    HTK: {2}\n", FormattedRange, (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Max Range {0} km     Size: {1} HS    HTK: {2}\n", FormattedRange, BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (BeamProject.size != 6.0f)
                        {
                            Entry = String.Format("This weapon has a penalty to accuracy. Chance to hit is multiplied by {0}\n", Constants.BeamWeaponTN.GaussAccuracy[GA]);
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }
                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                    }
                    break;
                #endregion

                #region High Power Microwave
                case ComponentsViewModel.Components.Microwave:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        int MicroTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MicrowaveFocal];
                        int MicroFocusTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MicrowaveFocusing];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];

                        if (MicroTech > 11)
                            MicroTech = 11;
                        if (MicroFocusTech > 11)
                            MicroFocusTech = 11;
                        if (CapTech > 11)
                            CapTech = 11;

                        int Cal = MicroTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                        ComponentTypeTN BeamType = ComponentTypeTN.Meson;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;
                        int Foc = MicroFocusTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        BeamProject = new BeamDefTN("Microwave", BeamType, (byte)Cal, (byte)Foc, (byte)Cap, 1.0f);

                        float RangeAdjust = BeamProject.range / 10000.0f;

                        Entry = String.Format("R{0}/C{1} High Power Microwave", RangeAdjust, BeamProject.weaponCapacitor);
                        BeamProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        String FormattedRange = BeamProject.range.ToString("#,###0");
                        Entry = String.Format("Max Range {0} km     Rate of Fire: {1} seconds     Focus Modifier: {2}\n", FormattedRange, BeamProject.rof, (BeamProject.weaponRangeTech + 1));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("HPM Size: {0} Tons    HTK: {1}\n", (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("HPM Size: {0} HS    HTK: {1}\n", BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Jump Engines
                case ComponentsViewModel.Components.Jump:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1)
                    {
                        int JumpEffTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.JumpEngineEfficiency];
                        int SquadSizeTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MaxSquadJumpSize];
                        int JumpRadiusTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MaxSquadJumpRadius];
                        int MinSizeTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MinJumpEngineSize];

                        if (JumpEffTech > Constants.JumpEngineTN.JumpEfficiencyMax)
                            JumpEffTech = Constants.JumpEngineTN.JumpEfficiencyMax;
                        if (SquadSizeTech > Constants.JumpEngineTN.SquadSizeMax)
                            SquadSizeTech = Constants.JumpEngineTN.SquadSizeMax;
                        if (JumpRadiusTech > Constants.JumpEngineTN.JumpRadiusMax)
                            JumpRadiusTech = Constants.JumpEngineTN.JumpRadiusMax;
                        if (MinSizeTech > Constants.JumpEngineTN.MinimumSizeMax)
                            MinSizeTech = Constants.JumpEngineTN.MinimumSizeMax;

                        int Eff = JumpEffTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                        int SquadSize = SquadSizeTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;
                        int JumpRadius = JumpRadiusTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        int JESize = 1;
                        int Count = 0;
                        while (JESize <= 1000)
                        {
                            if(Count == m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex)
                            {
                                break;
                            }

                            if (JESize < 50)
                                JESize++;
                            else if (JESize < 100)
                                JESize += 5;
                            else
                                JESize += 10;

                            Count++;
                        }
                        JumpEngineDefTN.JDType JumpType = (JumpEngineDefTN.JDType)m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex;

                        JumpEngineProject = new JumpEngineDefTN("JumpEngine", Eff, SquadSize, JumpRadius, MinSizeTech, JumpType, JESize);

                        if (JumpType == JumpEngineDefTN.JDType.Military)
                        {
                            int JR = (int)Math.Round((float)JumpEngineProject.jumpRadius / 1000.0f);
                            Entry = String.Format("J{0}({1}-{2}) Military Jump Drive",JumpEngineProject.maxJumpRating, JumpEngineProject.squadronSize, JR);
                            JumpEngineProject.Name = Entry;
                        }
                        else if (JumpType == JumpEngineDefTN.JDType.Commercial)
                        {
                            int CSize = (int)Math.Round((float)JumpEngineProject.maxJumpRating / 1000.0f);
                            Entry = String.Format("JC{0}K Commerical Jump Drive", CSize);
                            JumpEngineProject.Name = Entry;
                        }
                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        int SSize = JumpEngineProject.maxJumpRating / (int)Constants.ShipTN.TonsPerHS;
                        int JRadius = (int)Math.Round((float)JumpEngineProject.jumpRadius / 1000.0f);
                        Entry = String.Format("Max Ship Size: {0} ({1} tons)     Max Squadron Size: {2}     Max Jump Radius: {3}\n", SSize, JumpEngineProject.maxJumpRating, 
                                              JumpEngineProject.squadronSize, JRadius );
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Jump Engine Size: {0} Tons    Efficiency: {1}    Jump Engine HTK: {2}\n", JumpEngineProject.size * (int)Constants.ShipTN.TonsPerHS, 
                                                  JumpEngineProject.jumpEngineEfficiency, JumpEngineProject.htk);
                        else
                            Entry = String.Format("Jump Engine Size: {0} HS    Efficiency: {1}    Jump Engine HTK: {2}\n", JumpEngineProject.size, JumpEngineProject.jumpEngineEfficiency,
                                                  JumpEngineProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", JumpEngineProject.cost, JumpEngineProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (JumpEngineProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, JumpEngineProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (JumpEngineProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Lasers
                case ComponentsViewModel.Components.Laser:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1)
                    {
                        int AdvLaserTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.AdvancedLaserFocal];
                        int LaserTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.LaserFocal];
                        int WaveTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.LaserWavelength];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];
                        int ReduceTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ReducedSizeLasers];
                        int SpinalTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.SpinalMount];

                        if (AdvLaserTech > 11)
                            AdvLaserTech = 11;
                        if (LaserTech > 11)
                            LaserTech = 11;
                        if (WaveTech > 11)
                            WaveTech = 11;
                        if (CapTech > 11)
                            CapTech = 11;
                        if (ReduceTech > 1)
                            ReduceTech = 1;
                        if (SpinalTech > 1)
                            SpinalTech = 1;

                        int Cal = -1;
                        ComponentTypeTN BeamType = ComponentTypeTN.TypeCount;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;
                        int Vel = WaveTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;
                        int Reduce = (ReduceTech - m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex + 1);
                        int Spinal = (SpinalTech - m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex + 1);
                        float red = 1.0f;
                        BeamDefTN.MountType MType = BeamDefTN.MountType.Standard;

                        if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex > AdvLaserTech)
                        {
                            Cal = LaserTech - (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex - AdvLaserTech - 1);
                            BeamType = ComponentTypeTN.Laser;

                            float Capacitor = Constants.BeamWeaponTN.Capacitor[Cap];
                            switch (Reduce)
                            {
                                case 1:
                                    Capacitor = Capacitor / 4.0f;
                                    red = 0.75f;
                                    break;
                                case 0:
                                    Capacitor = Capacitor / 20.0f;
                                    red = 0.5f;
                                    break;
                            }

                            String CapString = "N/A";
                            if (red == 1.0f)
                                CapString = String.Format("{0}", Capacitor);
                            else
                                CapString = String.Format("{0:N1}", Capacitor);


                            String Calibre = Constants.BeamWeaponTN.SizeClass[Cal].ToString();
                            switch (Spinal)
                            {
                                case 1:
                                    MType = BeamDefTN.MountType.Spinal;
                                    Calibre = Math.Round(Constants.BeamWeaponTN.SizeClass[Cal] * 1.25f).ToString();
                                    break;
                                case 0:
                                    MType = BeamDefTN.MountType.AdvancedSpinal;
                                    Calibre = Math.Round(Constants.BeamWeaponTN.SizeClass[Cal] * 1.5f).ToString();
                                    break;
                            }


                            Entry = String.Format("{0}cm C{1} {2}", Calibre, CapString, m_oComponentDesignPanel.TechComboBoxTwo.SelectedItem);


                        }
                        else
                        {
                            Cal = AdvLaserTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                            BeamType = ComponentTypeTN.AdvLaser;

                            float Capacitor = Constants.BeamWeaponTN.Capacitor[Cap];
                            switch (Reduce)
                            {
                                case 1:
                                    Capacitor = Capacitor / 4.0f;
                                    red = 0.75f;
                                    break;
                                case 0:
                                    Capacitor = Capacitor / 20.0f;
                                    red = 0.5f;
                                    break;
                            }

                            String CapString = "N/A";
                            if (red == 1.0f)
                                CapString = String.Format("{0}", Capacitor);
                            else
                                CapString = String.Format("{0:N1}", Capacitor);


                            String Calibre = Constants.BeamWeaponTN.SizeClass[Cal].ToString();
                            switch (Spinal)
                            {
                                case 1:
                                    MType = BeamDefTN.MountType.Spinal;
                                    Calibre = Math.Round(Constants.BeamWeaponTN.SizeClass[Cal] * 1.25f).ToString();
                                    break;
                                case 0:
                                    MType = BeamDefTN.MountType.AdvancedSpinal;
                                    Calibre = Math.Round(Constants.BeamWeaponTN.SizeClass[Cal] * 1.5f).ToString();
                                    break;
                            }


                            Entry = String.Format("{0}cm C{1} Advanced {2}", Calibre, CapString, m_oComponentDesignPanel.TechComboBoxTwo.SelectedItem);
                        }
                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        BeamProject = new BeamDefTN(Entry, BeamType, (byte)Cal, (byte)Vel, (byte)Cap, red, MType);

                        Entry = String.Format("Damage Output {0}     Rate of Fire: {1} seconds     Range Modifier: {2}\n", BeamProject.damage[0], BeamProject.rof, (Vel + 1));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        String FormattedRange = BeamProject.range.ToString("#,###0");

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Max Range {0} km     Laser Size: {1} Tons    Laser HTK: {2}\n", FormattedRange, (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Max Range {0} km     Laser Size: {1} HS    Laser HTK: {2}\n", FormattedRange, BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (Spinal != 2)
                        {
                            m_oComponentDesignPanel.ParametersTextBox.AppendText("Spinal Weapon Only\n");
                        }

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Magazines
                case ComponentsViewModel.Components.Magazine:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex != -1)
                    {
                        int FeedTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MagazineFeedEfficiency];
                        int EjectTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MagazineEjectionSystem];
                        int ArmourTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ArmourProtection];

                        if (FeedTech > 8)
                            FeedTech = 8;
                        if (EjectTech > 8)
                            EjectTech = 8;
                        if (ArmourTech > 12)
                            ArmourTech = 12;

                        int feed = FeedTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                        int eject = EjectTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;
                        int armour = ArmourTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;
                        int size = m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex + 1;
                        int htk = m_oComponentDesignPanel.TechComboBoxFive.SelectedIndex + 1;

                        Entry = "Magazine";
                        MagazineProject = new MagazineDefTN(Entry, (float)size, (byte)htk, feed, eject, armour);

                        Entry = String.Format("Capacity {0} Magazine: Exp {1}%  HTK{2}", MagazineProject.capacity, Math.Round((1.0f - Constants.MagazineTN.Ejection[eject]) * 100.0f), htk);
                        MagazineProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        switch (MagazineProject.armorTech)
                        {
                            case 0:
                                Entry = "Conventional";
                                break;
                            case 1:
                                Entry = "Duranium";
                                break;
                            case 2:
                                Entry = "High Density Duranium";
                                break;
                            case 3:
                                Entry = "Composite";
                                break;
                            case 4:
                                Entry = "Ceramic Composite";
                                break;
                            case 5:
                                Entry = "Laminate Composite";
                                break;
                            case 6:
                                Entry = "Compressed Carbon";
                                break;
                            case 7:
                                Entry = "Biphased Carbide";
                                break;
                            case 8:
                                Entry = "Crystaline Composite";
                                break;
                            case 9:
                                Entry = "Superdense";
                                break;
                            case 10:
                                Entry = "Bonded Superdense";
                                break;
                            case 11:
                                Entry = "Coherent Superdense";
                                break;
                            case 12:
                                Entry = "Collapsium";
                                break;
                        }

                        String ArmourString = String.Format("{0} Armour", Entry);

                        Entry = String.Format("Capacity: {0}     Internal Armour: {1} HS     Explosion Chance: {2}\nArmour used: {3}\n", MagazineProject.capacity, MagazineProject.armourFactor,
                                              Math.Round((1.0f - Constants.MagazineTN.Ejection[eject]) * 100.0f), ArmourString);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Magazine Size: {0} Tons    Magazine HTK: {1}\n", (MagazineProject.size * 50.0f), MagazineProject.htk);
                        else
                            Entry = String.Format("Magazine Size: {0} HS    Magazine HTK: {1}\n", MagazineProject.size, MagazineProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", MagazineProject.cost, MagazineProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (MagazineProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, MagazineProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (MagazineProject.cost * 10));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        //FormattedRange = RangeFormat.ToString("#,##0");
                    }
                    break;
                #endregion

                #region Meson Cannons
                case ComponentsViewModel.Components.Meson:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        int MesonTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MesonFocal];
                        int MesonFocusTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MesonFocusing];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];

                        if (MesonTech > 11)
                            MesonTech = 11;
                        if (MesonFocusTech > 11)
                            MesonFocusTech = 11;
                        if (CapTech > 11)
                            CapTech = 11;

                        int Cal = MesonTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                        ComponentTypeTN BeamType = ComponentTypeTN.Meson;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;
                        int Foc = MesonFocusTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        BeamProject = new BeamDefTN("Meson", BeamType, (byte)Cal, (byte)Foc, (byte)Cap, 1.0f);

                        float RangeAdjust = BeamProject.range / 10000.0f;

                        Entry = String.Format("R{0}/C{1} Meson Cannon", RangeAdjust, BeamProject.weaponCapacitor);
                        BeamProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        String FormattedRange = BeamProject.range.ToString("#,###0");
                        Entry = String.Format("Max Range {0} km     Rate of Fire: {1} seconds     Focus Modifier: {2}\n", FormattedRange, BeamProject.rof, (BeamProject.weaponRangeTech + 1));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Meson Cannon Size: {0} Tons    Meson Cannon HTK: {1}\n", (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Meson Cannon Size: {0} HS    Meson Cannon HTK: {1}\n", BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Missile Engines
                case ComponentsViewModel.Components.MissileEngine:
                    /// <summary>
                    /// Sanity Check:
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1)
                    {
                        #region Missile Engine Name / Tech Base

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.EngineBaseTech];

                        if (FactTech > 12)
                            FactTech = 12;

                        int EngineBase = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;


                        switch (EngineBase)
                        {
                            case 0:
                                Entry = "Conventional Engine";
                                break;
                            case 1:
                                Entry = "Nuclear Thermal Engine";
                                break;
                            case 2:
                                Entry = "Nuclear Pulse Engine";
                                break;
                            case 3:
                                Entry = "Ion Drive";
                                break;
                            case 4:
                                Entry = "Magneto-Plasma Drive";
                                break;
                            case 5:
                                Entry = "Internal Fusion Drive";
                                break;
                            case 6:
                                Entry = "Magnetic Fusion Drive";
                                break;
                            case 7:
                                Entry = "Inertial Fusion Drive";
                                break;
                            case 8:
                                Entry = "Solid-Core Antimatter Drive";
                                break;
                            case 9:
                                Entry = "Gas-Core Antimatter Drive";
                                break;
                            case 10:
                                Entry = "Plasma-Core Antimatter Drive";
                                break;
                            case 11:
                                Entry = "Beam-Core Antimatter Drive";
                                break;
                            case 12:
                                Entry = "Photonic Drive";
                                break;
                        }

                        #endregion

                        #region Power Mod
                        int MinPowerTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MinEnginePowerMod];
                        int MaxPowerTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.MaxEnginePowerMod];

                        if (MinPowerTech > 5)
                            MinPowerTech = 5;
                        if (MaxPowerTech > 5)
                            MaxPowerTech = 5;

                        int minPower = 50;
                        switch (MinPowerTech)
                        {
                            case 0:
                                minPower = 40;
                                break;
                            case 1:
                                minPower = 30;
                                break;
                            case 2:
                                minPower = 25;
                                break;
                            case 3:
                                minPower = 20;
                                break;
                            case 4:
                                minPower = 15;
                                break;
                            case 5:
                                minPower = 10;
                                break;
                        }

                        float Power = (float)(minPower + (5 * m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex)) / 100.0f;
                        #endregion

                        #region Fuel Consumption

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.FuelConsumption];

                        if (FactTech > 12)
                            FactTech = 12;

                        int FC = FactTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        #endregion

                        float size = (10.0f + (float)(m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex)) / 100.0f;

                        if (size < 0.1f)
                            size = 0.1f;

                        MissileEngineProject = new MissileEngineDefTN(Entry, Constants.EngineTN.EngineBase[EngineBase], Power, Constants.EngineTN.FuelConsumption[FC], size);

                        Entry = String.Format("{0} EP {1}", MissileEngineProject.enginePower, Entry);
                        MissileEngineProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Engine Power: {0:N3}      Fuel Use Per Hour: {1:N2} Litres\n", MissileEngineProject.enginePower, MissileEngineProject.fuelConsumption);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        float EPH = MissileEngineProject.fuelConsumption / MissileEngineProject.enginePower;
                        Entry = String.Format("Fuel Consumption per Engine Power Hour: {0:N3} Litres\n", EPH);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Engine Size: {0:N2} Tons      Cost: {1}\n", (MissileEngineProject.size * 50.0f), MissileEngineProject.cost);
                        else
                            Entry = String.Format("Engine Size: {0:N2} MSP      Cost: {1}\n", (MissileEngineProject.size * 20.0f), MissileEngineProject.cost);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Thermal Signature: {0:N2}\n", MissileEngineProject.thermalSignature);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (MissileEngineProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, MissileEngineProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0:N0}RP\n", (MissileEngineProject.cost * 200));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Missile Launcher
                case ComponentsViewModel.Components.MissileLauncher:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex != -1)
                    {

                        int ReloadTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.LauncherReloadRate];
                        int ReduceTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ReducedSizeLaunchers];

                        if (ReloadTech > 11)
                            ReloadTech = 11;
                        if (ReduceTech > 5)
                            ReduceTech = 5;

                        int size = m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex + 1;
                        int reload = (ReloadTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex) + 1;

                        bool ShipPDC = false;
                        if (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex == 0)
                        {
                            ShipPDC = false;
                            Entry = String.Format("Size {0}", size);
                        }
                        else
                        {
                            ShipPDC = true;
                            Entry = String.Format("PDC Size {0}", size);
                        }

                        int Reduce = m_oComponentDesignPanel.TechComboBoxFour.SelectedIndex;

                        if (Reduce == Constants.LauncherTN.BoxLauncher)
                        {
                            Entry = String.Format("{0} Box Launcher", Entry);
                        }
                        else if (Reduce == 0)
                        {
                            Entry = String.Format("{0} Missile Launcher", Entry);
                        }
                        else
                        {
                            Entry = String.Format("{0} Missile Launcher ({1}% Reduction)", Entry, (Constants.LauncherTN.Reduction[Reduce] * 100.0f));
                        }

                        LauncherProject = new MissileLauncherDefTN(Entry, (float)size, reload, ShipPDC, Reduce);

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Maximum Missile Size: {0}", size);

                        if (Reduce != Constants.LauncherTN.BoxLauncher)
                        {
                            Entry = String.Format("{0}     Rate of Fire: {1} seconds\n", Entry, LauncherProject.rateOfFire);
                        }
                        else
                        {
                            float HR = (float)LauncherProject.hangarReload / 60.0f;
                            float MF = (float)LauncherProject.mFReload / 3600.0f;
                            Entry = String.Format("{0}     Hangar Reload: {1} minutes    MF Reload: {2} hours\n", Entry, HR, MF);
                        }
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Launcher Size: {0} Tons    Launcher HTK: {1}\n", (LauncherProject.size * 50.0f), LauncherProject.htk);
                        else
                            Entry = String.Format("Launcher Size: {0} HS    Launcher HTK: {1}\n", LauncherProject.size, LauncherProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost Per Launcher: {0}    Crew Per Launcher: {1}\n", LauncherProject.cost, LauncherProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (ShipPDC == true)
                        {
                            Entry = "PDC Only\n";
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (LauncherProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, LauncherProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", Math.Round(LauncherProject.cost * 10));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (Reduce == Constants.LauncherTN.BoxLauncher)
                        {
                            Entry = "\nNote that Box Launchers are not affected by increases in Reload Rate Technology as they are reloaded externally in a hangar deck or at maintenance facilities\n";
                            m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                        }
                    }
                    break;
                #endregion

                #region New Species
                case ComponentsViewModel.Components.NewSpecies:
                    break;
                #endregion

                #region Particle beams
                case ComponentsViewModel.Components.Particle:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        int AdvPartTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.AdvancedParticleBeamStrength];
                        int PartTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ParticleBeamStrength];
                        int PartRangeTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ParticleBeamRange];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];

                        if (AdvPartTech > 10)
                            AdvPartTech = 10;
                        if (PartTech > 10)
                            PartTech = 10;
                        if (PartRangeTech > 11)
                            PartRangeTech = 11;
                        if (CapTech > 11)
                            CapTech = 11;

                        int Cal = -1;
                        ComponentTypeTN BeamType = ComponentTypeTN.TypeCount;
                        int Range = PartRangeTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex > AdvPartTech)
                        {
                            BeamType = ComponentTypeTN.Particle;
                            Cal = PartTech - (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex - AdvPartTech - 1);

                            float RangeAdjust = (float)Constants.BeamWeaponTN.ParticleRange[Range];
                            Entry = String.Format("Particle Beam-{0} C{1}/R{2}", Constants.BeamWeaponTN.ParticleDamage[Cal], Constants.BeamWeaponTN.Capacitor[Cap], RangeAdjust);
                        }
                        else
                        {
                            BeamType = ComponentTypeTN.AdvParticle;
                            Cal = AdvPartTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                            float RangeAdjust = (float)Constants.BeamWeaponTN.ParticleRange[Range];
                            Entry = String.Format("Advanced Particle Beam-{0} C{1}/R{2}", Constants.BeamWeaponTN.AdvancedParticleDamage[Cal], Constants.BeamWeaponTN.Capacitor[Cap], RangeAdjust);
                        }

                        BeamProject = new BeamDefTN(Entry, BeamType, (byte)Cal, (byte)Range, (byte)Cap, 1.0f);

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        String FormattedRange = BeamProject.range.ToString("#,###0");

                        Entry = String.Format("Beam Strength {0}     Rate of Fire: {1} seconds     Maximum Range: {2} km\n", BeamProject.damage[0], BeamProject.rof, FormattedRange);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Launcher Size: {0} Tons    Launcher HTK: {1}\n", (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Launcher Size: {0} HS    Launcher HTK: {1}\n", BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Plasma Carronades
                case ComponentsViewModel.Components.Plasma:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1)
                    {

                        int AdvPlasmaTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.AdvancedPlasmaCarronadeCalibre];
                        int PlasmaTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.PlasmaCarronadeCalibre];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];

                        if (AdvPlasmaTech > 9)
                            AdvPlasmaTech = 9;
                        if (PlasmaTech > 9)
                            PlasmaTech = 9;
                        if (CapTech > 11)
                            CapTech = 11;

                        int Cal = -1;
                        ComponentTypeTN BeamType = ComponentTypeTN.TypeCount;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex > AdvPlasmaTech)
                        {
                            Cal = PlasmaTech - (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex - AdvPlasmaTech - 1);
                            BeamType = ComponentTypeTN.Plasma;

                            Entry = String.Format("{0}cm C{1} Carronade", Constants.BeamWeaponTN.SizeClass[Cal + 2], Constants.BeamWeaponTN.Capacitor[Cap]);
                        }
                        else
                        {
                            Cal = AdvPlasmaTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                            BeamType = ComponentTypeTN.AdvPlasma;

                            Entry = String.Format("{0}cm C{1} Advanced Carronade", Constants.BeamWeaponTN.SizeClass[Cal + 2], Constants.BeamWeaponTN.Capacitor[Cap]);
                        }


                        BeamProject = new BeamDefTN(Entry, BeamType, (byte)(Cal + 2), 1, (byte)Cap, 1.0f);

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Damage Output {0}     Rate of Fire: {1} seconds\n", BeamProject.damage[0], BeamProject.rof);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        String FormattedRange = BeamProject.range.ToString("#,###0");

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Max Range {0} km     Carronade Size: {1} Tons    Carronade HTK: {2}\n", FormattedRange, (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Max Range {0} km     Carronade Size: {1} HS    Carronade HTK: {2}\n", FormattedRange, BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }


                    break;
                #endregion

                #region Plasma Torpedos
                case ComponentsViewModel.Components.PlasmaTorp:
                    break;
                #endregion

                #region Power Plants
                case ComponentsViewModel.Components.Reactor:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {

                        #region Get boost
                        switch (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex)
                        {
                            case 0:
                                Boost = 1.0f;
                                break;
                            case 1:
                                Boost = 1.05f;
                                break;
                            case 2:
                                Boost = 1.10f;
                                break;
                            case 3:
                                Boost = 1.15f;
                                break;
                            case 4:
                                Boost = 1.2f;
                                break;
                            case 5:
                                Boost = 1.25f;
                                break;
                            case 6:
                                Boost = 1.3f;
                                break;
                            case 7:
                                Boost = 1.4f;
                                break;
                            case 8:
                                Boost = 1.5f;
                                break;
                        }
                        #endregion

                        #region Get size
                        switch (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex)
                        {
                            case 0:
                                Size = 0.1f;
                                break;
                            case 1:
                                Size = 0.2f;
                                break;
                            case 2:
                                Size = 0.5f;
                                break;
                            default:
                                Size = (float)(m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex - 2);
                                break;
                        }
                        #endregion

                        #region Set Name. Hard coded again, DB here as well.
                        switch (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex)
                        {
                            case 0:
                                Entry = "Vacuum Energy Power Plant Technology";
                                break;
                            case 1:
                                Entry = "Beam-Core Antimatter Reactor Technology";
                                break;
                            case 2:
                                Entry = "Plasma-Core Antimatter Reactor Technology";
                                break;
                            case 3:
                                Entry = "Gas-Core Antimatter Reactor Technology";
                                break;
                            case 4:
                                Entry = "Solid-Core Antimatter Reactor Technology";
                                break;
                            case 5:
                                Entry = "Inertial Confinement Fusion Reactor Technology";
                                break;
                            case 6:
                                Entry = "Magnetic Confinement Fusion Reactor Technology";
                                break;
                            case 7:
                                Entry = "Tokamak Fusion Reactor Technology";
                                break;
                            case 8:
                                Entry = "Stellarator Fusion Reactor Technology";
                                break;
                            case 9:
                                Entry = "Gas Cooled Fast Reactor Technology";
                                break;
                            case 10:
                                Entry = "Pebble Bed Reactor Technology";
                                break;
                            case 11:
                                Entry = "Pressurised Water Reactor Technology";
                                break;
                        }
                        #endregion

                        if (Boost == 1.0f)
                            Entry = String.Format("{0} PB-1", Entry);
                        else
                            Entry = String.Format("{0} PB-{1}", Entry, Boost);

                        ReactorProject = new ReactorDefTN(Entry, (byte)(11 - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex), Size, Boost);

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Power Output: {0}     Explosion Chance: {1}\n", ReactorProject.powerGen, ReactorProject.expRisk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Reactor Size: {0} Tons    Reactor HTK: {1}\n", (ReactorProject.size * 50.0f), ReactorProject.htk);
                        else
                            Entry = String.Format("Reactor Size: {0} HS    Reactor HTK: {1}\n", ReactorProject.size, ReactorProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", ReactorProject.cost, ReactorProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (ReactorProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, ReactorProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP\n", (ReactorProject.cost) * 10);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }

                    break;
                #endregion

                #region Railguns
                case ComponentsViewModel.Components.Rail:
                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        int AdvRailTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.AdvancedRailgun];
                        int RailTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.Railgun];
                        int RailVelTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.RailgunVelocity];
                        int CapTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.CapacitorChargeRate];

                        if (AdvRailTech > 9)
                            AdvRailTech = 9;
                        if (RailTech > 9)
                            RailTech = 9;
                        if (RailVelTech > 9)
                            RailVelTech = 9;
                        if (CapTech > 11)
                            CapTech = 11;

                        int Cal = -1;
                        ComponentTypeTN BeamType = ComponentTypeTN.TypeCount;
                        int Cap = CapTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;
                        int Vel = RailVelTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex > AdvRailTech)
                        {
                            Cal = RailTech - (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex - AdvRailTech - 1);
                            BeamType = ComponentTypeTN.Rail;


                            /// <summary>
                            /// This is the counterpart to the earlier kludge of allowing 45cm rail guns:
                            /// </summary>
                            switch (Cal)
                            {
                                case 9:
                                    Entry = String.Format("{0}cm Railgun V{1}/C{2}", "50", Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                                case 8:
                                    Entry = String.Format("{0}cm Railgun V{1}/C{2}", "45", Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                                default:
                                    Entry = String.Format("{0}cm Railgun V{1}/C{2}", Constants.BeamWeaponTN.SizeClass[Cal], Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                            }
                        }
                        else
                        {
                            Cal = AdvRailTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;
                            BeamType = ComponentTypeTN.AdvRail;

                            switch (Cal)
                            {
                                case 9:
                                    Entry = String.Format("{0}cm Advanced Railgun V{1}/C{2}", "50", Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                                case 8:
                                    Entry = String.Format("{0}cm Advanced Railgun V{1}/C{2}", "45", Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                                default:
                                    Entry = String.Format("{0}cm Advanced Railgun V{1}/C{2}", Constants.BeamWeaponTN.SizeClass[Cal], Vel, Constants.BeamWeaponTN.Capacitor[Cap]);
                                    break;
                            }
                        }

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        BeamProject = new BeamDefTN(Entry, BeamType, (byte)Cal, (byte)Vel, (byte)Cap, 1.0f);

                        Entry = String.Format("Damage Per Shot ({0}): {1}     Rate of Fire: {2} seconds     Range Modifier: {3}\n", BeamProject.shotCount, BeamProject.damage[0], BeamProject.rof, Vel);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        String FormattedRange = BeamProject.range.ToString("#,###0");

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Max Range {0} km     Railgun Size: {1} Tons    Railgun HTK: {2}\n", FormattedRange, (BeamProject.size * 50.0f), BeamProject.htk);
                        else
                            Entry = String.Format("Max Range {0} km     Railgun Size: {1} HS    Railgun HTK: {2}\n", FormattedRange, BeamProject.size, BeamProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Power Requirement: {0}    Power Recharge per 5 Secs: {1}\n", BeamProject.powerRequirement, BeamProject.weaponCapacitor);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", BeamProject.cost, BeamProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (BeamProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, BeamProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("\nDevelopment Cost for Project: {0}RP\n", (BeamProject.cost * 50));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }
                    break;
                #endregion

                #region Absorption Shields
                case ComponentsViewModel.Components.ShieldAbs:
                    break;
                #endregion

                #region Standard Shields
                case ComponentsViewModel.Components.ShieldStd:

                    /// <summary>
                    /// Sanity check.
                    /// </summary>
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.StandardShieldStrength];

                        if (FactTech > 11)
                            FactTech = 11;

                        int SS = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.StandardShieldRegen];

                        if (FactTech > 11)
                            FactTech = 11;

                        int SR = FactTech - m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex;

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.FuelConsumption];

                        if (FactTech > 12)
                            FactTech = 12;

                        int FC = FactTech - m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex;

                        #region name
                        switch (SS)
                        {
                            case 0:
                                Entry = "Alpha";
                                break;
                            case 1:
                                Entry = "Beta";
                                break;
                            case 2:
                                Entry = "Gamma";
                                break;
                            case 3:
                                Entry = "Delta";
                                break;
                            case 4:
                                Entry = "Epsilon";
                                break;
                            case 5:
                                Entry = "Theta";
                                break;
                            case 6:
                                Entry = "Xi";
                                break;
                            case 7:
                                Entry = "Omicron";
                                break;
                            case 8:
                                Entry = "Sigma";
                                break;
                            case 9:
                                Entry = "Tau";
                                break;
                            case 10:
                                Entry = "Psi";
                                break;
                            case 11:
                                Entry = "Omega";
                                break;
                        }
                        #endregion

                        ShieldProject = new ShieldDefTN(Entry, SS, SR, Constants.EngineTN.FuelConsumption[FC], 1.0f, ComponentTypeTN.Shield);

                        float RechargeTime = (ShieldProject.shieldPool / ShieldProject.shieldGen) * 300.0f;

                        Entry = String.Format("{0} R{1}/{2} Shields", Entry, RechargeTime, (ShieldProject.fuelCostPerHour * 24.0f));

                        ShieldProject.Name = Entry;

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Shield Strength: {0}\n", ShieldProject.shieldPool);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Recharge Rate: {0}    Recharge Time: {1} seconds\n", ShieldProject.shieldGen, RechargeTime);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}     Daily Fuel Cost while Active: {2} Litres\n", ShieldProject.cost, ShieldProject.crew, (ShieldProject.fuelCostPerHour * 24.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (ShieldProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, ShieldProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP\n", (ShieldProject.cost * 100));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);
                    }

                    break;
                #endregion

                #region Thermal Sensors
                case ComponentsViewModel.Components.Thermal:
                    if (m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex != -1 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex != -1 &&
                        m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex != -1)
                    {
                        #region Size
                        /// <summary>
                        /// Pull size out of this mess.
                        /// </summary>
                        if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex < 9)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex + 1) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex >= 9 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex <= 13)
                        {
                            Size = 1.0f + (float)((m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 9) * 2) / 10.0f;
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex >= 14 && m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex <= 25)
                        {
                            Size = 2.0f + (float)(((m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 14) * 25) / 100.0f);
                        }
                        else if (m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex > 25)
                        {
                            Size = (float)(m_oComponentDesignPanel.TechComboBoxTwo.SelectedIndex - 21);
                        }
                        #endregion

                        #region Hardening
                        /// <summary>
                        /// Get chance of destruction due to electronic damage.
                        /// </summary>
                        switch (m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex)
                        {
                            case 0:
                                Hard = 1.0f;
                                break;
                            case 1:
                                Hard = 0.7f;
                                break;
                            case 2:
                                Hard = 0.5f;
                                break;
                            case 3:
                                Hard = 0.4f;
                                break;
                            case 4:
                                Hard = 0.3f;
                                break;
                            case 5:
                                Hard = 0.25f;
                                break;
                            case 6:
                                Hard = 0.2f;
                                break;
                            case 7:
                                Hard = 0.15f;
                                break;
                            case 8:
                                Hard = 0.1f;
                                break;
                        }
                        #endregion

                        FactTech = _CurrnetFaction.FactionTechLevel[(int)Faction.FactionTechnology.ThermalSensorSensitivity];

                        if (FactTech > 11)
                            FactTech = 11;

                        int TH = FactTech - m_oComponentDesignPanel.TechComboBoxOne.SelectedIndex;

                        Entry = "Thermal Sensor TH";
                        PassiveSensorProject = new PassiveSensorDefTN(Entry, Size, Constants.SensorTN.PassiveStrength[TH], PassiveSensorType.Thermal, Hard,
                                                                     (byte)(m_oComponentDesignPanel.TechComboBoxThree.SelectedIndex + 1));

                        if (Hard == 1.0f)
                            Entry = String.Format("{0}{1}-{2}", Entry, Size, PassiveSensorProject.rating);
                        else
                            Entry = String.Format("{0}{1}-{2}({3}%)", Entry, Size, PassiveSensorProject.rating, (Hard * 100.0f));

                        m_oComponentDesignPanel.TechNameTextBox.Text = Entry;

                        Entry = String.Format("Thermal Sensor Sensitivity: {0}\n", PassiveSensorProject.rating);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        if (m_oComponentDesignPanel.SizeTonsCheckBox.Checked == true)
                            Entry = String.Format("Sensor Size: {0} Tons    Sensor HTK: {1}\n", (PassiveSensorProject.size * 50.0f), PassiveSensorProject.htk);
                        else
                            Entry = String.Format("Sensor Size: {0} HS    Sensor HTK: {1}\n", PassiveSensorProject.size, PassiveSensorProject.htk);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Chance of destruction by electronic damage: {0}%\n", (Hard * 100.0f));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Cost: {0}    Crew: {1}\n", PassiveSensorProject.cost, PassiveSensorProject.crew);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Materials Required:");

                        for (int mineralIterator = 0; mineralIterator < (int)Constants.Minerals.MinerialNames.MinerialCount; mineralIterator++)
                        {
                            if (PassiveSensorProject.minerialsCost[mineralIterator] != 0)
                            {
                                Entry = String.Format("{0} {1:N1}x {2}", Entry, PassiveSensorProject.minerialsCost[mineralIterator], (Constants.Minerals.MinerialNames)mineralIterator);
                            }
                        }
                        Entry = String.Format("{0}\n\n", Entry);
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);

                        Entry = String.Format("Development Cost for Project: {0}RP", (PassiveSensorProject.cost * 10));
                        m_oComponentDesignPanel.ParametersTextBox.AppendText(Entry);


                    }
                    break;
                #endregion
            }
            #endregion
        }
コード例 #6
0
        /// <summary>
        /// Every faction will start with some components defined and ready to use, though the engines and sensors shouldn't be here just yet.
        /// </summary>
        public void AddInitialComponents()
        {
            /// <summary>
            /// Watch total component count when adding or subtracting from this function
            /// </summary>
            TotalComponents = 0;

            GeneralComponentDefTN CrewQ = new GeneralComponentDefTN("Crew Quarters", 1.0f, 0, 10.0m, ComponentTypeTN.Crew);
            GeneralComponentDefTN CrewQS = new GeneralComponentDefTN("Crew Quarters - Small", 0.2f, 0, 2.0m, ComponentTypeTN.Crew);
            GeneralComponentDefTN FuelT = new GeneralComponentDefTN("Fuel Storage", 1.0f, 0, 10.0m, ComponentTypeTN.Fuel);
            GeneralComponentDefTN FuelTS = new GeneralComponentDefTN("Fuel Storage - Small", 0.2f, 0, 3.0m, ComponentTypeTN.Fuel);
            GeneralComponentDefTN EBay = new GeneralComponentDefTN("Engineering Spaces", 1.0f, 5, 10.0m, ComponentTypeTN.Engineering);
            GeneralComponentDefTN Bridge = new GeneralComponentDefTN("Bridge", 1.0f, 5, 10.0m, ComponentTypeTN.Bridge);
            TotalComponents = TotalComponents + 6;

            CrewQuarters.Add(CrewQ);
            CrewQuarters.Add(CrewQS);
            FuelStorage.Add(FuelT);
            FuelStorage.Add(FuelTS);
            EngineeringSpaces.Add(EBay);
            OtherComponents.Add(Bridge);

            /// <summary>
            /// These components aren't really basic, but I'll put them in anyway for the time being. Count 6 to 17
            /// </summary>
            EngineDefTN EngDef = new EngineDefTN("25 EP Nuclear Thermal Engine", 5.0f, 1.0f, 1.0f, 1.0f, 1, 5, -1.0f);
            ActiveSensorDefTN ActDef = new ActiveSensorDefTN("Search 5M - 5000", 1.0f, 10, 5, 100, false, 1.0f, 1);
            PassiveSensorDefTN ThPasDef = new PassiveSensorDefTN("Thermal Sensor TH1-5", 1.0f, 5, PassiveSensorType.Thermal, 1.0f, 1);
            PassiveSensorDefTN EMPasDef = new PassiveSensorDefTN("EM Sensor EM1-5", 1.0f, 5, PassiveSensorType.EM, 1.0f, 1);
            BeamFireControlDefTN BFCDef = new BeamFireControlDefTN("Fire Control S01 10-1250", 0, 0, 1.0f, 1.0f, false, false, 1.0f, 1);
            BeamDefTN BeamDef = new BeamDefTN("10cm C1 Infrared Laser", ComponentTypeTN.Laser, 0, 0, 0, 1.0f);
            ReactorDefTN ReactDef = new ReactorDefTN("PWR S1 P2", 0, 1.0f, 1.0f);
            ShieldDefTN AShieldDef = new ShieldDefTN("Alpha R300/240 Shields", 0, 0, 1.0f, 1.0f, ComponentTypeTN.Shield);
            MissileLauncherDefTN TubeDef = new MissileLauncherDefTN("Size 1 Launcher", 1.0f, 1, false, 0);
            MagazineDefTN MagDef = new MagazineDefTN("Mag S1", 1.0f, 1, 0, 0, 1);
            ActiveSensorDefTN MFCDef = new ActiveSensorDefTN("Wasp I FC", 1.0f, 10, 5, 100, true, 1.0f, 1);
            TotalComponents = TotalComponents + 11;


            Engines.Add(EngDef);
            ActiveSensorDef.Add(ActDef);
            PassiveSensorDef.Add(ThPasDef);
            PassiveSensorDef.Add(EMPasDef);

            BeamFireControlDef.Add(BFCDef);
            BeamWeaponDef.Add(BeamDef);
            ReactorDef.Add(ReactDef);

            ShieldDef.Add(AShieldDef);

            MLauncherDef.Add(TubeDef);
            MagazineDef.Add(MagDef);
            MissileFireControlDef.Add(MFCDef);

            TurretableBeamDef.Add(BeamDef);


            /// <summary>
            /// Everyone starts with cargoholds. Count 17 to 19
            /// </summary>
            CargoDefTN CargoStandard = new CargoDefTN("Cargo Hold - Standard", 500.0f, 50.0m, 5);
            CargoDefTN CargoSmall = new CargoDefTN("Cargo Hold - Small", 100.0f, 12.5m, 2);
            TotalComponents = TotalComponents + 2;

            CargoHoldDef.Add(CargoStandard);
            CargoHoldDef.Add(CargoSmall);

            /// <summary>
            /// Cryostorage is a TN only starting option. otherwise it must be researched. Count, 19 to 22
            /// </summary>
            ColonyDefTN ColonyStandard = new ColonyDefTN("Cryogenic Transport", 50.0f, 100.0m, 10);
            ColonyDefTN ColonySmall = new ColonyDefTN("Cryogenic Transport - Small", 5.0f, 20.0m, 2);
            ColonyDefTN ColonyEmergency = new ColonyDefTN("Cryogenic Transport - Emergency", 1.0f, 5.0m, 0);
            TotalComponents = TotalComponents + 3;

            ColonyBayDef.Add(ColonyStandard);
            ColonyBayDef.Add(ColonySmall);
            ColonyBayDef.Add(ColonyEmergency);


            /// <summary>
            /// Only TN starts begin with this component for now. the improved,advanced, and grav-assisted variants have to be researched. Count 22, to 23
            /// </summary>
            CargoHandlingDefTN CHS = new CargoHandlingDefTN("Cargo Handling System", 5, 10.0m);
            CargoHandleSystemDef.Add(CHS);
            TotalComponents = TotalComponents + 1;

            /// <summary>
            /// Alpha build components: Count 23, to 39
            /// </summary>

            EngineDefTN AlphaEngine = new EngineDefTN("Ion Engine 120", 12.0f, 1.0f, 0.7f, 1.0f, 1, 10.0f, -1.0f);
            ActiveSensorDefTN AlphaBigSensor = new ActiveSensorDefTN("Search 181M - 10000", 10.0f, 16, 8, 200, false, 1.0f, 1);
            ActiveSensorDefTN AlphaSmallSensor = new ActiveSensorDefTN("Search 57M - 1000", 10.0f, 16, 8, 20, false, 1.0f, 1);
            ActiveSensorDefTN AlphaMissileSensor = new ActiveSensorDefTN("Search 1.4M - Missile", 10.0f, 16, 8, 1, false, 1.0f, 1);
            PassiveSensorDefTN AlphaEMSensor = new PassiveSensorDefTN("EM Detection Sensor EM10-80", 10.0f, 8, PassiveSensorType.EM, 1.0f, 1);
            PassiveSensorDefTN AlphaTHSensor = new PassiveSensorDefTN("TH Detection Sensor TH10-80", 10.0f, 8, PassiveSensorType.Thermal, 1.0f, 1);
            BeamFireControlDefTN AlphaFireControl = new BeamFireControlDefTN("Primary III FC R96K T6K", 2, 2, 4.0f, 2.0f, false, false, 1.0f, 1);

            BeamDefTN AlphaRailGun = new BeamDefTN("15cm Railgun V3/C3", ComponentTypeTN.Rail, 2, 2, 2, 1.0f);
            BeamDefTN AlphaLaser = new BeamDefTN("15cm C3 Near UV Laser", ComponentTypeTN.Laser, 2, 2, 2, 1.0f);
            BeamDefTN AlphaParticle = new BeamDefTN("PBW-4 150K", ComponentTypeTN.Particle, 2, 2, 2, 1.0f);
            BeamDefTN AlphaPlasma = new BeamDefTN("15cm C3 Plasma Beam", ComponentTypeTN.Plasma, 2, 2, 2, 1.0f);
            BeamDefTN AlphaMeson = new BeamDefTN("R9/C3 Meson Cannon", ComponentTypeTN.Meson, 2, 2, 2, 1.0f);
            BeamDefTN AlphaHPM = new BeamDefTN("R9/C3 Microwave", ComponentTypeTN.Microwave, 2, 2, 2, 1.0f);
            BeamDefTN AlphaGauss = new BeamDefTN("Gauss R3-100", ComponentTypeTN.Gauss, 0, 2, 2, 1.0f);

            ReactorDefTN AlphaReactor = new ReactorDefTN("GCFR S1 P4.5", 2, 1.0f, 1.0f);

            ShieldDefTN AlphaShield = new ShieldDefTN("Gamma R300/336 Shields", 2, 2, 0.7f, 1.0f, ComponentTypeTN.Shield);
            TotalComponents = TotalComponents + 16;

            Engines.Add(AlphaEngine);

            ActiveSensorDef.Add(AlphaBigSensor);
            ActiveSensorDef.Add(AlphaSmallSensor);
            ActiveSensorDef.Add(AlphaMissileSensor);

            PassiveSensorDef.Add(AlphaEMSensor);
            PassiveSensorDef.Add(AlphaTHSensor);

            BeamFireControlDef.Add(AlphaFireControl);

            BeamWeaponDef.Add(AlphaRailGun);
            BeamWeaponDef.Add(AlphaLaser);
            BeamWeaponDef.Add(AlphaParticle);
            BeamWeaponDef.Add(AlphaPlasma);
            BeamWeaponDef.Add(AlphaMeson);
            BeamWeaponDef.Add(AlphaHPM);
            BeamWeaponDef.Add(AlphaGauss);

            ReactorDef.Add(AlphaReactor);

            ShieldDef.Add(AlphaShield);

            TurretableBeamDef.Add(AlphaLaser);
            TurretableBeamDef.Add(AlphaMeson);
            TurretableBeamDef.Add(AlphaGauss);

            /// <summary>
            /// Missile Combat Alpha Components: Count at 44 from 39 OrdnanceDefTN and MissileEngineDefTN are _NOT_ included in the total count.
            /// </summary>
            EngineDefTN AlphaMCEngine = new EngineDefTN("Military 5000 EP Photonic Drive", 100.0f, 1.0f, 0.1f, 1.0f, 1, 50.0f, -1.0f);
            ActiveSensorDefTN AlphaMCSensor = new ActiveSensorDefTN("Active Search Sensor MR13500-R100", 10.0f, 180, 75, 100, false, 1.0f, 0);
            ActiveSensorDefTN AlphaMCMissileFireControl = new ActiveSensorDefTN("Missile Fire Control FC40500-R100", 10.0f, 180, 75, 100, true, 1.0f, 0);
            MagazineDefTN MagazineMCDef = new MagazineDefTN("Capacity 587 Magazine: Exp 1%  HTK4", 30.0f, 4, 8, 8, 12);
            MissileLauncherDefTN TubeMCDef = new MissileLauncherDefTN("Size 4 Launcher", 4.0f, 11, false, 0);
            MissileEngineDefTN MissileEngineMCDef = new MissileEngineDefTN("Photonic Missile Drive", 100.0f, 1.0f, 0.1f, 1.5f);
            OrdnanceDefTN MissileMCDef = new OrdnanceDefTN("Size 4 Missile", null, 0.5f, 11, 1.0f, 1.0f, 11, 0.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 100, 0, 0.0f, 0.0f, 0, false, 0, false, 0,
                                                           MissileEngineMCDef, 1);
            TotalComponents = TotalComponents + 5;

            Engines.Add(AlphaMCEngine);
            ActiveSensorDef.Add(AlphaMCSensor);
            MissileFireControlDef.Add(AlphaMCMissileFireControl);
            MagazineDef.Add(MagazineMCDef);
            MLauncherDef.Add(TubeMCDef);
            MissileEngineDef.Add(MissileEngineMCDef);
            MissileDef.Add(MissileMCDef);

            MissileLauncherDefTN TubeAMMDef = new MissileLauncherDefTN("Size 1 Launcher", 1.0f, 11, false, 0);
            MissileEngineDefTN MissileEngineAMMDef = new MissileEngineDefTN("Small Photonic Missile Drive", 100.0f, 6.0f, 0.1f, 0.4f);
            ActiveSensorDefTN AMMSensor = new ActiveSensorDefTN("AMM Sensor", 10.0f, 180, 75, 1, false, 1.0f, 0);
            ActiveSensorDefTN AMMMFC = new ActiveSensorDefTN("AMM MFC", 10.0f, 180, 75, 1, true, 1.0f, 0);
            OrdnanceDefTN MissileAMMDef = new OrdnanceDefTN("Size 1 Missile", null, 0.14f, 11, 0.23f, 0.23f, 11, 0.0f, 0, 0.0f, 0, 0.0f, 0, 0.0f, 0, 1, 0, 0.0f, 0.0f, 0, false, 0, false, 0,
                                                            MissileEngineAMMDef, 1);

            TotalComponents = TotalComponents + 3;

            MLauncherDef.Add(TubeAMMDef);
            MissileEngineDef.Add(MissileEngineAMMDef);
            ActiveSensorDef.Add(AMMSensor);
            MissileFireControlDef.Add(AMMMFC);
            MissileDef.Add(MissileAMMDef);



        }
コード例 #7
0
        /// <summary>
        /// When a new empire/faction is selected this will be run
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EmpireComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_CurrnetFaction.ComponentList.MissileEngineDef.Count != 0)
            {
                _CurrnetMissileEngine = _CurrnetFaction.ComponentList.MissileEngineDef[0];
            }
            else
            {
                m_oMissileDesignPanel.TotalEngineCostTextBox.Text = "";
                m_oMissileDesignPanel.TotalEngineSizeTextBox.Text = "";
                m_oMissileDesignPanel.TotalEPTextBox.Text = "";
                m_oMissileDesignPanel.MissileEngineComboBox.Text = "";
                _CurrnetMissileEngine = null;
            }

            if (_CurrnetFaction.OrdnanceSeries.Count != 0)
            {
                _CurrnetMissileSeries = _CurrnetFaction.OrdnanceSeries[0];
                m_oMissileDesignPanel.MSeriesComboBox.SelectedIndex = 0;
            }
            else
            {
                String Error = String.Format("Faction {0} somehow has no default missile series \"No Series Selected\".", _CurrnetFaction.Name);
                MessageEntry MessageEntry = new MessageEntry(MessageEntry.MessageType.Error, null, null,
                                                      GameState.Instance.GameDateTime, GameState.Instance.LastTimestep, Error);
                _CurrnetFaction.MessageLog.Add(MessageEntry);
                _CurrnetMissileSeries = null;
            }

            if (_CurrnetFaction.ComponentList.MissileDef.Count == 0)
            {
                m_oMissileDesignPanel.WHMSPTextBox.Text = "0";
                m_oMissileDesignPanel.FuelMSPTextBox.Text = "0";
                m_oMissileDesignPanel.AgilityMSPTextBox.Text = "0";
                m_oMissileDesignPanel.ActiveMSPTextBox.Text = "0";
                m_oMissileDesignPanel.ThermalMSPTextBox.Text = "0";
                m_oMissileDesignPanel.EMMSPTextBox.Text = "0";
                m_oMissileDesignPanel.GeoMSPTextBox.Text = "0";
                m_oMissileDesignPanel.ResolutionTextBox.Text = "1";
                m_oMissileDesignPanel.ArmourMSPTextBox.Text = "0";
                m_oMissileDesignPanel.ECMMSPTextBox.Text = "0";
                m_oMissileDesignPanel.LaserWCheckBox.Checked = false;
                m_oMissileDesignPanel.ERCheckBox.Checked = false;
                m_oMissileDesignPanel.NumEnginesTextBox.Text = "1";
                m_oMissileDesignPanel.SubNumberTextBox.Text = "0";
                m_oMissileDesignPanel.SepRangeTextBox.Text = "150";
                m_oMissileDesignPanel.SubSizeTextBox.Text = "0";
                m_oMissileDesignPanel.SubCostTextBox.Text = "0";
                m_oMissileDesignPanel.SubTotalSizeTextBox.Text = "0";
                m_oMissileDesignPanel.SubTotalCostTextBox.Text = "0";
                SubMunition = null;

                m_oMissileDesignPanel.PreviousOrdnanceComboBox.Text = "";
            }

            BuildSubMunitionComboBox();

            BuildMissileDesignPage();
        }
コード例 #8
0
        /// <summary>
        /// Constructor for missile design handler.
        /// </summary>
        public MissileDesignHandler()
        {
            m_oMissileDesignPanel = new Panels.MissileDesign();
            m_oNameSeriesPanel = new Panels.ClassDes_RenameClass();


            VM = new MissileDesignViewModel();

            /// <summary>
            /// Bind factions to the empire selection combo box.
            /// </summary>
            m_oMissileDesignPanel.EmpireComboBox.Bind(c => c.DataSource, VM, d => d.Factions);
            m_oMissileDesignPanel.EmpireComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentFaction, DataSourceUpdateMode.OnPropertyChanged);
            m_oMissileDesignPanel.EmpireComboBox.DisplayMember = "Name";
            VM.FactionChanged += (s, args) => _CurrnetFaction = VM.CurrentFaction;
            _CurrnetFaction = VM.CurrentFaction;
            m_oMissileDesignPanel.EmpireComboBox.SelectedIndexChanged += (s, args) => m_oMissileDesignPanel.EmpireComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oMissileDesignPanel.EmpireComboBox.SelectedIndexChanged += new EventHandler(EmpireComboBox_SelectedIndexChanged);

            /// <summary>
            /// Binding missile engines to the appropriate combo box.
            /// </summary>
            m_oMissileDesignPanel.MissileEngineComboBox.Bind(c => c.DataSource, VM, d => d.MissileEngines);
            m_oMissileDesignPanel.MissileEngineComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentMissileEngine, DataSourceUpdateMode.OnPropertyChanged);
            m_oMissileDesignPanel.MissileEngineComboBox.DisplayMember = "Name";
            VM.MissileEngineChanged += (s, args) => _CurrnetMissileEngine = VM.CurrentMissileEngine;
            _CurrnetMissileEngine = VM.CurrentMissileEngine;
            m_oMissileDesignPanel.MissileEngineComboBox.SelectedIndexChanged += (s, args) => m_oMissileDesignPanel.MissileEngineComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oMissileDesignPanel.MissileEngineComboBox.SelectedIndexChanged += new EventHandler(MissileEngineComboBox_SelectedIndexChanged);

            m_oMissileDesignPanel.MSeriesComboBox.Bind(c => c.DataSource, VM, d => d.MissileSeries);
            m_oMissileDesignPanel.MSeriesComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentMissileSeries, DataSourceUpdateMode.OnPropertyChanged);
            m_oMissileDesignPanel.MSeriesComboBox.DisplayMember = "Name";
            VM.MissileSeriesChanged += (s, args) => _CurrnetMissileSeries = VM.CurrentMissileSeries;
            _CurrnetMissileSeries = VM.CurrentMissileSeries;
            m_oMissileDesignPanel.MSeriesComboBox.SelectedIndexChanged += (s, args) => m_oMissileDesignPanel.MSeriesComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oMissileDesignPanel.MSeriesComboBox.SelectedIndexChanged += new EventHandler(MSeriesComboBox_SelectedIndexChanged);

            m_oMissileDesignPanel.PreviousOrdnanceComboBox.Bind(c => c.DataSource, VM, d => d.Missiles);
            m_oMissileDesignPanel.PreviousOrdnanceComboBox.Bind(c => c.SelectedItem, VM, d => d.CurrentMissile, DataSourceUpdateMode.OnPropertyChanged);
            m_oMissileDesignPanel.PreviousOrdnanceComboBox.DisplayMember = "Name";
            VM.MissileChanged += (s, args) => _CurrnetMissile = VM.CurrentMissile;
            _CurrnetMissile = VM.CurrentMissile;
            m_oMissileDesignPanel.PreviousOrdnanceComboBox.SelectedIndexChanged += (s, args) => m_oMissileDesignPanel.PreviousOrdnanceComboBox.DataBindings["SelectedItem"].WriteValue();
            m_oMissileDesignPanel.PreviousOrdnanceComboBox.SelectedIndexChanged += new EventHandler(PreviousOrdnanceComboBox_SelectedIndexChanged);

            m_oMissileDesignPanel.SubMunitionComboBox.SelectedIndexChanged += new EventHandler(SubMunitionComboBox_SelectedIndexChanged);

            m_oMissileDesignPanel.CloseMDButton.Click += new EventHandler(CloseMDButton_Click);

            m_oMissileDesignPanel.NumEnginesTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.WHMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.FuelMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.AgilityMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);

            m_oMissileDesignPanel.ActiveMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.ThermalMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.EMMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.GeoMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.ResolutionTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);

            m_oMissileDesignPanel.ArmourMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.ECMMSPTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);

            m_oMissileDesignPanel.LaserWCheckBox.CheckedChanged += new EventHandler(LWCheckBox_CheckedChanged);
            m_oMissileDesignPanel.ERCheckBox.CheckedChanged += new EventHandler(ERCheckBox_CheckedChanged);

            m_oMissileDesignPanel.CreateSeriesButton.Click += new EventHandler(CreateSeriesButton_Click);
            m_oMissileDesignPanel.DeleteSeriesButton.Click += new EventHandler(DeleteSeriesButton_Click);
            m_oMissileDesignPanel.InstantButton.Click += new EventHandler(InstantButton_Click);
            m_oMissileDesignPanel.ClearDesignButton.Click += new EventHandler(ClearDesignButton_Click);
            m_oMissileDesignPanel.SetSeriesButton.Click += new EventHandler(SetSeriesButton_Click);
            m_oMissileDesignPanel.ReplaceAllButton.Click += new EventHandler(ReplaceAllButton_Click);
            m_oMissileDesignPanel.CreateMissileButton.Click += new EventHandler(CreateMissileButton_Click);
            m_oMissileDesignPanel.ToggleInfoButton.Click += new EventHandler(ToggleInfoButton_Click);

            m_oMissileDesignPanel.SepRangeTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);
            m_oMissileDesignPanel.SubNumberTextBox.TextChanged += new EventHandler(AnyTextBox_TextChanged);


            m_oNameSeriesPanel.NewClassNameLabel.Text = "Please enter the name of the new Missile Series";
            m_oNameSeriesPanel.OKButton.Click += new EventHandler(OKButton_Click);
            m_oNameSeriesPanel.CancelRenameButton.Click += new EventHandler(CancelRenameButton_Click);
            m_oNameSeriesPanel.RenameClassTextBox.KeyPress += new KeyPressEventHandler(RenameClassTextBox_KeyPress);

            InfoToggle = false;

            m_oMissileDesignPanel.TechDataGrid.SelectionMode = DataGridViewSelectionMode.CellSelect;
            m_oMissileDesignPanel.TechDataGrid.RowHeadersVisible = false;
            m_oMissileDesignPanel.TechDataGrid.AutoGenerateColumns = false;
            SetupTechDataGrid();
        }