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

Call CostDisplayDialog in MML #1095

Merged
merged 3 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 5 additions & 3 deletions megameklab/src/megameklab/ui/MenuBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
package megameklab.ui;

import megamek.client.ui.dialogs.CostDisplayDialog;
import megamek.client.ui.swing.UnitLoadingDialog;
import megamek.common.*;
import megamek.common.annotations.Nullable;
Expand Down Expand Up @@ -566,7 +567,7 @@ private void jMenuGetUnitBreakdownFromCache_actionPerformed() {
UnitLoadingDialog unitLoadingDialog = new UnitLoadingDialog(parentFrame);
unitLoadingDialog.setVisible(true);
MegaMekLabUnitSelectorDialog viewer = new MegaMekLabUnitSelectorDialog(parentFrame, unitLoadingDialog);
UnitUtil.showUnitCostBreakDown(parentFrame, viewer.getChosenEntity());
new CostDisplayDialog(parentFrame, viewer.getChosenEntity()).setVisible(true);
}

private void jMenuGetUnitWeightBreakdownFromCache_actionPerformed() {
Expand Down Expand Up @@ -638,7 +639,7 @@ private void jMenuGetUnitBreakdownFromFile_actionPerformed() {
}

try {
UnitUtil.showUnitCostBreakDown(parentFrame, new MechFileParser(unitFile).getEntity());
new CostDisplayDialog(parentFrame, new MechFileParser(unitFile).getEntity()).setVisible(true);
} catch (Exception ex) {
JOptionPane.showMessageDialog(parentFrame,
String.format(resourceMap.getString("message.invalidUnit.format"),
Expand Down Expand Up @@ -726,7 +727,8 @@ private void jMenuBVCalculations_actionPerformed() {
}

private void jMenuUnitCostBreakdown_actionPerformed() {
UnitUtil.showUnitCostBreakDown(parentFrame, parentFrame.getEntity());
new CostDisplayDialog(parentFrame, parentFrame.getEntity()).setVisible(true);

}

private void jMenuUnitWeightBreakdown_actionPerformed() {
Expand Down
11 changes: 1 addition & 10 deletions megameklab/src/megameklab/util/UnitUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package megameklab.util;

import megamek.client.ui.dialogs.BVDisplayDialog;
import megamek.client.ui.dialogs.CostDisplayDialog;
import megamek.common.*;
import megamek.common.annotations.Nullable;
import megamek.common.verifier.*;
Expand Down Expand Up @@ -3481,15 +3482,6 @@ public static void showUnitSpecs(Entity unit, JFrame frame) {
}
}

public static void showUnitCostBreakDown(final JFrame frame, final @Nullable Entity entity) {
if (entity == null) {
return;
}
entity.calculateBattleValue(true, true);
entity.getCost(true);
new BVDisplayDialog(frame, entity).setVisible(true);
}

public static void showUnitWeightBreakDown(Entity unit, JFrame frame) {
TestEntity testEntity = getEntityVerifier(unit);

Expand Down Expand Up @@ -3533,7 +3525,6 @@ public static void showBVCalculations(final JFrame frame, final @Nullable Entity
if (entity == null) {
return;
}
entity.calculateBattleValue(true, true);
new BVDisplayDialog(frame, entity).setVisible(true);
}

Expand Down