27
27
*/
28
28
package mekhq .gui .dialog .nagDialogs ;
29
29
30
- import mekhq .MHQConstants ;
31
- import mekhq .MekHQ ;
32
- import mekhq .campaign .Campaign ;
33
- import mekhq .gui .baseComponents .AbstractMHQNagDialog ;
34
-
30
+ import static mekhq .MHQConstants .NAG_OUTSTANDING_SCENARIOS ;
35
31
import static mekhq .gui .dialog .nagDialogs .nagLogic .OutstandingScenariosNagLogic .getOutstandingScenarios ;
36
32
import static mekhq .gui .dialog .nagDialogs .nagLogic .OutstandingScenariosNagLogic .hasOutStandingScenarios ;
33
+ import static mekhq .utilities .MHQInternationalization .getFormattedTextAt ;
34
+
35
+ import mekhq .MekHQ ;
36
+ import mekhq .campaign .Campaign ;
37
+ import mekhq .gui .baseComponents .immersiveDialogs .ImmersiveDialogNag ;
37
38
38
39
/**
39
- * Represents a nag dialog for displaying the list of outstanding scenarios in a campaign.
40
+ * A dialog class used to notify players about outstanding scenarios in their campaign.
40
41
*
41
- * <p>
42
- * This dialog checks for active scenarios within the campaign, categorizes them by
43
- * their state (e.g., unresolved or requiring a track), and displays a list of these
44
- * scenarios to the user. Scenarios are considered "outstanding" if they are unresolved or
45
- * require attention on the current campaign date.
46
- * </p>
47
- *
48
- * <p>
49
- * The dialog includes logic to account for both AtB contracts and StratCon-enabled campaigns,
50
- * formatting the outstanding scenarios with additional details when appropriate.
51
- * </p>
42
+ * <p>The {@code OutstandingScenariosNagDialog} extends {@link ImmersiveDialogNag} and provides a specialized
43
+ * dialog designed to alert players when there are unresolved or pending scenarios in the campaign. It uses predefined
44
+ * values, including the {@code NAG_OUTSTANDING_SCENARIOS} constant, and does not include a specific speaker, relying
45
+ * instead on a default fallback mechanism.</p>
52
46
*/
53
- public class OutstandingScenariosNagDialog extends AbstractMHQNagDialog {
47
+ public class OutstandingScenariosNagDialog extends ImmersiveDialogNag {
48
+
54
49
/**
55
- * Constructs the OutstandingScenariosNagDialog for the given campaign .
50
+ * Constructs a new {@code OutstandingScenariosNagDialog} instance to display the outstanding scenarios nag dialog .
56
51
*
57
- * <p>
58
- * Upon initialization, this dialog prepares a formatted string of outstanding
59
- * scenarios (if any) and sets up the dialog UI for display.
60
- * </p>
52
+ * <p>This constructor initializes the dialog with preconfigured parameters, such as the
53
+ * {@code NAG_OUTSTANDING_SCENARIOS} constant for managing dialog suppression and the
54
+ * {@code "OutstandingScenariosNagDialog"} message key for retrieving localized dialog content. No specific speaker
55
+ * is provided, triggering fallback logic to determine a suitable speaker for the dialog. </p>
61
56
*
62
- * @param campaign The {@link Campaign} associated with this nag dialog.
57
+ * @param campaign The {@link Campaign} instance associated with this dialog. Provides access to campaign data and
58
+ * settings required for constructing the dialog.
63
59
*/
64
60
public OutstandingScenariosNagDialog (final Campaign campaign ) {
65
- super (campaign , MHQConstants .NAG_OUTSTANDING_SCENARIOS );
61
+ super (campaign , null , NAG_OUTSTANDING_SCENARIOS , "OutstandingScenariosNagDialog" );
62
+ }
66
63
67
- final String DIALOG_BODY = "OutstandingScenariosNagDialog.text" ;
64
+ @ Override
65
+ protected String getInCharacterMessage (Campaign campaign , String key , String commanderAddress ) {
66
+ final String RESOURCE_BUNDLE = "mekhq.resources.NagDialogs" ;
68
67
69
68
String outstandingScenarios = getOutstandingScenarios (campaign );
70
69
71
- String addendum = "" ;
72
- if (campaign .getCampaignOptions ().isUseStratCon ()) {
73
- addendum = resources .getString ("OutstandingScenariosNagDialog.stratCon" );
74
- }
75
-
76
- setRightDescriptionMessage (String .format (resources .getString (DIALOG_BODY ),
77
- campaign .getCommanderAddress (false ), outstandingScenarios , addendum ));
78
- showDialog ();
70
+ return getFormattedTextAt (RESOURCE_BUNDLE , key + ".ic" , commanderAddress , outstandingScenarios );
79
71
}
80
72
81
73
/**
@@ -89,13 +81,14 @@ public OutstandingScenariosNagDialog(final Campaign campaign) {
89
81
* </ul>
90
82
*
91
83
* @param campaign the {@link Campaign} to check for nagging conditions
84
+ *
92
85
* @return {@code true} if the nag dialog should be displayed, {@code false} otherwise
93
86
*/
94
87
public static boolean checkNag (Campaign campaign ) {
95
- final String NAG_KEY = MHQConstants . NAG_OUTSTANDING_SCENARIOS ;
88
+ final String NAG_KEY = NAG_OUTSTANDING_SCENARIOS ;
96
89
97
- return campaign .getCampaignOptions ().isUseAtB ()
98
- && !MekHQ .getMHQOptions ().getNagDialogIgnore (NAG_KEY )
99
- && hasOutStandingScenarios (campaign );
90
+ return campaign .getCampaignOptions ().isUseAtB () &&
91
+ !MekHQ .getMHQOptions ().getNagDialogIgnore (NAG_KEY ) &&
92
+ hasOutStandingScenarios (campaign );
100
93
}
101
94
}
0 commit comments