27
27
*/
28
28
package mekhq .gui .dialog .nagDialogs ;
29
29
30
+ import static mekhq .MHQConstants .NAG_NO_COMMANDER ;
31
+ import static mekhq .campaign .Campaign .AdministratorSpecialization .HR ;
32
+ import static mekhq .gui .dialog .nagDialogs .nagLogic .NoCommanderNagLogic .hasNoCommander ;
33
+
30
34
import megamek .common .annotations .Nullable ;
31
- import mekhq .MHQConstants ;
32
35
import mekhq .MekHQ ;
33
36
import mekhq .campaign .Campaign ;
34
37
import mekhq .campaign .personnel .Person ;
35
- import mekhq .gui .baseComponents .AbstractMHQNagDialog ;
36
-
37
- import static mekhq .gui .dialog .nagDialogs .nagLogic .NoCommanderNagLogic .hasNoCommander ;
38
+ import mekhq .gui .baseComponents .immersiveDialogs .ImmersiveDialogNag ;
38
39
39
40
/**
40
- * A dialog used to notify the user that their campaign lacks a designated commander .
41
+ * A dialog class used to notify players that a commander is missing in their campaign .
41
42
*
42
- * <p>
43
- * This nag dialog is displayed when the campaign does not currently have a commander,
44
- * and checks whether the user has opted to ignore such notifications in the future.
45
- * If shown, the user has the option to dismiss the dialog or address the issue.
46
- * </p>
47
- *
48
- * <strong>Features:</strong>
49
- * <ul>
50
- * <li>Handles the "No Commander" notification for campaigns.</li>
51
- * <li>Localized message fetched using resource bundles.</li>
52
- * <li>Extends the {@link AbstractMHQNagDialog} for reusable dialog behavior.</li>
53
- * </ul>
54
- *
55
- * @see AbstractMHQNagDialog
43
+ * <p>The {@code NoCommanderNagDialog} extends {@link ImmersiveDialogNag} and provides a specialized dialog
44
+ * designed to alert players when no commander is assigned or present in the campaign. It uses predefined values,
45
+ * including the {@code HR} speaker and the {@code NAG_NO_COMMANDER} constant, to configure dialog settings and
46
+ * content.</p>
56
47
*/
57
- public class NoCommanderNagDialog extends AbstractMHQNagDialog {
48
+ public class NoCommanderNagDialog extends ImmersiveDialogNag {
58
49
/**
59
- * Constructs a {@code NoCommanderNagDialog} for a campaign .
50
+ * Constructs a new {@code NoCommanderNagDialog} instance to display the no commander nag dialog .
60
51
*
61
- * <p>
62
- * This dialog uses the localization key {@code "NoCommanderNagDialog.text"}
63
- * to display a message informing the user about the absence of a commander in their campaign.
64
- * </p>
52
+ * <p>This constructor initializes the dialog with preconfigured parameters, such as the
53
+ * {@code NAG_NO_COMMANDER} constant for managing dialog suppression, the {@code "NoCommanderNagDialog"} message key
54
+ * for localization, and the {@code HR} speaker to deliver the dialog message.</p>
65
55
*
66
- * @param campaign The {@link Campaign} for which the nag dialog is being triggered.
56
+ * @param campaign The {@link Campaign} instance associated with this dialog. Provides access to campaign data and
57
+ * settings required for constructing the dialog.
67
58
*/
68
59
public NoCommanderNagDialog (final Campaign campaign ) {
69
- super (campaign , MHQConstants .NAG_NO_COMMANDER );
70
-
71
- final String DIALOG_BODY = "NoCommanderNagDialog.text" ;
72
- setRightDescriptionMessage (resources .getString (DIALOG_BODY ));
73
- showDialog ();
60
+ super (campaign , HR , NAG_NO_COMMANDER , "NoCommanderNagDialog" );
74
61
}
75
62
76
63
/**
@@ -82,15 +69,15 @@ public NoCommanderNagDialog(final Campaign campaign) {
82
69
* <li>No flagged commander is assigned to the campaign.</li>
83
70
* </ul>
84
71
*
85
- * @param flaggedCommander The {@link Person} designated as the flagged commander, or {@code null}
86
- * if no commander is assigned.
87
- * @return {@code true} if the nag dialog should be displayed due to the absence of a commander,
88
- * {@code false} otherwise.
72
+ * @param flaggedCommander The {@link Person} designated as the flagged commander, or {@code null} if no commander
73
+ * is assigned.
74
+ *
75
+ * @return {@code true} if the nag dialog should be displayed due to the absence of a commander, {@code false}
76
+ * otherwise.
89
77
*/
90
78
public static boolean checkNag (@ Nullable Person flaggedCommander ) {
91
- final String NAG_KEY = MHQConstants . NAG_NO_COMMANDER ;
79
+ final String NAG_KEY = NAG_NO_COMMANDER ;
92
80
93
- return !MekHQ .getMHQOptions ().getNagDialogIgnore (NAG_KEY )
94
- && hasNoCommander (flaggedCommander );
81
+ return !MekHQ .getMHQOptions ().getNagDialogIgnore (NAG_KEY ) && hasNoCommander (flaggedCommander );
95
82
}
96
83
}
0 commit comments