Search in sources :

Example 1 with TestAero

use of megamek.common.verifier.TestAero in project megameklab by MegaMek.

the class SummaryView method refresh.

public void refresh() {
    TestAero testAero = new TestAero(getAero(), entityVerifier.aeroOption, null);
    txtStructTon.setText(Double.toString(testAero.getWeightStructure()));
    txtEngineTon.setText(Double.toString(testAero.getWeightEngine()));
    txtFuelTon.setText(Double.toString(testAero.getWeightFuel()));
    txtCockpitTon.setText(Double.toString(testAero.getWeightControls()));
    txtHeatTon.setText(Double.toString(testAero.getWeightHeatSinks()));
    txtArmorTon.setText(Double.toString(testAero.getWeightArmor()));
    txtEnhancementsTon.setText(Double.toString(testAero.getWeightMisc()));
    txtWeapTon.setText(Double.toString(testAero.getWeightWeapon()));
    txtOtherTon.setText(Double.toString(testAero.getWeightPowerAmp() + testAero.getWeightCarryingSpace() + testAero.getWeightMisc()));
}
Also used : TestAero(megamek.common.verifier.TestAero)

Example 2 with TestAero

use of megamek.common.verifier.TestAero in project megameklab by MegaMek.

the class UnitUtil method getEntityVerifier.

/**
 * Returns a TestEntity instance for the supplied Entity.
 *
 * @param unit
 * @return
 */
public static TestEntity getEntityVerifier(Entity unit) {
    EntityVerifier entityVerifier = EntityVerifier.getInstance(new File("data/mechfiles/UnitVerifierOptions.xml"));
    TestEntity testEntity = null;
    if (unit.hasETypeFlag(Entity.ETYPE_MECH)) {
        testEntity = new TestMech((Mech) unit, entityVerifier.mechOption, null);
    } else if (unit.hasETypeFlag(Entity.ETYPE_SUPPORT_TANK)) {
        testEntity = new TestSupportVehicle((Tank) unit, entityVerifier.tankOption, null);
    } else if (unit.hasETypeFlag(Entity.ETYPE_TANK)) {
        testEntity = new TestTank((Tank) unit, entityVerifier.tankOption, null);
    } else if (unit.hasETypeFlag(Entity.ETYPE_SMALL_CRAFT)) {
        testEntity = new TestSmallCraft((SmallCraft) unit, entityVerifier.aeroOption, null);
    } else if (unit.hasETypeFlag(Entity.ETYPE_AERO)) {
        testEntity = new TestAero((Aero) unit, entityVerifier.aeroOption, null);
    } else if (unit.hasETypeFlag(Entity.ETYPE_BATTLEARMOR)) {
        testEntity = new TestBattleArmor((BattleArmor) unit, entityVerifier.baOption, null);
    } else if (unit.hasETypeFlag(Entity.ETYPE_INFANTRY)) {
        testEntity = new TestInfantry((Infantry) unit, entityVerifier.infOption, null);
    }
    return testEntity;
}
Also used : TestEntity(megamek.common.verifier.TestEntity) EntityVerifier(megamek.common.verifier.EntityVerifier) TestTank(megamek.common.verifier.TestTank) TestAero(megamek.common.verifier.TestAero) TestBattleArmor(megamek.common.verifier.TestBattleArmor) TestTank(megamek.common.verifier.TestTank) Tank(megamek.common.Tank) Infantry(megamek.common.Infantry) TestInfantry(megamek.common.verifier.TestInfantry) TestMech(megamek.common.verifier.TestMech) TestSupportVehicle(megamek.common.verifier.TestSupportVehicle) TestSmallCraft(megamek.common.verifier.TestSmallCraft) Mech(megamek.common.Mech) TestMech(megamek.common.verifier.TestMech) TripodMech(megamek.common.TripodMech) BipedMech(megamek.common.BipedMech) LandAirMech(megamek.common.LandAirMech) QuadMech(megamek.common.QuadMech) File(java.io.File) Aero(megamek.common.Aero) TestAero(megamek.common.verifier.TestAero) TestInfantry(megamek.common.verifier.TestInfantry)

Example 3 with TestAero

use of megamek.common.verifier.TestAero in project megameklab by MegaMek.

the class StatusBar method refresh.

public void refresh() {
    int heat = getAero().getHeatCapacity();
    double tonnage = getAero().getWeight();
    double currentTonnage;
    int bv = getAero().calculateBattleValue();
    long currentCost = (long) Math.round(getAero().getCost(false));
    testAero = new TestAero(getAero(), entityVerifier.aeroOption, null);
    currentTonnage = testAero.calculateWeight();
    currentTonnage += UnitUtil.getUnallocatedAmmoTonnage(getAero());
    double totalHeat = calculateTotalHeat();
    heatSink.setText("Heat: " + totalHeat + "/" + heat);
    heatSink.setToolTipText("Total Heat Generated/Total Heat Dissipated");
    if (totalHeat > heat) {
        heatSink.setForeground(Color.red);
    } else {
        heatSink.setForeground(Color.black);
    }
    heatSink.setVisible(getAero().getEntityType() == Entity.ETYPE_AERO);
    tons.setText("Tonnage: " + currentTonnage + "/" + tonnage);
    tons.setToolTipText("Current Tonnage/Max Tonnage");
    if (currentTonnage > tonnage) {
        tons.setForeground(Color.red);
    } else {
        tons.setForeground(Color.black);
    }
    bvLabel.setText("BV: " + bv);
    bvLabel.setToolTipText("BV 2.0");
    cost.setText("Cost: " + formatter.format(currentCost) + " C-bills");
}
Also used : TestAero(megamek.common.verifier.TestAero)

Aggregations

TestAero (megamek.common.verifier.TestAero)3 File (java.io.File)1 Aero (megamek.common.Aero)1 BipedMech (megamek.common.BipedMech)1 Infantry (megamek.common.Infantry)1 LandAirMech (megamek.common.LandAirMech)1 Mech (megamek.common.Mech)1 QuadMech (megamek.common.QuadMech)1 Tank (megamek.common.Tank)1 TripodMech (megamek.common.TripodMech)1 EntityVerifier (megamek.common.verifier.EntityVerifier)1 TestBattleArmor (megamek.common.verifier.TestBattleArmor)1 TestEntity (megamek.common.verifier.TestEntity)1 TestInfantry (megamek.common.verifier.TestInfantry)1 TestMech (megamek.common.verifier.TestMech)1 TestSmallCraft (megamek.common.verifier.TestSmallCraft)1 TestSupportVehicle (megamek.common.verifier.TestSupportVehicle)1 TestTank (megamek.common.verifier.TestTank)1