private void translateAreas() { armorLabel.translate(0, 0); armorArea.translate(0, squareSize); armorVLabel.translate( (armorCols * (squareSize + 1)) / 2, squareSize + (armorRows * (squareSize + 1)) / 2); avCritLabel.translate(5 + armorCols * (squareSize + 1), stepY); engineCritLabel.translate(5 + armorCols * (squareSize + 1), 2 * stepY); fcsCritLabel.translate(5 + armorCols * (squareSize + 1), 3 * stepY); sensorCritLabel.translate(5 + armorCols * (squareSize + 1), 4 * stepY); pilotCritLabel.translate(5 + armorCols * (squareSize + 1), 5 * stepY); avCritArea.translate( 10 + pilotCritLabel.width + armorCols * (squareSize + 1), stepY - (squareSize + 1)); engineCritArea.translate( 10 + pilotCritLabel.width + armorCols * (squareSize + 1), 2 * stepY - (squareSize + 1)); fcsCritArea.translate( 10 + pilotCritLabel.width + armorCols * (squareSize + 1), 3 * stepY - (squareSize + 1)); sensorCritArea.translate( 10 + pilotCritLabel.width + armorCols * (squareSize + 1), 4 * stepY - (squareSize + 1)); pilotCritArea.translate( 10 + pilotCritLabel.width + armorCols * (squareSize + 1), 5 * stepY - (squareSize + 1)); }
/** updates fields for the unit */ public void setEntity(Entity en) { if (en instanceof Infantry) { pilotL.setString(Messages.getString("PilotMapSet.pilotLAntiMech")); } else { pilotL.setString(Messages.getString("PilotMapSet.pilotL")); } nameL.setString(en.getCrew().getName()); nickL.setString(en.getCrew().getNickname()); pilotR.setString(Integer.toString(en.getCrew().getPiloting())); gunneryR.setString(Integer.toString(en.getCrew().getGunnery())); if (null != getPortrait(en.getCrew())) { portraitArea.setIdleImage(getPortrait(en.getCrew())); } if ((en.getGame() != null) && en.getGame().getOptions().booleanOption("rpg_gunnery")) { gunneryLR.setString(Integer.toString(en.getCrew().getGunneryL())); gunneryMR.setString(Integer.toString(en.getCrew().getGunneryM())); gunneryBR.setString(Integer.toString(en.getCrew().getGunneryB())); gunneryL.setVisible(false); gunneryR.setVisible(false); gunneryLL.setVisible(true); gunneryLR.setVisible(true); gunneryML.setVisible(true); gunneryMR.setVisible(true); gunneryBL.setVisible(true); gunneryBR.setVisible(true); } else { gunneryLL.setVisible(false); gunneryLR.setVisible(false); gunneryML.setVisible(false); gunneryMR.setVisible(false); gunneryBL.setVisible(false); gunneryBR.setVisible(false); gunneryL.setVisible(true); gunneryR.setVisible(true); } if ((en.getGame() != null) && en.getGame().getOptions().booleanOption("toughness")) { toughBR.setString(Integer.toString(en.getCrew().getToughness())); } else { toughBL.setVisible(false); toughBR.setVisible(false); } if ((en.getGame() != null) && en.getGame().getOptions().booleanOption("individual_initiative")) { initBR.setString(Integer.toString(en.getCrew().getInitBonus())); } else { initBL.setVisible(false); initBR.setVisible(false); } if ((en.getGame() != null) && en.getGame().getOptions().booleanOption("command_init")) { commandBR.setString(Integer.toString(en.getCrew().getCommandBonus())); } else { commandBL.setVisible(false); commandBR.setVisible(false); } hitsR.setString(en.getCrew().getStatusDesc()); for (int i = 0; i < advantagesR.length; i++) { advantagesR[i].setString(""); // $NON-NLS-1$ } int i = 0; for (Enumeration<IOptionGroup> advGroups = en.getCrew().getOptions().getGroups(); advGroups.hasMoreElements(); ) { if (i >= (N_ADV - 1)) { advantagesR[i++].setString(Messages.getString("PilotMapSet.more")); break; } IOptionGroup advGroup = advGroups.nextElement(); if (en.getCrew().countOptions(advGroup.getKey()) > 0) { advantagesR[i++].setString(advGroup.getDisplayableName()); for (Enumeration<IOption> advs = advGroup.getOptions(); advs.hasMoreElements(); ) { if (i >= (N_ADV - 1)) { advantagesR[i++].setString(" " + Messages.getString("PilotMapSet.more")); break; } IOption adv = advs.nextElement(); if (adv.booleanValue()) { advantagesR[i++].setString(" " + adv.getDisplayableNameWithValue()); } } } } }
private PMSimpleLabel createLabel(String s, FontMetrics fm, int x, int y) { PMSimpleLabel l = new PMSimpleLabel(s, fm, Color.white); l.moveTo(x, y); return l; }
private void setAreas() { portraitArea = new PMPicArea(new BufferedImage(72, 72, BufferedImage.TYPE_BYTE_INDEXED)); content.addArea(portraitArea); yCoord = 6; FontMetrics fm = comp.getFontMetrics(FONT_TITLE); nameL = createLabel( Messages.getString("GeneralInfoMapSet.LocOstLCT"), fm, 0, getYCoord()); // $NON-NLS-1$ nameL.setColor(Color.yellow); content.addArea(nameL); fm = comp.getFontMetrics(FONT_VALUE); nickL = createLabel( Messages.getString("GeneralInfoMapSet.LocOstLCT"), fm, 0, getNewYCoord()); //$NON-NLS-1$ content.addArea(nickL); hitsR = createLabel(STAR3, fm, 0, getNewYCoord()); hitsR.setColor(Color.RED); content.addArea(hitsR); getNewYCoord(); pilotL = createLabel( Messages.getString("PilotMapSet.pilotLAntiMech"), fm, 0, getNewYCoord()); // $NON-NLS-1$ content.addArea(pilotL); pilotR = createLabel(STAR3, fm, pilotL.getSize().width + 5, getYCoord()); content.addArea(pilotR); initBL = createLabel( Messages.getString("PilotMapSet.initBL"), fm, pilotL.getSize().width + 50, getYCoord()); //$NON-NLS-1$ content.addArea(initBL); initBR = createLabel( STAR3, fm, pilotL.getSize().width + 50 + initBL.getSize().width + 15, getYCoord()); content.addArea(initBR); gunneryL = createLabel( Messages.getString("PilotMapSet.gunneryL"), fm, 0, getNewYCoord()); // $NON-NLS-1$ content.addArea(gunneryL); gunneryR = createLabel(STAR3, fm, pilotL.getSize().width + 5, getYCoord()); content.addArea(gunneryR); commandBL = createLabel( Messages.getString("PilotMapSet.commandBL"), fm, pilotL.getSize().width + 50, getYCoord()); //$NON-NLS-1$ content.addArea(commandBL); commandBR = createLabel( STAR3, fm, pilotL.getSize().width + 50 + initBL.getSize().width + 15, getYCoord()); content.addArea(commandBR); gunneryLL = createLabel(Messages.getString("PilotMapSet.gunneryLL"), fm, 0, getYCoord()); // $NON-NLS-1$ content.addArea(gunneryLL); gunneryLR = createLabel(STAR3, fm, pilotL.getSize().width + 25, getYCoord()); content.addArea(gunneryLR); gunneryML = createLabel( Messages.getString("PilotMapSet.gunneryML"), fm, 0, getNewYCoord()); // $NON-NLS-1$ content.addArea(gunneryML); gunneryMR = createLabel(STAR3, fm, pilotL.getSize().width + 25, getYCoord()); content.addArea(gunneryMR); toughBL = createLabel( Messages.getString("PilotMapSet.toughBL"), fm, pilotL.getSize().width + 50, getYCoord()); //$NON-NLS-1$ content.addArea(toughBL); toughBR = createLabel( STAR3, fm, pilotL.getSize().width + 50 + initBL.getSize().width + 15, getYCoord()); content.addArea(toughBR); gunneryBL = createLabel( Messages.getString("PilotMapSet.gunneryBL"), fm, 0, getNewYCoord()); // $NON-NLS-1$ content.addArea(gunneryBL); gunneryBR = createLabel(STAR3, fm, pilotL.getSize().width + 25, getYCoord()); content.addArea(gunneryBR); getNewYCoord(); advantagesR = new PMSimpleLabel[N_ADV]; for (int i = 0; i < advantagesR.length; i++) { advantagesR[i] = createLabel(new Integer(i).toString(), fm, 10, getNewYCoord()); content.addArea(advantagesR[i]); } // DO NOT PLACE ANY MORE LABELS BELOW HERE. They will get // pushed off the bottom of the screen by the pilot advantage // labels. Why not just allocate the number of pilot advantage // labels required instead of a hard 24? Because we don't have // an entity at this point. Bleh. }