public static PMValueLabel createValueLabel(int x, int y, String v, FontMetrics fm) { PMValueLabel l = new PMValueLabel(fm, Color.red); centerLabelAt(l, x, y); l.setValue(v); return l; }
public void setEntity(Entity e) { Infantry inf = (Infantry) e; int men = Math.min(inf.getInternal(0),Infantry.INF_PLT_MAX_MEN); for (int i = 0; i < men; i++) { areas[i].setVisible(true); } for (int i = men; i < Infantry.INF_PLT_MAX_MEN; i++) { areas[i].setVisible(false); } label .setValue(Messages .getString( "InfantryMapSet.InfantryPlatoon", new Object[] { Integer.toString(men) })); //$NON-NLS-1$ armorLabel.setValue(Messages.getString("InfantryMapSet.Armor") + inf.getArmorDesc()); }
public void setEntity(Entity e){ Jumpship t = (Jumpship) e; int a = 1; int a0 = 1; //TODO: change this back to locations for(int i = 0; i < 6; i++){ a = t.getArmor(i); a0 = t.getOArmor(i); vLabels[i].setValue(t.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double)a/(double)a0); } a = t.getSI(); a0 = t.get0SI(); vLabels[6].setValue(Integer.toString(t.getSI())); WidgetUtils.setAreaColor(areas[6], vLabels[6], (double)a/(double)a0); //now for the vitals vLabels[7].setValue(getCriticalHitTally(t.getAvionicsHits(),3)); vLabels[8].setValue(getCriticalHitTally(t.getCICHits(),3)); vLabels[9].setValue(getCriticalHitTally(t.getEngineHits(),t.getMaxEngineHits())); vLabels[10].setValue(getCriticalHitTally(t.getSensorHits(),3)); vLabels[11].setValue(getCriticalHitTally(t.getLeftThrustHits(),3)); vLabels[12].setValue(getCriticalHitTally(t.getRightThrustHits(),3)); }
public void setEntity(Entity e){ Jumpship t = (Jumpship) e; int a = 1; int a0 = 1; //TODO: change this back to locations for(int i = 0; i < t.locations(); i++){ a = t.getArmor(i); a0 = t.getOArmor(i); vLabels[i].setValue(t.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double)a/(double)a0); } a = t.getSI(); a0 = t.get0SI(); vLabels[6].setValue(Integer.toString(t.getSI())); WidgetUtils.setAreaColor(areas[6], vLabels[6], (double)a/(double)a0); //now for the vitals vLabels[7].setValue(getCriticalHitTally(t.getAvionicsHits(),3)); vLabels[8].setValue(getCriticalHitTally(t.getCICHits(),3)); vLabels[9].setValue(getCriticalHitTally(t.getEngineHits(),t.getMaxEngineHits())); vLabels[10].setValue(getCriticalHitTally(t.getSensorHits(),3)); vLabels[11].setValue(getCriticalHitTally(t.getLeftThrustHits(),3)); vLabels[12].setValue(getCriticalHitTally(t.getRightThrustHits(),3)); }
public void setEntity(Entity e) { LargeSupportTank t = (LargeSupportTank) e; int a = 1; int a0 = 1; for (int i = 1; i < 8; i++) { a = t.getArmor(i); a0 = t.getOArmor(i); vLabels[i].setValue(t.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); } for (int i = 8; i < 15; i++) { a = t.getInternal(i - 8); a0 = t.getOInternal(i - 8); vLabels[i].setValue(t.getInternalString(i - 8)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); } vLabels[15].setValue(String.valueOf(((SupportTank)t).getBARRating(1))); }
a = t.getArmor(i); a0 = t.getOArmor(i); vLabels[i].setValue(t.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double)a/(double)a0); vLabels[4].setValue(Integer.toString(t.getSI())); WidgetUtils.setAreaColor(areas[4], vLabels[4], (double)a/(double)a0); vLabels[5].setValue(getCriticalHitTally(t.getAvionicsHits(),3)); vLabels[6].setValue(getCriticalHitTally(t.getEngineHits(),t.getMaxEngineHits())); vLabels[7].setValue(getCriticalHitTally(t.getFCSHits(),3)); vLabels[8].setValue(getCriticalHitTally(t.getSensorHits(),3)); if(t instanceof SmallCraft) { vLabels[9].setValue(getCriticalHitTally(sc.getLeftThrustHits(),3)); vLabels[10].setValue(getCriticalHitTally(sc.getRightThrustHits(),3)); } else { vLabels[9].setValue("-"); vLabels[10].setValue("-"); kfboom = 1; vLabels[11].setValue(getCriticalHitTally(kfboom,1)); if (ds.isDockCollarDamaged()) { collar = 1; vLabels[12].setValue(getCriticalHitTally(collar,1));
vLabels[i].setValue(t.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); vLabels[4].setValue(Integer.toString(t.getSI())); WidgetUtils .setAreaColor(areas[4], vLabels[4], (double) a / (double) a0); vLabels[5].setValue(getCriticalHitTally(t.getAvionicsHits(), 3)); vLabels[6].setValue(getCriticalHitTally(t.getEngineHits(), t.getMaxEngineHits())); vLabels[7].setValue(getCriticalHitTally(t.getFCSHits(), 3)); vLabels[8].setValue(getCriticalHitTally(t.getSensorHits(), 3)); if (t instanceof SmallCraft) { vLabels[9].setValue(getCriticalHitTally(sc.getLeftThrustHits(), 3)); vLabels[10] .setValue(getCriticalHitTally(sc.getRightThrustHits(), 3)); } else { vLabels[9].setValue("-"); vLabels[10].setValue("-"); vLabels[11].setValue(getCriticalHitTally(kfboom,1)); if (ds.isDockCollarDamaged()) { collar = 1; vLabels[12].setValue(getCriticalHitTally(collar,1));
public void setEntity(Entity e) { SuperHeavyTank t = (SuperHeavyTank) e; int a = 1; int a0 = 1; for (int i = 1; i < 8; i++) { a = t.getArmor(i); a0 = t.getOArmor(i); vLabels[i].setValue(t.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); } for (int i = 8; i < 15; i++) { a = t.getInternal(i - 8); a0 = t.getOInternal(i - 8); vLabels[i].setValue(t.getInternalString(i - 8)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); } }
/** * Show the diagram for the given Protomech. * * @param entity - the <code>Entity</code> to be displayed. This should be * a <code>Protomech</code> unit. */ @Override public void setEntity(Entity entity) { Protomech proto = (Protomech) entity; int loc = proto.locations(); if (!proto.hasMainGun()) { armorLabels[Protomech.LOC_MAINGUN].setVisible(false); internalLabels[Protomech.LOC_MAINGUN].setVisible(false); sectionLabels[Protomech.LOC_MAINGUN].setVisible(false); } else { armorLabels[Protomech.LOC_MAINGUN].setVisible(true); internalLabels[Protomech.LOC_MAINGUN].setVisible(true); sectionLabels[Protomech.LOC_MAINGUN].setVisible(true); } for (int i = 0; i < loc; i++) { // armor = proto.getArmor(i); // internal = proto.getInternal(i); armorLabels[i].setValue(proto.getArmorString(i)); internalLabels[i].setValue(proto.getInternalString(i)); sectionLabels[i].setValue(proto.getLocationAbbr(i)); } }
public void setEntity(Entity e) { Tank t = (Tank) e; int a = 1; int a0 = 1; for (int i = 1; i < 6; i++) { a = t.getArmor(i); a0 = t.getOArmor(i); vLabels[i].setValue(t.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); } for (int i = 7; i < 12; i++) { a = t.getInternal(i - 6); a0 = t.getOInternal(i - 6); vLabels[i].setValue(t.getInternalString(i - 6)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); } if (!t.hasPatchworkArmor() && t.hasBARArmor(1)) { vLabels[12].setValue(String.valueOf(((SupportTank)t).getBARRating(1))); } else { labels[12].setVisible(false); vLabels[12].setVisible(false); } }
a = m.getArmor(i); a0 = m.getOArmor(i); vLabels[i].setValue(m.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); a = m.getArmor(i, true); a0 = m.getOArmor(i, true); vLabels[i + REAR_AREA_OFFSET].setValue(m .getArmorString(i, true)); WidgetUtils.setAreaColor(areas[i + REAR_AREA_OFFSET], vLabels[i vLabels[i + INT_STRUCTURE_OFFSET].setValue(m.getInternalString(i)); WidgetUtils.setAreaColor(areas[i + INT_STRUCTURE_OFFSET], vLabels[i + INT_STRUCTURE_OFFSET], (double) a / (double) a0); vLabels[19].setValue(Integer.toString(m.heat)); drawHeatControl(m.heat, mtHeat);
vLabels[i].setValue(m.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); a = m.getArmor(i, true); a0 = m.getOArmor(i, true); vLabels[i + REAR_AREA_OFFSET].setValue(m .getArmorString(i, true)); WidgetUtils.setAreaColor(areas[i + REAR_AREA_OFFSET], vLabels[i vLabels[i + INT_STRUCTURE_OFFSET].setValue(m.getInternalString(i)); WidgetUtils.setAreaColor(areas[i + INT_STRUCTURE_OFFSET], vLabels[i + INT_STRUCTURE_OFFSET], (double) a / (double) a0); vLabels[19].setValue(Integer.toString(m.heat)); drawHeatControl(m.heat, mtHeat);
a = m.getArmor(i); a0 = m.getOArmor(i); vLabels[i].setValue(m.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); a = m.getArmor(i, true); a0 = m.getOArmor(i, true); vLabels[i + REAR_AREA_OFFSET].setValue(m .getArmorString(i, true)); WidgetUtils.setAreaColor(areas[i + REAR_AREA_OFFSET], vLabels[i vLabels[i + INT_STRUCTURE_OFFSET].setValue(m.getInternalString(i)); WidgetUtils.setAreaColor(areas[i + INT_STRUCTURE_OFFSET], vLabels[i + INT_STRUCTURE_OFFSET], (double) a / (double) a0); vLabels[19].setValue(Integer.toString(m.heat)); drawHeatControl(m.heat, mtHeat); content.addArea(labels[19]); content.addArea(vLabels[20]); vLabels[20].setValue(String.valueOf(m.getBARRating(1))); } else { content.removeArea(labels[19]);
a = m.getArmor(i); a0 = m.getOArmor(i); vLabels[i].setValue(m.getArmorString(i)); WidgetUtils.setAreaColor(areas[i], vLabels[i], (double) a / (double) a0); a = m.getArmor(i, true); a0 = m.getOArmor(i, true); vLabels[i + REAR_AREA_OFFSET].setValue(m .getArmorString(i, true)); WidgetUtils.setAreaColor(areas[i + REAR_AREA_OFFSET], vLabels[i vLabels[i + INT_STRUCTURE_OFFSET].setValue(m.getInternalString(i)); WidgetUtils.setAreaColor(areas[i + INT_STRUCTURE_OFFSET], vLabels[i + INT_STRUCTURE_OFFSET], (double) a / (double) a0); vLabels[21].setValue(Integer.toString(m.heat)); drawHeatControl(m.heat, mtHeat); content.addArea(labels[21]); content.addArea(vLabels[22]); vLabels[20].setValue(String.valueOf(m.getBARRating(1))); } else { content.removeArea(labels[21]);
if ((armor + internal) == 0) { armorAreas[i].setVisible(false); armorLabels[i].setValue(Messages .getString("BattleArmorMapSet.Killed")); //$NON-NLS-1$ } else { drawArmorImage(armorImage[i], armor + internal); armorLabels[i].setValue(Integer.toString(armor + internal)); armorAreas[i].setVisible(true);
public void setEntity(Entity e) { Aero t = (Aero) e; int armor = t.getCapArmor(); int armorO = t.getCap0Armor(); armorVLabel.setValue(Integer.toString(armor)); if (t.getGame().getOptions().booleanOption(OptionsConstants.ADVAERORULES_AERO_SANITY)) { armor = (int) Math.ceil(armor / 10.0); armorO = (int) Math.ceil(armorO / 10.0); } drawArmorImage(armorImage, armor, armorO); drawCrits(avCritImage, t.getAvionicsHits()); drawCrits(engineCritImage, t.getEngineHits()); drawCrits(fcsCritImage, t.getFCSHits()); drawCrits(sensorCritImage, t.getSensorHits()); drawCrits(pilotCritImage, t.getCrew().getHits()); }
armor = vtol.getArmor(location); originalArmor = vtol.getOArmor(location); vLabels[i].setValue(vtol.getArmorString(location)); } else { // IS armor = vtol.getInternal(location); originalArmor = vtol.getOInternal(location); vLabels[i].setValue(vtol.getInternalString(location)); vLabels[LABEL_BAR_RATING].setValue(String.valueOf(((SupportVTOL)vtol).getBARRating(1))); } else { labels[LABEL_BAR_RATING+6].setVisible(false);
private void setAreas() { int stepX = 30; int stepY = 42; infImage = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), "inf.gif").toString()); //$NON-NLS-1$ PMUtil.setImage(infImage, comp); for (int i = 0; i < Infantry.INF_PLT_MAX_MEN; i++) { int shiftX = (i % 5) * stepX; int shiftY = (i / 5) * stepY; areas[i] = new PMPicArea(infImage); areas[i].translate(shiftX, shiftY); content.addArea(areas[i]); } FontMetrics fm = comp.getFontMetrics(FONT_VALUE); armorLabel = new PMValueLabel(fm, Color.white); armorLabel.setValue(Messages.getString( "InfantryMapSet.Armor") + "XXXXXXXXXXXX"); //$NON-NLS-1$//$NON-NLS-2$ Dimension d = armorLabel.getSize(); content.translate(0, d.height + 5); armorLabel.moveTo(0, d.height); content.addArea(armorLabel); label = new PMValueLabel(fm, Color.white); label.setValue(Messages.getString( "InfantryMapSet.InfantryPlatoon", new Object[] { "00" })); //$NON-NLS-1$//$NON-NLS-2$ d = label.getSize(); content.translate(0, d.height + 5); label.moveTo(0, d.height); content.addArea(label); }
int armor = a.getCapArmor(); int armorO = a.getCap0Armor(); armorVLabel[i].setValue(Integer.toString(armor));