Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summary updates #1374

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ private void setUpPanels() {
panPatchwork.setVisible(false);
}
panSummary = new SummaryView(eSource,
new UnitTypeSummaryItem(),
new StructureSummaryItem(),
new EngineSummaryItem(),
new PropulsionSummaryItem(),
Expand Down
2 changes: 2 additions & 0 deletions megameklab/src/megameklab/ui/fighterAero/ASStructureTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ private void setUpPanels() {
panPatchwork.setVisible(false);
}
panSummary = new SummaryView(eSource,
new UnitTypeSummaryItem(),
new StructureSummaryItem(),
new EngineSummaryItem(),
new CockpitSummaryItem(),
new FuelSummaryItem(),
new HeatsinkSummaryItem(),
new ControlsSummaryItem(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package megameklab.ui.generalUnit.summary;

import megamek.common.AeroSpaceFighter;
import megamek.common.Entity;
import megamek.common.Mech;
import megamek.common.verifier.TestAero;
import megamek.common.verifier.TestMech;
import megameklab.util.UnitUtil;

Expand All @@ -15,10 +17,14 @@ public String getName() {
@Override
public void refresh(Entity entity) {
if ((entity instanceof Mech) && (((Mech) entity).getCockpitType() != Mech.COCKPIT_UNKNOWN)) {
Mech mek = (Mech) entity;
availabilityLabel.setText(mek.getCockpitTechAdvancement().getFullRatingName(entity.isClan()));
TestMech testMech = (TestMech) UnitUtil.getEntityVerifier(entity);
availabilityLabel.setText("");
weightLabel.setText(formatWeight(testMech.getWeightCockpit(), entity));
critLabel.setText(formatCrits(getCockpitCrits((Mech) entity)));
} else if ((entity instanceof AeroSpaceFighter)) {
AeroSpaceFighter fighter = (AeroSpaceFighter) entity;
availabilityLabel.setText(fighter.getCockpitTechAdvancement().getFullRatingName(entity.isClan()));
} else {
availabilityLabel.setText("");
weightLabel.setText("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ public String getName() {
@Override
public void refresh(Entity entity) {
if ((entity instanceof Mech) && (entity.getGyroType() != Mech.GYRO_NONE)) {
Mech mek = (Mech) entity;
availabilityLabel.setText(mek.getGyroTechAdvancement().getFullRatingName(entity.isClan()));
TestMech testMech = (TestMech) UnitUtil.getEntityVerifier(entity);
availabilityLabel.setText("");
weightLabel.setText(formatWeight(testMech.getWeightGyro(), entity));
critLabel.setText(formatCrits(getGyroCrits(entity)));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public void refresh(Entity entity) {
availabilityLabel.setText(enhancement.get().getType().getFullRatingName(entity.isClan()));
weightLabel.setText(formatWeight(enhancement.get().getTonnage(), entity));
critLabel.setText(formatCrits(enhancement.get().getCriticals()));
} else {
availabilityLabel.setText("");
weightLabel.setText("");
critLabel.setText("");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2024 - The MegaMek Team. All Rights Reserved.
*
* This file is part of MegaMekLab.
*
* MegaMek is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MegaMek is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MegaMek. If not, see <http://www.gnu.org/licenses/>.
*/
package megameklab.ui.generalUnit.summary;

import megamek.common.Entity;

public class UnitTypeSummaryItem extends AbstractSummaryItem {

@Override
public String getName() {
return "Unit Type";
}

@Override
public void refresh(Entity entity) {
availabilityLabel.setText(entity.getConstructionTechAdvancement().getFullRatingName(entity.isClan()));
}
}
1 change: 1 addition & 0 deletions megameklab/src/megameklab/ui/largeAero/DSStructureTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ private void setUpPanels() {
panCrew = new LACrewView(panInfo);
panArmorAllocation = new ArmorAllocationView(panInfo, Entity.ETYPE_AERO);
panSummary = new SummaryView(eSource,
new UnitTypeSummaryItem(),
new StructureSummaryItem(),
new EngineSummaryItem(),
new FuelSummaryItem(),
Expand Down
1 change: 1 addition & 0 deletions megameklab/src/megameklab/ui/largeAero/WSStructureTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ private void setUpPanels() {
panGravDecks = new WSGravDeckView();
panArmorAllocation = new ArmorAllocationView(panInfo, Entity.ETYPE_AERO);
panSummary = new SummaryView(eSource,
new UnitTypeSummaryItem(),
new StructureSummaryItem(),
new EngineSummaryItem(),
new FuelSummaryItem(),
Expand Down
2 changes: 2 additions & 0 deletions megameklab/src/megameklab/ui/mek/BMStructureTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private void setUpPanels() {
panArmorAllocation = new ArmorAllocationView(panBasicInfo, Entity.ETYPE_MECH);
panPatchwork = new PatchworkArmorView(panBasicInfo);
panSummary = new SummaryView(eSource,
new UnitTypeSummaryItem(),
new StructureSummaryItem(),
new EngineSummaryItem(),
new GyroSummaryItem(),
Expand Down Expand Up @@ -911,6 +912,7 @@ public void enhancementChanged(EquipmentType enhancement) {
refresh.refreshBuild();
refresh.refreshPreview();
refresh.refreshStatus();
refresh.refreshSummary();
}

@Override
Expand Down
1 change: 1 addition & 0 deletions megameklab/src/megameklab/ui/protoMek/PMStructureTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ private void setUpPanels() {
panMovement = new MovementView(panBasicInfo);
panArmorAllocation = new ArmorAllocationView(panBasicInfo, Entity.ETYPE_PROTOMECH);
panSummary = new SummaryView(eSource,
new UnitTypeSummaryItem(),
new StructureSummaryItem(),
new EngineSummaryItem(),
new HeatsinkSummaryItem(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ private void setupPanels() {
panChassisMod = new SVChassisModView(panBasicInfo);
panCrew = new SVCrewView();
panSummary = new SummaryView(eSource,
new UnitTypeSummaryItem(),
new StructureSummaryItem(),
new EngineSummaryItem(),
new FuelSummaryItem(),
Expand Down
Loading