Ejemplo n.º 1
0
 public void ChangeShip(Ship ship)
 {
     RandomizedShip = ship;
     Modules        = RandomizedShip.ModuleTree;
     Metrics        = new ShipMetrics();
     CalculateMetrics();
 }
Ejemplo n.º 2
0
 public BuildManagerHandler(TableLayoutPanel ShipMetricsTable, ShipMetrics originalMetrics)
 {
     this.ShipMetricsTable = ShipMetricsTable;
     Metrics = originalMetrics;
 }
Ejemplo n.º 3
0
        public static void DrawTable(MetricsExctractor Extractor, MetricsDrawer Table)
        {
            ShipMetrics Metrics = Extractor.GetMetrics();

            Table.SuspendLayout();
            Table.AppendHeadline(SECTION_GENERAL);

            Table.AppendRow(SHIP_CLASS, Metrics.ShipClass);
            Table.AppendRow(SHIP_TIER, Metrics.Tier.ToString());
            Table.AppendRow(SHIP_HP, Metrics.HP.ToString());
            Table.AppendRow(SHIP_PREMIUM, ((Metrics.isPremium) ? "Yes" : "No"));

            if (Metrics.MainCaliberName != null && !Metrics.MainCaliberName.Equals(""))
            {
                Table.AppendHeadline(SECTION_MAIN_ARMAMENT);
                Table.AppendFullRow(Metrics.MainCaliberName);
                Table.AppendRow(GUN_CALIBER, Metrics.MainCaliber.ToString());
                Table.AppendRow(AP_DAMAGE, Metrics.APDamage.ToString());
                Table.AppendRow(HE_DAMAGE, Metrics.HEDamage.ToString());

                Table.AppendRow(RELOAD_MAIN, Metrics.ReloadTimeMain().ToString() + SUFFIX_SEC);
                Table.AppendRow(RANGE_MAIN, Metrics.Distance.ToString() + SUFFIX_KM);
                Table.AppendRow(DISPERSION, Metrics.Dispersion.ToString() + SUFFIX_M);

                Table.AppendRow(FIRECHANCE_MAIN, Metrics.FireChanceMain.ToString() + SUFFIX_PCT);
                Table.AppendRow(TRAVERSE_SPEED, Metrics.RotationSpeed().ToString() + SUFFIX_DEG);
                Table.AppendRow(TRAVERSE_SPEED_180, Metrics.RotationTime.ToString() + SUFFIX_SEC);
            }

            if (Metrics.Secondaries != null)
            {
                Table.AppendHeadline(SECTION_SEC_ARMAMENT);
                SecondariesData SecData = Metrics.Secondaries["0"];

                Table.AppendRow(RANGE_SECONDARY, Metrics.SecondaryRange.ToString() + SUFFIX_KM, "Name: " + SecData.Name);
                int slot = 0;
                while (SecData != null)
                {
                    //Table.AppendFullRow(SLOT_PREFIX + slot.ToString() + ": " + SecData.Name);
                    Table.AppendRow(RELOAOD_SECONDARY, SecData.ReloadTime().ToString() + SUFFIX_SEC, SLOT_PREFIX + slot.ToString() + ": " + SecData.Name, "", "Slot" + slot.ToString());
                    Table.AppendRow(FIRECHANCE_SECONDARY, SecData.FireChance.ToString() + SUFFIX_PCT, SLOT_PREFIX + slot.ToString() + ": " + SecData.Name, "", "Slot" + slot.ToString());
                    slot += 1;
                    try
                    {
                        if (Metrics.Secondaries.ContainsKey(slot.ToString()))
                        {
                            SecData = Metrics.Secondaries[slot.ToString()];
                        }
                        else
                        {
                            SecData = null;
                        }
                    }
                    catch (Exception)
                    {
                        SecData = null;
                    }
                }
            }

            if (Metrics.TorpedoReload != 0)
            {
                Table.AppendHeadline(SECTION_TORPEDO_ARMAMENT);
                Table.AppendRow(TORPEDO_SPEED, Metrics.TorpedoSpeed.ToString() + SUFFIX_KNOTS);
                Table.AppendRow(TORPEDO_DAMAGE, Metrics.TorpedoDamage.ToString());
                Table.AppendRow(TORPEDO_RELOAD, Metrics.TorpedoReload.ToString() + SUFFIX_SEC);
                Table.AppendRow(TORPEDO_RANGE, Metrics.TorpedoDistance.ToString() + SUFFIX_KM);
            }

            if (Metrics.AntiAircraft != null)
            {
                Table.AppendHeadline(AA);
                Dictionary <string, AntiAircraftMount> mounts = Metrics.AntiAircraft.AAMounts;
                foreach (KeyValuePair <string, AntiAircraftMount> entry in mounts)
                {
                    Table.AppendRow(SLOT_PREFIX + entry.Key.ToString() + ": " + AA_RANGE, entry.Value.Distance.ToString() + SUFFIX_KM, "", "AA Mount #" + entry.Key.ToString());
                    Table.AppendRow(SLOT_PREFIX + entry.Key.ToString() + ": " + AA_CALIBER, entry.Value.Caliber.ToString() + SUFFIX_MM, entry.Value.Guns.ToString() + " x " + entry.Value.Name, "AA Mount #" + entry.Key.ToString());
                    Table.AppendRow(SLOT_PREFIX + entry.Key.ToString() + ": " + AA_DAMAGE, entry.Value.Damage.ToString(), "Avarage damage per second");
                }
            }

            if (Metrics.FighterSquadrons != 0 || Metrics.BomberSquadrons != 0 || Metrics.TorpedoSquadrons != 0)
            {
                Table.AppendHeadline(SECTION_PLANE_ARMAMENT);
                Table.AppendRow(FIGHTER_SQUADRONS, Metrics.FighterSquadrons.ToString());
                Table.AppendRow(BOMBER_SQUADRONS, Metrics.BomberSquadrons.ToString());
                Table.AppendRow(TORPEDO_SQUADRONS, Metrics.TorpedoSquadrons.ToString());
            }

            Table.AppendHeadline(SECTION_MANOUVERABILITY);
            Table.AppendRow(SHIP_SPEED, Metrics.Speed.ToString() + SUFFIX_KNOTS, Metrics.Engine);
            Table.AppendRow(RUDDER_SHIFT, Metrics.RudderTime.ToString() + SUFFIX_SEC);
            Table.AppendRow(TURNING_RADIUS, Metrics.TurningRadius.ToString() + SUFFIX_M);

            if (Metrics.SurfaceDetection != 0)
            {
                Table.AppendHeadline(SECTION_CONCEALMENT);
                Table.AppendRow(SURFACE_DETECTION, Metrics.SurfaceDetection.ToString() + SUFFIX_KM);
                Table.AppendRow(AIR_DETECTION, Metrics.AirDetection.ToString() + SUFFIX_KM);
            }
            Table.ResumeLayout();
        }