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(); }
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(); }
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(); }
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(); }
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(); }