use of megamek.common.Tank in project megameklab by MegaMek.
the class ImageHelperVehicle method getTableImage.
public static Image getTableImage(Entity unit) {
Image table = null;
String path = new File(ImageHelper.recordSheetPath).getAbsolutePath() + File.separatorChar;
if (unit instanceof VTOL) {
table = new ImageIcon(path + "twvee-vtoltables.png").getImage();
} else if (unit instanceof Tank) {
table = new ImageIcon(path + "twvee-groundtables.png").getImage();
}
return table;
}
use of megamek.common.Tank in project megameklab by MegaMek.
the class MenuBarCreator method jMenuResetEntity_actionPerformed.
public void jMenuResetEntity_actionPerformed(ActionEvent event) {
CConfig.updateSaveFiles("Reset Unit");
CConfig.setParam(CConfig.CONFIG_SAVE_FILE_1, "");
Entity en = parentFrame.getEntity();
if (en instanceof Tank) {
parentFrame.createNewUnit(Entity.ETYPE_TANK);
} else if (en instanceof Mech) {
parentFrame.createNewUnit(Entity.ETYPE_BIPED_MECH, ((Mech) en).isPrimitive(), ((Mech) en).isIndustrial());
} else if (en.hasETypeFlag(Entity.ETYPE_DROPSHIP)) {
parentFrame.createNewUnit(Entity.ETYPE_DROPSHIP);
} else if (en.hasETypeFlag(Entity.ETYPE_SMALL_CRAFT)) {
parentFrame.createNewUnit(Entity.ETYPE_SMALL_CRAFT, ((Aero) en).isPrimitive());
} else if (parentFrame.getEntity() instanceof Aero) {
parentFrame.createNewUnit(Entity.ETYPE_AERO, ((Aero) en).isPrimitive());
} else if (parentFrame.getEntity() instanceof BattleArmor) {
parentFrame.createNewUnit(Entity.ETYPE_BATTLEARMOR);
} else if (parentFrame.getEntity() instanceof Infantry) {
parentFrame.createNewUnit(Entity.ETYPE_INFANTRY);
} else {
System.out.println("util.MenuBarCreatoer: " + "Received unknown entityType!");
}
setVisible(true);
reload();
refresh();
parentFrame.setVisible(true);
parentFrame.repaint();
}
use of megamek.common.Tank in project megameklab by MegaMek.
the class ImageHelper method getRecordSheet.
public static Image getRecordSheet(Entity unit, boolean advanced) {
Image recordSheet = null;
String path = new File(recordSheetPath).getAbsolutePath() + File.separatorChar;
if (unit instanceof BipedMech) {
if (advanced) {
recordSheet = new ImageIcon(path + "tobiped.png").getImage();
} else {
recordSheet = new ImageIcon(path + "twbiped.png").getImage();
}
} else if (unit instanceof QuadMech) {
if (advanced) {
recordSheet = new ImageIcon(path + "toquad.png").getImage();
} else {
recordSheet = new ImageIcon(path + "twquad.png").getImage();
}
} else if (unit instanceof VTOL) {
recordSheet = new ImageIcon(path + "twvee-vtol.png").getImage();
} else if ((unit instanceof LargeSupportTank) || ((unit instanceof Tank) && ((Tank) unit).isSuperHeavy())) {
if (unit.getOInternal(LargeSupportTank.LOC_TURRET) > 0) {
recordSheet = new ImageIcon(path + "twvee-lgsupground-turret.png").getImage();
} else {
recordSheet = new ImageIcon(path + "twvee-lgsupground.png").getImage();
}
} else if (unit instanceof Tank) {
if ((unit.getMovementMode() == EntityMovementMode.NAVAL) || (unit.getMovementMode() == EntityMovementMode.SUBMARINE) || (unit.getMovementMode() == EntityMovementMode.HYDROFOIL)) {
if (unit.getOInternal(((Tank) unit).getLocTurret()) > 0) {
recordSheet = new ImageIcon(path + "twnaval-turret.png").getImage();
} else {
recordSheet = new ImageIcon(path + "twnaval.png").getImage();
}
} else if (advanced) {
String imageName = "twvee-" + unit.getMovementModeAsString().toLowerCase().trim() + "-dualturret.png";
recordSheet = new ImageIcon(path + imageName).getImage();
} else {
String imageName = "twvee-" + unit.getMovementModeAsString().toLowerCase().trim() + ".png";
recordSheet = new ImageIcon(path + imageName).getImage();
}
} else if (unit instanceof Aero) {
if (unit instanceof Dropship) {
if (unit.getMovementMode() == EntityMovementMode.AERODYNE) {
recordSheet = new ImageIcon(path + "twaerodyneds.png").getImage();
} else {
recordSheet = new ImageIcon(path + "twspheroidds.png").getImage();
}
} else if (unit instanceof ConvFighter) {
recordSheet = new ImageIcon(path + "twconventionalfighter.png").getImage();
} else if (unit instanceof SmallCraft) {
if (unit.getMovementMode() == EntityMovementMode.AERODYNE) {
recordSheet = new ImageIcon(path + "twaero-smallcraft.png").getImage();
} else {
recordSheet = new ImageIcon(path + "twspheroid-smallcraft.png").getImage();
}
} else {
recordSheet = new ImageIcon(path + "twaero.png").getImage();
}
} else if (unit instanceof BattleArmor) {
recordSheet = new ImageIcon(path + "twba.png").getImage();
} else if (unit instanceof Protomech) {
recordSheet = new ImageIcon(path + "twproto.png").getImage();
}
return recordSheet;
}
use of megamek.common.Tank in project megameklab by MegaMek.
the class CVStatusBar method refresh.
public void refresh() {
int walk = getTank().getOriginalWalkMP();
int run = getTank().getRunMP(true, true, false);
int jump = getTank().getOriginalJumpMP();
double tonnage = getTank().getWeight();
double currentTonnage;
int bv = getTank().calculateBattleValue();
testEntity = new TestTank(getTank(), entityVerifier.tankOption, null);
currentTonnage = testEntity.calculateWeight();
currentTonnage += UnitUtil.getUnallocatedAmmoTonnage(getTank());
long currentCost = Math.round(getTank().getCost(false));
tons.setText(String.format("Tonnage: %.1f/%.1f (%.1f Remaining)", currentTonnage, tonnage, tonnage - currentTonnage));
tons.setToolTipText("Current Tonnage/Max Tonnage");
if (currentTonnage > tonnage) {
tons.setForeground(Color.red);
} else {
tons.setForeground(UIManager.getColor("Label.foreground"));
}
Tank tank = getTank();
int currentSlots = tank.getTotalSlots() - tank.getFreeSlots();
slots.setText("Slots: " + currentSlots + "/" + tank.getTotalSlots());
if (currentSlots > tank.getTotalSlots()) {
slots.setForeground(Color.red);
} else {
slots.setForeground(UIManager.getColor("Label.foreground"));
}
bvLabel.setText("BV: " + bv);
bvLabel.setToolTipText("BV 2.0");
cost.setText("Cost: " + formatter.format(currentCost) + " C-bills");
move.setText("Movement: " + walk + "/" + run + "/" + jump);
move.setToolTipText("Walk/Run/Jump MP");
StringBuffer sb = new StringBuffer();
invalid.setVisible(!testEntity.correctEntity(sb));
invalid.setToolTipText("<html>" + sb.toString().replaceAll("\n", "<br/>") + "</html>");
}
use of megamek.common.Tank in project megameklab by MegaMek.
the class ImageHelperVehicle method getTurretImage.
public static Image getTurretImage(Entity unit) {
Image table = null;
String path = new File(ImageHelper.recordSheetPath).getAbsolutePath() + File.separatorChar;
if ((unit instanceof Tank) && (unit.getMovementMode() == EntityMovementMode.WIGE)) {
table = new ImageIcon(path + "twvee-wige-turret.png").getImage();
} else {
table = new ImageIcon(path + "twvee-turret.png").getImage();
}
return table;
}
Aggregations