Class UnableToAffordExpensesNagDialog
The UnableToAffordExpensesNagDialog
extends ImmersiveDialogNag
and is specifically designed
to alert players about financial issues in the campaign. It utilizes predefined constants, including the
LOGISTICS
speaker and the NAG_UNABLE_TO_AFFORD_EXPENSES
identifier, to configure the dialog's
behavior and content.
-
Constructor Summary
ConstructorsConstructorDescriptionUnableToAffordExpensesNagDialog
(Campaign campaign) Constructs a newUnableToAffordExpensesNagDialog
to display a warning about unaffordable campaign expenses. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Checks if a nag dialog should be displayed for the inability to afford expenses in the given campaign.protected String
getInCharacterMessage
(Campaign campaign, String key, String commanderAddress) Retrieves an in-character message formatted with the provided commander address.Methods inherited from class mekhq.gui.baseComponents.immersiveDialogs.ImmersiveDialogNag
constructDialog, getOutOfCharacterMessage, getSpeaker, shouldCancelAdvanceDay
-
Constructor Details
-
UnableToAffordExpensesNagDialog
Constructs a newUnableToAffordExpensesNagDialog
to display a warning about unaffordable campaign expenses.This constructor initializes the dialog with preconfigured values, such as the
NAG_UNABLE_TO_AFFORD_EXPENSES
constant for managing dialog suppression, the"UnableToAffordExpensesNagDialog"
localization key for retrieving dialog content, and theLOGISTICS
speaker for delivering the message.- Parameters:
campaign
- TheCampaign
instance associated with this dialog. Provides access to campaign data required for constructing the nag dialog.
-
-
Method Details
-
getInCharacterMessage
Description copied from class:ImmersiveDialogNag
Retrieves an in-character message formatted with the provided commander address.This method fetches the text associated with an in-character message key from the resource bundle and formats it using the provided address of the commander.
- Overrides:
getInCharacterMessage
in classImmersiveDialogNag
- Parameters:
campaign
- The campaign context.key
- The reference bundle key.commanderAddress
- The address of the commander to be inserted into the formatted message.- Returns:
- A formatted in-character message as a
String
.
-
checkNag
Checks if a nag dialog should be displayed for the inability to afford expenses in the given campaign.The method evaluates the following conditions to determine if the nag dialog should appear:
- If it is the last day of the month in the campaign.
- If the nag dialog for the inability to afford expenses has not been ignored in the user options.
- If the campaign is unable to afford its expenses.
- Parameters:
campaign
- theCampaign
to check for nagging conditions- Returns:
true
if the nag dialog should be displayed,false
otherwise
-