📄 custombattlearmordialog.java
字号:
// Because the tech base changed, available equipment may also have changed. updateEquipmentChoices(); } } else if (ie.getSource().equals(m_chChassisType)) { if (stateChassisType != m_chChassisType.getSelectedIndex()) { // The chassis type is actually changing! // The state of other settings might change. stateChassisType = m_chChassisType.getSelectedIndex(); if (stateChassisType == CHASSIS_TYPE_QUAD) { //FIXME // We have to remove everything from the arms correctly! // That way we won't mess anything up! leftArmEquipment = null; rightArmEquipment = null; } updateGroundMPChoices(); updateJumpMPChoices(); updateEquipmentChoices(); } } else if (ie.getSource().equals(m_chWeightClass)) { if (stateWeightClass != m_chWeightClass.getSelectedIndex()) { stateWeightClass = m_chWeightClass.getSelectedIndex(); // Needs to update min and max weights! switch (stateWeightClass) { case WEIGHT_CLASS_PAL: stateMinWeight = 0; stateMaxWeight = 400; break; case WEIGHT_CLASS_LIGHT: stateMinWeight = 401; stateMaxWeight = 750; break; case WEIGHT_CLASS_MEDIUM: stateMinWeight = 751; stateMaxWeight = 1000; break; case WEIGHT_CLASS_HEAVY: stateMinWeight = 1001; stateMaxWeight = 1500; break; case WEIGHT_CLASS_ASSAULT: stateMinWeight = 1501; stateMaxWeight = 2000; break; } updateGroundMPChoices(); updateJumpMPChoices(); updateArmorValueChoices(); } } else if (ie.getSource().equals(m_chGroundMP)) { if (stateGroundMP != Integer.parseInt((String) m_chGroundMP.getSelectedItem())) { stateGroundMP = Integer.parseInt((String) m_chGroundMP.getSelectedItem()); } } else if (ie.getSource().equals(m_chJumpValue)) { if (stateJumpMP != m_chJumpValue.getSelectedIndex()) { stateJumpMP = m_chJumpValue.getSelectedIndex(); } } else if (ie.getSource().equals(m_chLeftManipulator)) { if (stateManipulatorTypeLeft != m_chLeftManipulator.getSelectedIndex()) { stateManipulatorTypeLeft = m_chLeftManipulator.getSelectedIndex(); } } else if (ie.getSource().equals(m_chRightManipulator)) { if (stateManipulatorTypeRight != m_chRightManipulator.getSelectedIndex()) { stateManipulatorTypeRight = m_chRightManipulator.getSelectedIndex(); } } else if (ie.getSource().equals(m_chArmorType)) { if (stateArmorType != m_chArmorType.getSelectedIndex()) { stateArmorType = m_chArmorType.getSelectedIndex(); } } else if (ie.getSource().equals(m_chArmorValue)) { if (stateArmorValue != m_chArmorValue.getSelectedIndex()) { stateArmorValue = m_chArmorValue.getSelectedIndex(); } } previewBA(); } private void previewBA() { String preview = generateBattleArmorPreview(); m_BAView.setEditable(false); m_BAView.setText(preview); } public void keyPressed(KeyEvent ke) { if (ke.getKeyCode() == KeyEvent.VK_ENTER) { ActionEvent event = new ActionEvent(m_bPick, ActionEvent.ACTION_PERFORMED, ""); actionPerformed(event); } } public void keyReleased(KeyEvent ke) { // Do nothing. } public void keyTyped(KeyEvent ke) { // Do nothing. } // // WindowListener // public void windowActivated(WindowEvent windowEvent) { // Do nothing. } public void windowClosed(WindowEvent windowEvent) { // Do nothing. } public void windowClosing(WindowEvent windowEvent) { setVisible(false); } public void windowDeactivated(WindowEvent windowEvent) { // Do nothing. } public void windowDeiconified(WindowEvent windowEvent) { // Do nothing. } public void windowIconified(WindowEvent windowEvent) { // Do nothing. } public void windowOpened(WindowEvent windowEvent) { // Do nothing. } private void updateWidgetEnablements() { m_bPick.setEnabled(true); m_bPickClose.setEnabled(true); } private String generateBattleArmorPreview() { StringBuffer retVal = new StringBuffer(""); if (isValid()) { retVal.append(">>>"); retVal.append(Messages.getString("CustomBattleArmorDialog.valid")); retVal.append("<<<"); } else { retVal.append(">>>"); retVal.append(Messages.getString("CustomBattleArmorDialog.invalid")); retVal.append("<<<\n"); if (invalidReason != null) { retVal.append(invalidReason); } } retVal.append("\n\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelBAName")); if (m_tfBAName.getText().trim().length() < 1) retVal.append("<NONE>"); else retVal.append(m_tfBAName.getText()); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelMenPerSquad")); retVal.append(stateMenPerSquad); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelTechBase")); if (stateTechBase == TECH_BASE_IS) { retVal.append(Messages.getString("CustomBattleArmorDialog.tech_base_inner_sphere")); } else { retVal.append(Messages.getString("CustomBattleArmorDialog.tech_base_clan")); } retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelChassisType")); if (stateChassisType == CHASSIS_TYPE_BIPED) { retVal.append(Messages.getString("CustomBattleArmorDialog.chassis_type_biped")); } else { retVal.append(Messages.getString("CustomBattleArmorDialog.chassis_type_quad")); } retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelWeightClass")); switch (stateWeightClass) { case WEIGHT_CLASS_PAL: retVal.append(Messages.getString("CustomBattleArmorDialog.weight_class_pal")); break; case WEIGHT_CLASS_LIGHT: retVal.append(Messages.getString("CustomBattleArmorDialog.weight_class_light")); break; case WEIGHT_CLASS_MEDIUM: retVal.append(Messages.getString("CustomBattleArmorDialog.weight_class_medium")); break; case WEIGHT_CLASS_HEAVY: retVal.append(Messages.getString("CustomBattleArmorDialog.weight_class_heavy")); break; case WEIGHT_CLASS_ASSAULT: retVal.append(Messages.getString("CustomBattleArmorDialog.weight_class_assault")); break; } retVal.append(" ("); retVal.append(Messages.getString("CustomBattleArmorDialog.weight")); retVal.append(getChassisWeight()); retVal.append(")"); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.min_weight")); retVal.append(stateMinWeight); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.max_weight")); retVal.append(stateMaxWeight); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.current_weight")); retVal.append(stateCurrentWeight); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelGroundMP")); retVal.append(stateGroundMP); retVal.append(" ("); retVal.append(Messages.getString("CustomBattleArmorDialog.weight")); retVal.append(getGroundMPWeight()); retVal.append(")"); retVal.append("\n"); if (stateJumpType == JUMP_TYPE_JUMP) retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelJumpValue")); else if (stateJumpType == JUMP_TYPE_VTOL) retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelVTOLValue")); else if (stateJumpType == JUMP_TYPE_UMU) retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelUMUValue")); retVal.append(getTotalJumpMP()); retVal.append(" ("); retVal.append(Messages.getString("CustomBattleArmorDialog.weight")); retVal.append(getJumpMPWeight()); retVal.append(")"); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelArmorType")); retVal.append(ARMOR_TYPE_STRINGS[stateArmorType]); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelArmorValue")); retVal.append(stateArmorValue); retVal.append(" ("); retVal.append(Messages.getString("CustomBattleArmorDialog.weight")); retVal.append(getArmorWeight()); retVal.append(")"); retVal.append("\n\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.equipment")); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelLeftManipulator")); retVal.append(BattleArmor.MANIPULATOR_TYPE_STRINGS[stateManipulatorTypeLeft]); retVal.append(" ("); retVal.append(Messages.getString("CustomBattleArmorDialog.weight")); retVal.append(MANIPULATOR_TYPE_WEIGHT[stateManipulatorTypeLeft]); retVal.append(")"); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.m_labelRightManipulator")); retVal.append(BattleArmor.MANIPULATOR_TYPE_STRINGS[stateManipulatorTypeRight]); retVal.append(" ("); retVal.append(Messages.getString("CustomBattleArmorDialog.weight")); retVal.append(MANIPULATOR_TYPE_WEIGHT[stateManipulatorTypeRight]); retVal.append(")"); retVal.append("\n\n"); // Print the rest of the equipment on this thing! if (torsoEquipment != null) { Iterator tmpE = torsoEquipment.iterator(); while (tmpE.hasNext()) { BattleArmorEquipment tmpBAE = (BattleArmorEquipment) (tmpE.next()); retVal.append(tmpBAE.getDescription()); retVal.append("\n"); } } if (rightArmEquipment != null) { Iterator tmpE = rightArmEquipment.iterator(); while (tmpE.hasNext()) { BattleArmorEquipment tmpBAE = (BattleArmorEquipment) (tmpE.next()); retVal.append(tmpBAE.getDescription()); retVal.append("\n"); } } if (leftArmEquipment != null) { Iterator tmpE = leftArmEquipment.iterator(); while (tmpE.hasNext()) { BattleArmorEquipment tmpBAE = (BattleArmorEquipment) (tmpE.next()); retVal.append(tmpBAE.getDescription()); retVal.append("\n"); } } retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.bvEach")); retVal.append(calcSuitBV()); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.bvSquad")); retVal.append(calcSquadBV()); retVal.append("\n\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.costEach")); retVal.append(calcSuitCost()); retVal.append("\n"); retVal.append(Messages.getString("CustomBattleArmorDialog.costSquad")); retVal.append(calcSquadCost());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -