From a7b3228a870fcf4204953c0b924a6bc639e6aa80 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Fri, 2 May 2025 19:14:48 -0500 Subject: [PATCH] Improvement: Moved New Bulletins to Use 'Simple' Version of Immersive Dialog and not 'Full' Version --- MekHQ/src/mekhq/gui/CampaignGUI.java | 2 +- MekHQ/src/mekhq/gui/dialog/NewsDialog.java | 48 +++++++++------------- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/MekHQ/src/mekhq/gui/CampaignGUI.java b/MekHQ/src/mekhq/gui/CampaignGUI.java index 6a9ad65af25..e39a34fbd80 100644 --- a/MekHQ/src/mekhq/gui/CampaignGUI.java +++ b/MekHQ/src/mekhq/gui/CampaignGUI.java @@ -1450,7 +1450,7 @@ public void focusOnPerson(UUID id) { public void showNews(int id) { NewsItem news = getCampaign().getNews().getNewsItem(id); if (null != news) { - new NewsDialog(getCampaign(), news); + new NewsDialog(getCampaign(), news.getFullDescription()); } } diff --git a/MekHQ/src/mekhq/gui/dialog/NewsDialog.java b/MekHQ/src/mekhq/gui/dialog/NewsDialog.java index 9ecb73166d3..87b4f8b956f 100644 --- a/MekHQ/src/mekhq/gui/dialog/NewsDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/NewsDialog.java @@ -24,6 +24,11 @@ * * Catalyst Game Labs and the Catalyst Game Labs logo are trademarks of * InMediaRes Productions, LLC. + * + * MechWarrior Copyright Microsoft Corporation. MekHQ was created under + * Microsoft's "Game Content Usage Rules" + * and it is not endorsed by or + * affiliated with Microsoft. */ package mekhq.gui.dialog; @@ -38,12 +43,10 @@ import javax.swing.JLabel; import javax.swing.JPanel; -import megamek.client.ui.swing.util.UIUtil; import megamek.common.annotations.Nullable; import mekhq.campaign.Campaign; import mekhq.campaign.personnel.Person; -import mekhq.campaign.universe.NewsItem; -import mekhq.gui.baseComponents.immersiveDialogs.ImmersiveDialogCore; +import mekhq.gui.baseComponents.immersiveDialogs.ImmersiveDialogSimple; /** * NewsDialog is a dialog window for displaying news items within the context of a campaign. It includes information @@ -52,7 +55,7 @@ * This dialog is a part of MekHQ and displays immersive content in the game GUI. *

*/ -public class NewsDialog extends ImmersiveDialogCore { +public class NewsDialog extends ImmersiveDialogSimple { private static final String RESOURCE_BUNDLE = "mekhq.resources.NewsDialog"; private static final int OPERATION_KLONDIKE = 2822; @@ -62,35 +65,22 @@ public class NewsDialog extends ImmersiveDialogCore { private static final String AFFILIATE_NETWORK_NAME = "affiliateNewsNetworks"; /** - * Constructs a new NewsDialog to display a given {@link NewsItem}. + * Constructs a {@code NewsDialog} that displays a central message to the player within the campaign context. + * + *

+ * The dialog uses a placeholder speaker to ensure that the immersive dialog interface displays the speaker panel, + * even though no specific person is associated with the message. Only the provided central message is shown. + *

* - * @param campaign The campaign instance containing relevant game details. - * @param news The {@link NewsItem} to be displayed in the dialog. + * @param campaign the current {@link Campaign} context + * @param centerMessage the main message to display in the dialog */ - public NewsDialog(Campaign campaign, NewsItem news) { - super(campaign, - new Person(campaign), - null, - news.getFullDescription(), - createButtons(), - null, - UIUtil.scaleForGUI(400), - false, + public NewsDialog(Campaign campaign, String centerMessage) { + super(campaign, new Person(campaign), // empty person to trick immersive dialog into showing the speaker panel + null, centerMessage, null, null, - true); - } - - /** - * Creates the buttons for the dialog. - * - * @return A list of {@link ButtonLabelTooltipPair} containing buttons for the dialog. - */ - private static List createButtons() { - ButtonLabelTooltipPair btnClose = new ButtonLabelTooltipPair(getFormattedTextAt(RESOURCE_BUNDLE, - "newsReport.button"), null); - - return List.of(btnClose); + null, false); } @Override