Skip to content

Commit

Permalink
Merge pull request #4718 from IllianiCBT/stratCon_information
Browse files Browse the repository at this point in the history
Added StratCon Introduction Promo on Campaign Start
  • Loading branch information
IllianiCBT authored Aug 27, 2024
2 parents 0e0fbae + ce35073 commit fddd96f
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
Binary file added MekHQ/data/images/stratcon/stratConPromo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions MekHQ/resources/mekhq/resources/CampaignOptionsDialog.properties
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,28 @@ btnLoadPreset.text=Load a Preset
btnLoadPreset.toolTipText=Load a Campaign Preset and apply it to the current dialog. If it is during startup, it will apply all values outside of starting planet, contract count, and game options. Otherwise, it will only apply continuous preset values outside of game options.
##end Button Panel

## StratCon Notice
stratConPromo.title=+++ INCOMING TRANSMISSION +++
stratConPromo.message=<html><body style='width: 500px'><br><div style='text-align: center;'><span style='font-size: 20px;'>Welcome to StratCon, Commander!</span></div>\
<br>This isn't just about firing a few lasers; it's about controlling the entire battlefield. Deploy your units wisely across diverse terrains - icy wastelands, scorching deserts, you name it. Use the hex grid to outmaneuver and out think the enemy.\
<br>\
<br><b>Key Features:\
<br>Unit Management:</b> Keep your lances in top fighting shape. Deploy smartly, handle repairs, and ensure your warriors are ready for the next engagement. A well-prepared lance is a winning lance.\
<br>\
<br><b>Scouting:</b> Send out scouts to reveal enemy positions and trigger scenarios. Sometimes, the best move is to cut your losses and keep those scouts alive for future intel. Trust me, a live scout today means a victory tomorrow.\
<br>\
<br><b>Strategic Command:</b> Deploy your forces across the map to capture key objectives and manage multiple tracks. Keep your personnel and machines combat-ready at all times. Remember, deployed units take time to return-plan your deployments carefully to avoid being caught off-guard.\
<br>\
<br><b>Dynamic Scenarios:</b> You'll face everything from recon missions to base defenses and full-blown assaults. Expect to encounter Mechs, tanks, DropShips, and even aerospace fighters. Be prepared for anything.\
<br>\
<br><b>Managing Victory Points:</b> It's not just about winning battles; it's about winning the war. Focus on your Contract Victory Points (CVP) to keep your contract score high. These determine if you'll succeed on the contract. Scenario Victory Points (SVP) are only for winning individual battles. Keep your CVP high to ensure ultimate victory, while managing SVPs to succeed in the here and now.\
<br>\
<br>Remember, Commander, victory isn't just about firepower; it's about strategy, foresight, and making every decision count.</body></html>
stratConPromo.button=Proceed
##end StratCon Notice

## Option Validation Warnings
CampaignOptionsPane.EmptyCampaignName.text=You cannot have an empty campaign name.
CampaignOptionsPane.NullFactionSelected.text=You cannot have an empty campaign faction.
CampaignOptionsPane.FactionWithoutFactionCodeSelected.text=You cannot select a faction named %s, as it is missing its faction code.

52 changes: 51 additions & 1 deletion MekHQ/src/mekhq/gui/dialog/CampaignOptionsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.ResourceBundle;

/**
Expand Down Expand Up @@ -97,7 +98,7 @@ protected JPanel createButtonPanel() {
final JPanel panel = new JPanel(new GridLayout(1, 0));

panel.add(new MMButton("btnOkay", resources, "Confirm.text", null,
this::okButtonActionPerformed));
this::okButtonPerformedShowStratConNotice));

panel.add(new MMButton("btnSavePreset", resources, "btnSavePreset.text",
"btnSavePreset.toolTipText", evt -> btnSaveActionPerformed()));
Expand All @@ -116,6 +117,55 @@ protected JPanel createButtonPanel() {
return panel;
}

/**
* Performs the action when the Ok button is clicked, which includes invoking the
* {@link #okButtonActionPerformed(ActionEvent)} method and then the {@link #showStratConNotice()} method.
*
* @param e the ActionEvent triggering this method
*/
private void okButtonPerformedShowStratConNotice(ActionEvent e) {
okButtonActionPerformed(e);
showStratConNotice();
}

/**
* Displays a promo introducing users to StratCon.
* This method shows the promo only when the Campaign Options pane is closed
* and the current day is the first day of the campaign.
*/
private void showStratConNotice() {
// we don't store whether this dialog has previously appeared,
// instead we just have it appear only when Campaign Options is closed,
// the current day is the first day of the campaign, and StratCon is enabled
if (!campaign.getCampaignOptions().isUseStratCon() || !campaign.getLocalDate().equals(campaign.getCampaignStartDate())) {
return;
}

ImageIcon imageIcon = new ImageIcon("data/images/stratcon/stratConPromo.png");
JLabel imageLabel = new JLabel(imageIcon);
JPanel imagePanel = new JPanel(new GridBagLayout());
imagePanel.add(imageLabel);

String title = resources.getString("stratConPromo.title");

String message = resources.getString("stratConPromo.message");
JLabel messageLabel = new JLabel(message);
JPanel messagePanel = new JPanel(new GridBagLayout());
messagePanel.add(messageLabel);

JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
panel.add(imagePanel);
panel.add(messagePanel);

Object[] options = {
resources.getString("stratConPromo.button")
};

JOptionPane.showOptionDialog(null, panel, title, JOptionPane.DEFAULT_OPTION,
JOptionPane.INFORMATION_MESSAGE, null, options, options[0]);
}

@Override
protected void finalizeInitialization() throws Exception {
getCampaignOptionsPane().setOptions(getCampaign().getCampaignOptions(),
Expand Down

0 comments on commit fddd96f

Please sign in to comment.