Skip to content

Commit

Permalink
Merge pull request #5154 from IllianiCBT/stratCon_sectors2
Browse files Browse the repository at this point in the history
Renamed Tracks and AtB Campaign State in StratCon
  • Loading branch information
HammerGS authored Nov 4, 2024
2 parents d9d7381 + 6a46b2e commit e0fb583
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 46 deletions.
2 changes: 1 addition & 1 deletion MekHQ/resources/mekhq/resources/CampaignGUI.properties
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ panOrganization.TabConstraints.tabTitle=TO&E
panMap.TabConstraints.tabTitle=Interstellar Map
panBriefing.TabConstraints.tabTitle=Briefing Room
panMekLab.TabConstraints.tabTitle=Mek Lab
panStratcon.TabConstraints.tabTitle=AtB Campaign State
panStratcon.TabConstraints.tabTitle=Area of Operations
panCustom.TabConstraints.tabTitle=Custom
btnAssignDoc.text=Assign
btnUnassignDoc.text=Unassign
Expand Down
2 changes: 1 addition & 1 deletion MekHQ/resources/mekhq/resources/GUI.properties
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ MHQTabType.REPAIR_BAY.text=Repair Bay
MHQTabType.INFIRMARY.text=Infirmary
MHQTabType.FINANCES.text=Finances
MHQTabType.MEK_LAB.text=Mek Lab
MHQTabType.STRAT_CON.text=AtB Campaign State
MHQTabType.STRAT_CON.text=Area of Operations

#### PersonnelFilter Enum
PersonnelFilter.ALL.text=All Personnel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022 - The MegaMek Team. All Rights Reserved.
* Copyright (c) 2019-2024 - The MegaMek Team. All Rights Reserved.
*
* This file is part of MekHQ.
*
Expand Down Expand Up @@ -79,7 +79,7 @@ public static void initializeCampaignState(AtBContract contract, Campaign campai

StratconTrackState track = initializeTrackState(NUM_LANCES_PER_TRACK, scenarioOdds, deploymentTime,
planetaryTemperature);
track.setDisplayableName(String.format("Track %d", x));
track.setDisplayableName(String.format("Sector %d", x));
campaignState.addTrack(track);
}

Expand All @@ -95,7 +95,7 @@ public static void initializeCampaignState(AtBContract contract, Campaign campai

StratconTrackState track = initializeTrackState(oddLanceCount, scenarioOdds, deploymentTime,
planetaryTemperature);
track.setDisplayableName(String.format("Track %d", campaignState.getTracks().size()));
track.setDisplayableName(String.format("Sector %d", campaignState.getTracks().size()));
campaignState.addTrack(track);
}

Expand Down
62 changes: 24 additions & 38 deletions MekHQ/src/mekhq/gui/StratconPanel.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* MegaMek - Copyright (c) 2020-2023 - The MegaMek Team. All Rights Reserved.
* MegaMek - Copyright (c) 2020-2024 - The MegaMek Team. All Rights Reserved.
*
* This program 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
Expand All @@ -13,6 +13,19 @@
*/
package mekhq.gui;

import megamek.common.util.ImageUtil;
import megamek.logging.MMLogger;
import mekhq.MekHQ;
import mekhq.campaign.Campaign;
import mekhq.campaign.force.Force;
import mekhq.campaign.mission.ScenarioForceTemplate.ForceAlignment;
import mekhq.campaign.stratcon.*;
import mekhq.campaign.stratcon.StratconBiomeManifest.ImageType;
import mekhq.gui.stratcon.StratconScenarioWizard;
import mekhq.gui.stratcon.TrackForceAssignmentUI;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
Expand All @@ -27,37 +40,10 @@
import java.util.HashMap;
import java.util.Map;

import javax.imageio.ImageIO;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;

import megamek.common.util.ImageUtil;
import megamek.logging.MMLogger;
import mekhq.MekHQ;
import mekhq.campaign.Campaign;
import mekhq.campaign.force.Force;
import mekhq.campaign.mission.ScenarioForceTemplate.ForceAlignment;
import mekhq.campaign.stratcon.StratconBiomeManifest;
import mekhq.campaign.stratcon.StratconBiomeManifest.ImageType;
import mekhq.campaign.stratcon.StratconCampaignState;
import mekhq.campaign.stratcon.StratconCoords;
import mekhq.campaign.stratcon.StratconFacility;
import mekhq.campaign.stratcon.StratconFacilityFactory;
import mekhq.campaign.stratcon.StratconRulesManager;
import mekhq.campaign.stratcon.StratconScenario;
import mekhq.campaign.stratcon.StratconTrackState;
import mekhq.gui.stratcon.StratconScenarioWizard;
import mekhq.gui.stratcon.TrackForceAssignmentUI;

/**
* This panel handles AtB-Stratcon GUI interactions with a specific scenario
* track.
*
*
* @author NickAragua
*/
public class StratconPanel extends JPanel implements ActionListener {
Expand Down Expand Up @@ -209,7 +195,7 @@ private void buildRightClickMenu(StratconCoords coords) {
rightClickMenu.addSeparator();

menuItemGMReveal = new JMenuItem();
menuItemGMReveal.setText(currentTrack.isGmRevealed() ? "Hide Track" : "Reveal Track");
menuItemGMReveal.setText(currentTrack.isGmRevealed() ? "Hide Sector" : "Reveal Sector");
menuItemGMReveal.setActionCommand(RCLICK_COMMAND_REVEAL_TRACK);
menuItemGMReveal.addActionListener(this);
rightClickMenu.add(menuItemGMReveal);
Expand Down Expand Up @@ -329,7 +315,7 @@ private Polygon generateGraphHex() {
* The point of it is to draw all the hexes for the board.
* If it's a "dry run", we don't actually draw the hexes, we just pretend to
* until we "draw" one that encompasses the clicked point.
*
*
* @param g2D - graphics object on which to draw
* @param drawHexType - whether to draw the hex backgrounds, hex outlines or a
* dry run for click detection
Expand Down Expand Up @@ -522,7 +508,7 @@ private BufferedImage getImage(String imageKey, ImageType imageType) {
try {
image = ImageIO.read(biomeImageFile);
} catch (Exception e) {
logger.error("Unable to load image: " + imageName + " with ID '" + imageKey + "'");
logger.error("Unable to load image: " + imageName + " with ID '" + imageKey + '\'');
return null;
}

Expand Down Expand Up @@ -742,7 +728,7 @@ private void drawTextEffect(Graphics2D g2D, Shape marker, String text, StratconC
/**
* Returns the translation that we need to make to render the "next downward"
* hex.
*
*
* @return Two dimensional array with the first element being the x vector and
* the second being the y vector
*/
Expand All @@ -754,14 +740,14 @@ private int[] getDownwardYVector() {
* Returns the translation that we need to make to move from the bottom of a
* column to the top of the next
* column to the right.
*
*
* @param evenColumn Whether the column we're currently in is odd or even
* @return Two dimensional array with the first element being the x vector and
* the second being the y vector
*/
private int[] getRightAndUpVector(boolean evenColumn) {
int yRadius = (int) (HEX_Y_RADIUS);
int xRadius = (int) (HEX_X_RADIUS);
int yRadius = HEX_Y_RADIUS;
int xRadius = HEX_X_RADIUS;

int yTranslation = currentTrack.getHeight() * yRadius * 2;
if (evenColumn) {
Expand All @@ -777,7 +763,7 @@ private int[] getRightAndUpVector(boolean evenColumn) {
* Go to the origin of the hex board and reset the scaling.
*/
private void performInitialTransform(Graphics2D g2D) {
g2D.translate(0, 0 + HEX_Y_RADIUS);
g2D.translate(0, HEX_Y_RADIUS);
g2D.scale(scale, scale);
}

Expand All @@ -789,7 +775,7 @@ private void performInitialTransform(Graphics2D g2D) {
* for this class.
*
* Side effects: the dry run sets the boardState clicked hex coordinates.
*
*
* @return Whether or not the clicked point was found on the hex board
*/
private boolean detectClickedHex() {
Expand Down
6 changes: 3 additions & 3 deletions MekHQ/src/mekhq/gui/StratconTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private void initializeInfoPanel() {
expandedObjectivePanel.setAlignmentX(LEFT_ALIGNMENT);
infoPanel.add(expandedObjectivePanel);

JLabel lblCurrentTrack = new JLabel("Current Track:");
JLabel lblCurrentTrack = new JLabel("Current Sector:");
infoPanel.add(lblCurrentTrack);

cboCurrentTrack = new JComboBox<>();
Expand Down Expand Up @@ -350,7 +350,7 @@ private String buildStrategicObjectiveText(StratconCampaignState campaignState)
sb.append("Engage and defeat hostile forces in ")
.append(objective.getCurrentObjectiveCount()).append('/')
.append(objective.getDesiredObjectiveCount())
.append(" scenarios on ").append(track.getDisplayableName());
.append(" scenarios in ").append(track.getDisplayableName());
break;
default:
break;
Expand Down Expand Up @@ -414,7 +414,7 @@ private void repopulateTrackList() {
stratconPanel.selectTrack(selectedTrack.contract.getStratconCampaignState(), currentTDI.track);
stratconPanel.setVisible(true);
} else {
infoPanelText.setText("No active campaign tracks");
infoPanelText.setText("No active sectors");
stratconPanel.setVisible(false);
}
}
Expand Down

0 comments on commit e0fb583

Please sign in to comment.