Esempio n. 1
0
        public void TestMethod1(SpaceShipParameters parameter)
        {
            SpaceShip spaceShip = new SpaceShip();

            parameter.Text = "start";
            Assert.True(spaceShip.Start(parameter));
        }
Esempio n. 2
0
        private void listSaOfficers_DoubleClick(object sender, EventArgs e)
        {
            if (gridSaSlots.SelectedCells.Count == 0)
            {
                return;
            }
            DataGridViewRow slotRow = gridSaSlots.Rows[gridSaSlots.SelectedCells[0].RowIndex];

            CrewOfficer officer = (CrewOfficer)listSaOfficers.SelectedItem;

            RigSlot slot;

            slot = (RigSlot)slotRow.Cells["sas_object"].Value;

            string fitMsg = slot.LoadOfficer(officer);

            if (fitMsg != "")
            {
                MessageBox.Show(fitMsg);
                return;
            }

            slotRow.Cells["sas_content"].Value = null;
            slotRow.Cells["sas_content"].Value = slot;

            SpaceShipParameters Params = new SpaceShipParameters();

            Params.rig = saRig;
            Params.CalculateParameters();
            textSaBottomLine.Text = Params.BottomLineString();
        }
Esempio n. 3
0
        private void PlaceModuleToShipSlot(DataGridViewRow moduleRow)
        {
            if (gridSaSlots.SelectedCells.Count == 0)
            {
                return;
            }
            DataGridViewRow slotRow = gridSaSlots.Rows[gridSaSlots.SelectedCells[0].RowIndex];

            ShipModuleType moduleType = null;
            ShipModule     module     = null;

            if (moduleRow.Cells["sam_module"].Value.GetType() == typeof(ShipModuleType))
            {
                moduleType = (ShipModuleType)moduleRow.Cells["sam_module"].Value;
            }
            else if (moduleRow.Cells["sam_module"].Value.GetType() == typeof(ShipModule))
            {
                module     = (ShipModule)moduleRow.Cells["sam_module"].Value;
                moduleType = module.ModuleType;
            }


            RigSlot slot;

            slot = (RigSlot)slotRow.Cells["sas_object"].Value;
            string fitMsg = slot.Slot.ModuleFitsSlot(moduleType);

            if (fitMsg != "")
            {
                MessageBox.Show(fitMsg);
                return;
            }

            if (module == null)
            {
                slot.LoadModuleType(moduleType);
            }
            else
            {
                slot.LoadModule(module);
            }
            slotRow.Cells["sas_content"].Value = null;
            slotRow.Cells["sas_content"].Value = slot;

            SpaceShipParameters Params = new SpaceShipParameters();

            Params.rig = saRig;
            Params.CalculateParameters();
            textSaBottomLine.Text = Params.BottomLineString();
        }
Esempio n. 4
0
        private void buttonLoadPlayerShip_Click(object sender, EventArgs e)
        {
            if (treePlayerShipsRig.SelectedNode == null)
            {
                return;
            }
            Ship ship = (Ship)treePlayerShipsRig.SelectedNode.Tag;

            ship.Model.ClearSlotDuplicates();

            saRig = new SpaceshipRig();
            saRig.LoadShip(ship);
            FillRig();
            SpaceShipParameters Params = new SpaceShipParameters();

            Params.rig = saRig;
            Params.CalculateParameters();
            textSaBottomLine.Text = Params.BottomLineString();
        }
Esempio n. 5
0
        private void buttonSaLoadRig_Click(object sender, EventArgs e)
        {
            TreeNode n = treeSaRigs.SelectedNode;

            if (n == null)
            {
                return;
            }
            SpaceshipRig rig = (SpaceshipRig)n.Tag;

            saRig                    = rig;
            textSaRigTag.Text        = rig.Tag;
            checkSaForPlayer.Checked = saRig.PlayerId > 0;
            FillRig();
            SpaceShipParameters Params = new SpaceShipParameters();

            Params.rig = saRig;
            Params.CalculateParameters();
            textSaBottomLine.Text = Params.BottomLineString();
        }
Esempio n. 6
0
        private void gridSaSlots_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            string          columnName = gridSaSlots.Columns[e.ColumnIndex].Name;
            DataGridViewRow slotRow    = gridSaSlots.Rows[e.RowIndex];

            if (columnName == "sas_content")
            {
                RigSlot slot;
                slot = (RigSlot)slotRow.Cells["sas_object"].Value;
                slot.ClearSlot();
                slotRow.Cells["sas_content"].Value = null;
                slotRow.Cells["sas_content"].Value = slot;
            }

            SpaceShipParameters Params = new SpaceShipParameters();

            Params.rig = saRig;
            Params.CalculateParameters();
            textSaBottomLine.Text = Params.BottomLineString();
        }