8000 Improvement: Moved New Bulletins to Use 'Simple' Version of Immersive Dialog and not 'Full' Version by IllianiBird · Pull Request #6851 · MegaMek/mekhq · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improvement: Moved New Bulletins to Use 'Simple' Version of Immersive Dialog and not 'Full' Version #6851

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

Merged
merged 6 commits into from
May 19, 2025
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
2 changes: 1 addition & 1 deletion MekHQ/src/mekhq/gui/CampaignGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,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());
}
}

Expand Down
48 changes: 19 additions & 29 deletions MekHQ/src/mekhq/gui/dialog/NewsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"
* <https://www.xbox.com/en-US/developers/rules> and it is not endorsed by or
* affiliated with Microsoft.
*/
package mekhq.gui.dialog;

Expand All @@ -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
Expand All @@ -52,7 +55,7 @@
* This dialog is a part of MekHQ and displays immersive content in the game GUI.
* </p>
*/
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;
Expand All @@ -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.
*
* <p>
* 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.
* </p>
*
* @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<ButtonLabelTooltipPair> createButtons() {
ButtonLabelTooltipPair btnClose = new ButtonLabelTooltipPair(getFormattedTextAt(RESOURCE_BUNDLE,
"newsReport.button"), null);

return List.of(btnClose);
null, false);
}

@Override
Expand Down
Loading
0