Exemplo n.º 1
0
        private void LoadMainArmamentsControl(ModuleData module, Control control)
        {
            TableLayoutPanel   panel     = getTable(control);
            PictureBox         picture   = getPicture(control);
            Label              nameLabel = getLabel(control);
            ArtilleryExtractor extractor = new ArtilleryExtractor(module, selectedShip);

            if (module.ImageUrl.Equals("") && picture != null)
            {
                picture.Image = null;
            }
            else
            {
                if (picture != null)
                {
                    picture.Load(module.ImageUrl);
                }
            }
            nameLabel.Text = module.Name;

            panel.Controls.Add(createHeadlineLabel("ID"), 0, 0);
            panel.Controls.Add(createLabel(module.ID.ToString()), 0, 1);

            panel.Controls.Add(createHeadlineLabel("Caliber"), 1, 0);
            panel.Controls.Add(createLabel(extractor.GunCaliber().ToString()), 1, 1);

            double reloadTime = Math.Round(60 / extractor.FireRate(), 1);

            panel.Controls.Add(createHeadlineLabel("Reload time"), 2, 0);
            panel.Controls.Add(createLabel(reloadTime.ToString()), 2, 1);

            double speed    = 180 / extractor.RotationTime();
            double rotation = Math.Round(speed, 1);

            panel.Controls.Add(createHeadlineLabel("Rotation"), 3, 0);
            panel.Controls.Add(createLabel(rotation.ToString() + " deg/sec"), 3, 1);

            panel.Controls.Add(createHeadlineLabel("AP"), 4, 0);
            panel.Controls.Add(createLabel(extractor.APDamage().ToString()), 4, 1);

            panel.Controls.Add(createHeadlineLabel("HE"), 5, 0);
            panel.Controls.Add(createLabel(extractor.HEDamage().ToString()), 5, 1);

            panel.Controls.Add(createHeadlineLabel("Credits"), 6, 0);
            panel.Controls.Add(createLabel(extractor.CreditCost().ToString()), 6, 1);

            panel.Controls.Add(createHeadlineLabel("Dispersion (m)"), 7, 0);
            panel.Controls.Add(createLabel(extractor.Dispersion().ToString()), 7, 1);
        }
Exemplo n.º 2
0
        private void CalculateArtillery()
        {
            if (RandomizedShip.Modules.Artillery != null)
            {
                long[] availableModules = RandomizedShip.Modules.Artillery;
                if (availableModules.Length > 0)
                {
                    ModuleData MData = GetModuleData(availableModules);

                    ArtilleryExtractor artilleryExtractor = new ArtilleryExtractor(MData, RandomizedShip);

                    Metrics.MainCaliber     = artilleryExtractor.GunCaliber();
                    Metrics.Dispersion      = artilleryExtractor.Dispersion();
                    Metrics.MainCaliberName = MData.Name;
                    Metrics.RotationTime    = artilleryExtractor.RotationTime();
                    Metrics.FireRateMain    = artilleryExtractor.FireRate();
                    Metrics.APDamage        = artilleryExtractor.APDamage();
                    Metrics.HEDamage        = artilleryExtractor.HEDamage();
                }
            }
        }