Ejemplo n.º 1
0
        private void AddShipToCompare(Ship findShip, ShipBuild build = null)
        {
            CompareShip childForm = new CompareShip();

            if (this.MdiChildren.Length == 0)
            {
                childForm.IsFirstChild = true;
                FirstChild             = childForm;
            }

            childForm.MdiParent = this;
            string selection = findShip.Name;

            TableLayoutPanel  tl        = childForm.Controls.Find("ShipMetricsTable", true).FirstOrDefault() as TableLayoutPanel;
            MetricsExctractor Extractor = new MetricsExctractor(findShip);
            MetricsDrawer     Drawer    = new MetricsDrawer(tl);

            MetricsTableComposer.DrawTable(Extractor, Drawer);

            if (build != null)
            {
                selection += "**PB**";
                BuildManagerHandler bmHandler = new BuildManagerHandler(tl, Extractor.GetMetrics());
                bmHandler.PerformAnimation(false);
                bmHandler.KeepBackgroundTransparent(true);
                bmHandler.ApplyAll(build.Flags);
                bmHandler.ApplyAll(build.Skills);
                bmHandler.ApplyAll(build.Upgrades);
            }

            childForm.Text = selection;

            childForm.StartPosition = FormStartPosition.Manual;
            int   positionX = (this.MdiChildren.Length - 1) * 252;
            Point point     = new Point(positionX, 0);

            childForm.Location = point;

            if (childForm.IsFirstChild == false)
            {
                MetricsCompare.DoCompare(childForm.Controls.Find("ShipMetricsTable", true).FirstOrDefault() as TableLayoutPanel, FirstChild.Controls.Find("ShipMetricsTable", true).FirstOrDefault() as TableLayoutPanel);
            }
            childForm.Show();
            toolStripStatusLabel.Text = "Added '" + selection + "' to compare.";
            statusStrip.Refresh();
        }
Ejemplo n.º 2
0
        private void LoadShipMetrics()
        {
            if (RandomizedShip == null)
            {
                return;
            }
            LOG.Debug("Loading ship metrics");
            MetricsExctractor Extractor = new MetricsExctractor(RandomizedShip);
            MetricsDrawer     Drawer    = new MetricsDrawer(ShipMetricsTable);

            MetricsTableComposer.DrawTable(Extractor, Drawer);

            try
            {
                Settings settings = Commons.GetSettings();
                string   fileName = settings.SaveLocation;
                if (!fileName.EndsWith("\\"))
                {
                    fileName += @"\";
                }
                fileName += RandomizedShip.Name + ".bld";

                ShipBuild build = null;
                if (File.Exists(fileName))
                {
                    build = BinarySerialize.ReadFromBinaryFile <ShipBuild>(fileName);
                }

                if (build != null)
                {
                    BuildManagerHandler bmHandler = new BuildManagerHandler(ShipMetricsTable, Extractor.GetMetrics());
                    bmHandler.PerformAnimation(false);
                    bmHandler.KeepBackgroundTransparent(false);
                    bmHandler.ApplyAll(build.Flags);
                    bmHandler.ApplyAll(build.Skills);
                    bmHandler.ApplyAll(build.Upgrades);
                }
            }
            catch (Exception) { }
        }
Ejemplo n.º 3
0
        private void ClearSelections(bool keepSelectedShip = false)
        {
            LOG.Debug("ClearSelections(" + keepSelectedShip + ")");
            bmHandler = null;
            upgradeSlot1.Controls.Clear();
            upgradeSlot2.Controls.Clear();
            upgradeSlot2.Visible = false;
            upgradeSlot2.Enabled = false;
            upgradeSlot3.Controls.Clear();
            upgradeSlot3.Visible = false;
            upgradeSlot3.Enabled = false;
            upgradeSlot4.Controls.Clear();
            upgradeSlot4.Visible = false;
            upgradeSlot4.Enabled = false;
            upgradeSlot5.Controls.Clear();
            upgradeSlot5.Visible = false;
            upgradeSlot5.Enabled = false;
            upgradeSlot6.Controls.Clear();
            upgradeSlot6.Visible = false;
            upgradeSlot6.Enabled = false;
            ShipMetricsTable.Controls.Clear();

            foreach (Control ctrl in panelCaptainSkills.Controls)
            {
                if (ctrl is PictureBox box)
                {
                    box.BorderStyle           = BorderStyle.None;
                    box.AccessibleDescription = "";
                    box.Refresh();
                    box.Image = null;
                }
            }
            totalSkillPoints.Text      = "0";
            panelCaptainSkills.Enabled = false;

            foreach (Control ctrl in panelFlags.Controls)
            {
                if (ctrl is PictureBox box)
                {
                    box.BorderStyle           = BorderStyle.None;
                    box.AccessibleDescription = "";
                    box.Refresh();
                }
            }
            combatFlagsCount.Text = "0";
            panelFlags.Enabled    = false;

            cbCamoflage.Checked = false;
            cbCamoflage.Enabled = false;

            Metrics = null;
            if (keepSelectedShip == false)
            {
                picShip.Image = null;
                selectedShip  = null;
                this.Text     = "Build Manager";
            }
            else
            {
                SelectShip(selectedShip);
            }
        }