Package megamek.client.ui.clientGUI
Class ClientGUI
java.lang.Object
megamek.client.ui.clientGUI.AbstractClientGUI
megamek.client.ui.clientGUI.ClientGUI
- All Implemented Interfaces:
ActionListener,EventListener,BoardViewListener,MekDisplayListener,IClientGUI,IDisconnectSilently,IHasBoardView,IHasCurrentPanel,IHasMenuBar,ILocalBots,IHasUnitDisplay,IClientCommandHandler,IPreferenceChangeListener
public class ClientGUI
extends AbstractClientGUI
implements BoardViewListener, ActionListener, IPreferenceChangeListener, MekDisplayListener, ILocalBots, IDisconnectSilently, IHasUnitDisplay, IHasBoardView, IHasMenuBar, IHasCurrentPanel
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intBot commands panel location: docked into the top of the board area.static final intBot commands panel location: shown in a floating dialog.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected JComponentstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected CommonMenuBarstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class megamek.client.ui.clientGUI.AbstractClientGUI
boardViews, boardViewsContainer, clientCommands, CP, FILENAME_ICON_16X16, FILENAME_ICON_256X256, FILENAME_ICON_32X32, FILENAME_ICON_48X48, frame, GUIP, MAX_GUI_SCALE, MIN_GUI_SCALE, miniMaps, spriteHandlers -
Constructor Summary
ConstructorsConstructorDescriptionClientGUI(Client client, MegaMekController c) Construct a client which will display itself in a new frame. -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) Implement theActionListenerinterface.voidvoidaddToast(ToastLevel level, String text) Shows a toast notification on the board view.voidaddToast(ToastLevel level, String text, Entity entity) Shows a toast notification with the given entity's sprite icon on the board view.voidbingChat()Make a "bing" sound.voidvoidvoidSent when Hex is highlighted.voidboardSaveAs(Game game) Opens a file dialog box to select a file to save as; saves the board to the file.voidcenterOnHex(BoardLocation boardLocation) Shows the BoardView of the given location, if it exists, and centers on its coords.voidcenterOnUnit(Targetable targetable) Shows the BoardView of the given targetable, if it exists, and centers on its position, if that exists.voidvoidRemoves the field of fire from the BoardView and clears the cached values in the sprite handler.voidRemoves visibility to the Movement Envelope.voidRemoves all temporary sprites from the board, such as pending actions, movement envelope, collapse warnings etc.voidvoiddie()Performs shut down for threads and sockets and other things that can be disposed.voiddoAlertDialog(String title, String message) Pops up a dialog box showing an alertvoiddoAlertDialog(String title, String message, int messageType) Brings up a dialog that displays a message using a default icon determined by themessageTypeparameter.int[]doChoiceDialog(String title, String question, String... choices) Pops up a dialog box giving the player a series of choices that are not mutually exclusive.doInformBotherDialog(String title, String message, boolean includeCheckBox) Pops up a dialog box giving the player information on a subject.voidSave all the current in use Entities each grouped by player namedoWarnNoBotherDialog(String title, String question) Deprecated, for removal: This API element is subject to removal in a future version.doYesNoBotherDialog(String title, String question) Pops up a dialog box asking a yes/no questionbooleandoYesNoDialog(String title, String question) Pops up a dialog box asking a yes/no questionvoidSent when moving units is finished.voidSent when firstLOS is set.getBoardView(int boardId) getBoardView(BoardLocation boardLocation) getBoardView(Targetable entity) Return the Current Hex, used by client commands for the visually impairedThe ClientGUI is split into the main panel (view) at the top, which takes up the majority of the view and the "current panel" which has different controls based on the phase.Returns the weapon that is currently selected in the Unit Display.getGenerationContext(int playerId) Get the menu bar for this client.intDeprecated, for removal: This API element is subject to removal in a future version.voidSent when BoardView 'cursor' is set to Hex.voidhexMoused(BoardViewEvent event) Sent when user clicks, double clicks or drags hex.voidSent when Hex is selected through a call to the select method (this is not a mouse click event, although many mouse clicks lead to the hex being selected).voidvoidRegisters this ClientGUI as a listener wherever it's needed.protected voidInitializes a number of things about this frame.booleanbooleanReturns true when the currently shownBoardViewis showing some animation and should not be centered on another hex or be hidden right now.booleanprotected voidAllow the player to select a MegaMek Unit List file to load.voidloadListFile(Player player) Allow the player to select a MegaMek Unit List file to load.protected voidloadListFile(Player player, boolean reinforce) Allow the player to select a MegaMek Unit List file to load.protected voidloadListFile(Player player, boolean reinforce, boolean requireATeam) Loads a unit file onto a player.voidloadPreviewImage(JLabel bp, Entity entity) Loads a preview image of the unit into the BufferedPanel.voidShows or hides the Unit Display based on the current menu setting.voidShows or hides the Unit Display based on the current menu setting.voidvoidonAllBoardViews(Consumer<BoardView> consumer) voidvoidRequest MegaMekLab to print out record sheets for the current player's selected units.voidreinforceFromFile(Player player) Loads a unit file onto a player as reinforcements, arriving next round.voidvoidvoidbooleansaveGame()voidsaveListFile(ArrayList<Entity> unitList, String filename) Allow the player to save a list of entities to a MegaMek Unit List file.protected voidvoidSent when secondLOS is set.voidsetBotCommandsDialog(BotCommandsDialog botCommandsDialog) voidsetChatBoxActive(boolean active) voidsetCurrentHex(Coords hex) voidsetCurrentHex(Hex hex) Set the Current Hex, used by client commands for the visually impairedvoidsetDisconnectQuietly(boolean quietly) Set to true to make the client disconnect without a warning popup.voidsetForceDisplayDialog(ForceDisplayDialog forceDisplayDialog) voidsetForceDisplayPanel(ForceDisplayPanel forceDisplayPanel) voidsetForceDisplayVisible(boolean visible) voidsetGenerationContext(int playerId, GenerationContext context) Records what a player's newly generated units were rolled for, replacing any earlier record.voidsetMiniReportDisplay(MiniReportDisplayPanel miniReportDisplayPanel) voidsetMiniReportDisplayDialog(MiniReportDisplayDialog miniReportDisplayDialog) voidsetMiniReportLocation(boolean visible) voidsetPlayerListDialog(PlayerListDialog playerListDialog) voidsetPointblankEID(int eid) voidsetRoundsInAirDialog(RoundsInAirDialog roundsInAirDialog) voidsetSelectedEntityNum(int selectedEntityNum) voidsetUnitDisplayDialog(UnitDisplayDialog unitDisplayDialog) voidsetUnitDisplayLocation(boolean visible) voidsetUnitDisplayVisible(boolean visible) Shows or hides the Unit Display based on the given visible.booleanReturns true if a dialog is visible on top of the ClientGUI.protected voidshowBoardPopup(BoardViewEvent event) voidshowCollapseWarning(Collection<BoardLocation> warnList) Shows collapse warnings in the given list of Coords in the BoardViewvoidshowFiringSolutions(Entity entity) Shows firing solutions from the viewpoint of the given entity on targetsvoidshowGroundObjects(Map<Coords, List<ICarryable>> groundObjectList) Shows ground object icons in the given list of Coords in the BoardViewvoidshowMovementEnvelope(Entity entity, Map<Coords, Integer> mvEnvData, int gear) Shows the movement envelope in the BoardView for the given entity.voidshowMovementModifiers(Collection<MovePath> movePaths) Shows the optimal available movement modifiers in the BoardView.voidCalled when the user selects the "View->Player List" menu item.voidshowSawClearingHexes(Map<BoardLocation, Integer> cutHexes) Deprecated, for removal: This API element is subject to removal in a future version.voidshowSensorRanges(Entity entity) Shows the sensor/visual ranges for the given entity on its own position in the BoardViewvoidshowSensorRanges(Entity entity, Coords assumedPosition) Shows the sensor/visual ranges for the given entity in the BoardView.voidvoidswitchPanel(GamePhase phase) voidsystemMessage(String message) Display a system message in the chat box.voidSwitches the Minimap and the UnitDisplay an and off together.voidSent when Unit is selected.voidupdateButtonPanel(GamePhase phase) voidupdateFiringArc(Entity entity) Updates the shown firing arc.voidSent when user selects a weapon in the weapon panel.Methods inherited from class megamek.client.ui.clientGUI.AbstractClientGUI
boardViews, getAllCommandNames, getCommand, getCurrentBoardView, getFrame, handleExit, registerCommand, runCommand, runCommand, showBoardView, showScriptedMessage
-
Field Details
-
MAIN_SKIN_NEW
- See Also:
-
MAIN_QUIT
- See Also:
-
FILE_GAME_NEW
- See Also:
-
FILE_GAME_SAVE
- See Also:
-
FILE_GAME_LOAD
- See Also:
-
FILE_GAME_SAVE_SERVER
- See Also:
-
FILE_GAME_QUICK_SAVE
- See Also:
-
FILE_GAME_QUICK_LOAD
- See Also:
-
FILE_GAME_SCENARIO
- See Also:
-
FILE_GAME_CONNECT_BOT
- See Also:
-
FILE_GAME_CONNECT
- See Also:
-
FILE_GAME_CONNECT_SBF
- See Also:
-
FILE_GAME_EDIT_BOTS
- See Also:
-
BOARD_NEW
- See Also:
-
BOARD_OPEN
- See Also:
-
BOARD_RECENT
- See Also:
-
BOARD_SAVE
- See Also:
-
BOARD_SAVE_AS
- See Also:
-
BOARD_SAVE_AS_IMAGE
- See Also:
-
BOARD_SAVE_AS_IMAGE_UNITS
- See Also:
-
BOARD_RUN_BOARD_TAGGER
- See Also:
-
BOARD_RESIZE
- See Also:
-
BOARD_VALIDATE
- See Also:
-
BOARD_SOURCE_FILE
- See Also:
-
BOARD_UNDO
- See Also:
-
BOARD_REDO
- See Also:
-
BOARD_RAISE
- See Also:
-
BOARD_CLEAR
- See Also:
-
BOARD_FLOOD
- See Also:
-
BOARD_REMOVE_FORESTS
- See Also:
-
BOARD_REMOVE_ROADS
- See Also:
-
BOARD_REMOVE_WATER
- See Also:
-
BOARD_REMOVE_BUILDINGS
- See Also:
-
BOARD_FLATTEN
- See Also:
-
FILE_UNITS_REINFORCE
- See Also:
-
FILE_UNITS_REINFORCE_RAT
- See Also:
-
FILE_REFRESH_CACHE
- See Also:
-
FILE_REBUILD_CACHE
- See Also:
-
FILE_UNITS_BROWSE
- See Also:
-
FILE_UNITS_OPEN
- See Also:
-
FILE_UNITS_SAVE
- See Also:
-
FILE_UNITS_PASTE
- See Also:
-
FILE_UNITS_COPY
- See Also:
-
VIEW_INC_GUI_SCALE
- See Also:
-
VIEW_DEC_GUI_SCALE
- See Also:
-
VIEW_FORCE_DISPLAY
- See Also:
-
VIEW_NOVA_NETWORKS
- See Also:
-
VIEW_UNIT_DISPLAY
- See Also:
-
VIEW_ACCESSIBILITY_WINDOW
- See Also:
-
VIEW_KEYBINDS_OVERLAY
- See Also:
-
VIEW_PLANETARY_CONDITIONS_OVERLAY
- See Also:
-
VIEW_TRACE_OVERLAY
- See Also:
-
VIEW_MINI_MAP
- See Also:
-
VIEW_UNIT_OVERVIEW
- See Also:
-
VIEW_ZOOM_IN
- See Also:
-
VIEW_ZOOM_OUT
- See Also:
-
VIEW_ZOOM_RESET
- See Also:
-
VIEW_ZOOM_OVERVIEW_TOGGLE
- See Also:
-
VIEW_TOGGLE_ISOMETRIC
- See Also:
-
VIEW_TOGGLE_HEX_COORDS
- See Also:
-
VIEW_LABELS
- See Also:
-
VIEW_TOGGLE_FIELD_OF_FIRE
- See Also:
-
VIEW_TOGGLE_FLEE_ZONE
- See Also:
-
VIEW_TOGGLE_SENSOR_RANGE
- See Also:
-
VIEW_TOGGLE_FOV_DARKEN
- See Also:
-
VIEW_TOGGLE_FOV_HIGHLIGHT
- See Also:
-
VIEW_TOGGLE_FOV_SPOTTING
- See Also:
-
VIEW_TOGGLE_SHOW_OBJECTS
- See Also:
-
VIEW_TOGGLE_FIRING_SOLUTIONS
- See Also:
-
VIEW_TOGGLE_CF_WARNING
- See Also:
-
VIEW_MOVE_ENV
- See Also:
-
VIEW_TURN_DETAILS_OVERLAY
- See Also:
-
VIEW_MOVE_MOD_ENV
- See Also:
-
VIEW_CHANGE_THEME
- See Also:
-
VIEW_ROUND_REPORT
- See Also:
-
VIEW_GAME_OPTIONS
- See Also:
-
GAME_GIVE_UP_GAME_MASTER
- See Also:
-
GAME_REQUEST_GAME_MASTER
- See Also:
-
GAME_ALL_MG_BURST_ON
- See Also:
-
GAME_ALL_MG_BURST_OFF
- See Also:
-
GAME_ALL_HOT_LOAD_ON
- See Also:
-
GAME_ALL_HOT_LOAD_OFF
- See Also:
-
VIEW_NETWORK_INFORMATION
- See Also:
-
VIEW_CLIENT_SETTINGS
- See Also:
-
VIEW_LOS_SETTING
- See Also:
-
VIEW_PLAYER_SETTINGS
- See Also:
-
VIEW_PLAYER_LIST
- See Also:
-
VIEW_ROUNDS_IN_AIR
- See Also:
-
VIEW_RESET_WINDOW_POSITIONS
- See Also:
-
VIEW_BOT_COMMANDS
- See Also:
-
VIEW_BOT_COMMANDS_OFF
- See Also:
-
VIEW_BOT_COMMANDS_FLOAT
- See Also:
-
VIEW_BOT_COMMANDS_DOCK
- See Also:
-
BOT_COMMANDS_LOCATION_FLOATING
public static final int BOT_COMMANDS_LOCATION_FLOATINGBot commands panel location: shown in a floating dialog.- See Also:
-
BOT_COMMANDS_LOCATION_DOCKED
public static final int BOT_COMMANDS_LOCATION_DOCKEDBot commands panel location: docked into the top of the board area.- See Also:
-
FIRE_SAVE_WEAPON_ORDER
- See Also:
-
HELP_CONTENTS
- See Also:
-
HELP_SKINNING
- See Also:
-
HELP_ABOUT
- See Also:
-
HELP_RESET_NAGS
- See Also:
-
CG_BOARD_VIEW
- See Also:
-
CG_CHAT_LOUNGE
- See Also:
-
CG_STARTING_SCENARIO
- See Also:
-
CG_EXCHANGE
- See Also:
-
CG_SELECT_ARTY_AUTO_HIT_HEX_DISPLAY
- See Also:
-
CG_VICTORY_SETUP_DISPLAY
- See Also:
-
CG_DEPLOY_MINEFIELD_DISPLAY
- See Also:
-
CG_DEPLOYMENT_DISPLAY
- See Also:
-
CG_TARGETING_PHASE_DISPLAY
- See Also:
-
CG_PREMOVEMENT_DISPLAY
- See Also:
-
CG_MOVEMENT_DISPLAY
- See Also:
-
CG_OFFBOARD_DISPLAY
- See Also:
-
CG_PRE_FIRING
- See Also:
-
CG_FIRING_DISPLAY
- See Also:
-
CG_POINTBLANK_SHOT_DISPLAY
- See Also:
-
CG_PHYSICAL_DISPLAY
- See Also:
-
CG_PREEND_DECLARATIONS_DISPLAY
- See Also:
-
CG_INFANTRY_COMBAT_DISPLAY
- See Also:
-
CG_REPORT_DISPLAY
- See Also:
-
CG_DEFAULT
- See Also:
-
CG_CHAT_COMMAND_SAVE
- See Also:
-
CG_CHAT_COMMAND_LOCAL_SAVE
- See Also:
-
CG_FILE_URL_START
- See Also:
-
CG_FILEPATH_USER_DIR
- See Also:
-
CG_FILEPATH_BOARDS
- See Also:
-
CG_FILEPATH_DATA
- See Also:
-
CG_FILENAME_SALVAGE
- See Also:
-
CG_FILEPATH_MUL
- See Also:
-
CG_FILE_EXTENSION_BOARD
- See Also:
-
CG_FILE_EXTENSION_MUL
- See Also:
-
CG_FILE_EXTENSION_XML
- See Also:
-
CG_FILE_EXTENSION_PNG
- See Also:
-
CG_FILE_FORMAT_NAME_PNG
- See Also:
-
controller
-
forceDisplayPanel
-
curPanel
-
chatlounge
-
-
Constructor Details
-
ClientGUI
Construct a client which will display itself in a new frame. It will not try to connect to a server yet. When the frame closes, this client will clean up after itself as much as possible, but will not call System.exit().
-
-
Method Details
-
getBoardView
- Specified by:
getBoardViewin interfaceIHasBoardView
-
getToastOverlay
Deprecated, for removal: This API element is subject to removal in a future version. -
addToast
Shows a toast notification on the board view. Safe to call even when the toast overlay has not been initialized yet (e.g., during the lobby phase).- Parameters:
level- the severity level determining color and default durationtext- the message text to display
-
addToast
Shows a toast notification with the given entity's sprite icon on the board view.This is the single entry point for every toast in the client, server-raised ones included, so the player's
GUIPreferences.TOAST_ENABLEDsetting is enforced here and nowhere else.- Parameters:
level- the severity level determining color and default durationtext- the message text to displayentity- the entity whose icon to show, ornullfor text-only
-
getUnitDisplay
- Specified by:
getUnitDisplayin interfaceIHasUnitDisplay
-
getUnitDisplayDialog
-
setUnitDisplayDialog
-
getForceDisplayPanel
-
setForceDisplayPanel
-
getForceDisplayDialog
-
setForceDisplayDialog
-
getMiniMapDialog
-
getBotCommandsDialog
-
setBotCommandsDialog
-
getBotCommandsPanel
-
getMiniReportDisplay
-
setMiniReportDisplay
-
getMiniReportDisplayDialog
-
setMiniReportDisplayDialog
-
getPlayerListDialog
-
setPlayerListDialog
-
getRoundsInAirDialog
-
setRoundsInAirDialog
-
setDisconnectQuietly
public void setDisconnectQuietly(boolean quietly) Description copied from interface:IDisconnectSilentlySet to true to make the client disconnect without a warning popup.- Specified by:
setDisconnectQuietlyin interfaceIDisconnectSilently- Parameters:
quietly- When true, the client will disconnect without visible warning
-
systemMessage
Display a system message in the chat box.- Parameters:
message- theStringmessage to be shown.
-
initializeFrame
protected void initializeFrame()Initializes a number of things about this frame.- Overrides:
initializeFramein classAbstractClientGUI
-
initialize
public void initialize()Description copied from interface:IClientGUIRegisters this ClientGUI as a listener wherever it's needed. It is generally considered bad practice to do this in the constructor.- Specified by:
initializein interfaceIClientGUI- Overrides:
initializein classAbstractClientGUI
-
getMenuBar
Description copied from interface:IHasMenuBarGet the menu bar for this client.- Specified by:
getMenuBarin interfaceIHasMenuBar- Returns:
- the
CommonMenuBarof this client.
-
customizePlayer
public void customizePlayer() -
showPlayerList
public void showPlayerList()Called when the user selects the "View->Player List" menu item. -
miniReportDisplayAddReportPages
public void miniReportDisplayAddReportPages() -
reportDisplayResetDone
public void reportDisplayResetDone() -
reportDisplayResetRerollInitiative
public void reportDisplayResetRerollInitiative() -
resetWindowPositions
public void resetWindowPositions() -
actionPerformed
Implement theActionListenerinterface.- Specified by:
actionPerformedin interfaceActionListener
-
doSaveUnit
public void doSaveUnit()Save all the current in use Entities each grouped by player nameand a file for salvage
-
die
public void die()Description copied from interface:IClientGUIPerforms shut down for threads and sockets and other things that can be disposed.- Specified by:
diein interfaceIClientGUI- Overrides:
diein classAbstractClientGUI
-
getGameOptionsDialog
-
getNetworkInformationDialog
-
getMekSelectorDialog
-
switchPanel
-
updateButtonPanel
-
showBoardPopup
-
toggleMMUDDisplays
public void toggleMMUDDisplays()Switches the Minimap and the UnitDisplay an and off together. If the UnitDisplay is active, both will be hidden, else both will be shown. -
maybeShowUnitDisplay
public void maybeShowUnitDisplay()Shows or hides the Unit Display based on the current menu setting. -
maybeShowForceDisplay
public void maybeShowForceDisplay()Shows or hides the Unit Display based on the current menu setting. -
setUnitDisplayVisible
public void setUnitDisplayVisible(boolean visible) Shows or hides the Unit Display based on the given visible. This works independently of the current menu setting, so it should be used only when the Unit Display is to be shown or hidden without regard for the user setting, e.g. hiding it in the lobby or a report phase. Does not change the menu setting. -
setForceDisplayVisible
public void setForceDisplayVisible(boolean visible) -
setUnitDisplayLocation
public void setUnitDisplayLocation(boolean visible) -
setMiniReportLocation
public void setMiniReportLocation(boolean visible) -
doChoiceDialog
Pops up a dialog box giving the player a series of choices that are not mutually exclusive.- Parameters:
title- theStringtitle of the dialog box.question- theStringquestion that has a "Yes" or "No" answer. The question will be split across multiple line on the '\n' characters.choices- the array ofStringchoices that the player can select from.- Returns:
- The array of the
intindexes from the input array that match the selected choices. If no choices were available, if the player did not select a choice, or if the player canceled the choice, anullvalue is returned.
-
doAlertDialog
Pops up a dialog box showing an alert -
doAlertDialog
Brings up a dialog that displays a message using a default icon determined by themessageTypeparameter.- Parameters:
title- the title string for the dialogmessage- theObjectto displaymessageType- the type of message to be displayed:ERROR_MESSAGE,INFORMATION_MESSAGE,WARNING_MESSAGE,QUESTION_MESSAGE, orPLAIN_MESSAGE- Throws:
HeadlessException- ifGraphicsEnvironment.isHeadlessreturnstrue- See Also:
-
doInformBotherDialog
Pops up a dialog box giving the player information on a subject. It also includes a checkbox if they don't want to be bothered again by it.- Parameters:
title- theStringtitle of the dialog box.message- theStringmessage to display.includeCheckBox- iftrue, a checkbox will be included in the dialog box- Returns:
InformDialogcontaining the player's responses. The dialog will already have been shown
-
doYesNoDialog
Pops up a dialog box asking a yes/no question- Parameters:
title- theStringtitle of the dialog box.question- theStringquestion that has a "Yes" or "No" answer. The question will be split across multiple line on the '\n' characters.- Returns:
trueif yes
-
doYesNoBotherDialog
Pops up a dialog box asking a yes/no questionThe player will be given a chance to not show the dialog again.
- Parameters:
title- theStringtitle of the dialog box.question- theStringquestion that has a "Yes" or "No" answer. The question will be split across multiple lines on the '\n' characters.- Returns:
- the
ConfirmDialogcontaining the player's responses. The dialog will already have been shown to the player, and is only being returned so the calling function can see the answer to the question and the state of the "Show again?" question.
-
doWarnNoBotherDialog
@Deprecated(since="0.51.0", forRemoval=true) public ConfirmDialog doWarnNoBotherDialog(String title, String question) Deprecated, for removal: This API element is subject to removal in a future version.Pops up a dialog box asking a yes/no questionThe player will be given a chance to not show the dialog again.
- Parameters:
title- theStringtitle of the dialog box.question- theStringquestion that has a "Yes" or "No" answer. The question will be split across multiple line on the '\n' characters.c tr23ty- Returns:
- the
ConfirmDialogcontaining the player's responses. The dialog will already have been shown to the player, and is only being returned so the calling function can see the answer to the question and the state of the "Show again?" question.
-
loadListFile
protected void loadListFile()Allow the player to select a MegaMek Unit List file to load. TheEntitys in the file will replace any that the player has already selected. As such, this method should only be called in the chat lounge. The file can record damage sustained, non-standard munitions selected, and ammunition expended in a prior engagement. -
loadListFile
Allow the player to select a MegaMek Unit List file to load. TheEntitys in the file will replace any that the player has already selected. As such, this method should only be called in the chat lounge. The file can record damage sustained, non-standard munitions selected, and ammunition expended in a prior engagement.- Parameters:
player- The player to add the units to
-
reinforceFromFile
Loads a unit file onto a player as reinforcements, arriving next round.Public so that a gamemaster tool which already knows which player it is setting up can send units to them without asking again in a second dialog.
- Parameters:
player- The player the units are for
-
loadListFile
Allow the player to select a MegaMek Unit List file to load. TheEntitys in the file will replace any that the player has already selected. As such, this method should only be called in the chat lounge. The file can record damage sustained, non-standard munitions selected, and ammunition expended in a prior engagement.- Parameters:
player- The player to add the units to
-
loadListFile
Loads a unit file onto a player.- Parameters:
player- The player to add the units toreinforce- Whether the units arrive as reinforcements during a gamerequireATeam- Whether to refuse a player who is on no team. A gamemaster tool that has just assigned one passesfalse, because the change does not reach the board until the end of the round and the player has no team yet at the moment this is called
-
saveGame
public boolean saveGame()- Specified by:
saveGamein classAbstractClientGUI
-
saveListFile
Allow the player to save a list of entities to a MegaMek Unit List file. A "Save As" dialog will be displayed that allows the user to select the file's name and directory. The player can later load this file to quickly select the units for a new game. The file will record damage sustained, non-standard munitions selected, and ammunition expended during the course of the current engagement.- Parameters:
unitList- - theVectorofEntitys to be saved to a file. If this value isnullor empty, the "Save As" dialog will not be displayed.filename- The filename to save to
-
printList
Request MegaMekLab to print out record sheets for the current player's selected units. The method will try to find MML either automatically or based on a configured client setting.- Parameters:
unitList- The list of units to printbutton- This should always be ChatLounge#butPrintList, if you need to trigger this method from somewhere else, override it.
-
saveVictoryList
protected void saveVictoryList() -
loadPreviewImage
Loads a preview image of the unit into the BufferedPanel.- Parameters:
bp- The JLabel to set the image as icon toentity- The unit
-
bingChat
public void bingChat()Make a "bing" sound. -
bingMyTurn
public void bingMyTurn() -
bingOthersTurn
public void bingOthersTurn() -
getClient
- Specified by:
getClientin interfaceIClientGUI
-
turnTimerComponent
- Specified by:
turnTimerComponentin interfaceIClientGUI
-
setChatBoxActive
public void setChatBoxActive(boolean active) - Specified by:
setChatBoxActivein interfaceIClientGUI
-
clearChatBox
public void clearChatBox()- Specified by:
clearChatBoxin interfaceIClientGUI
-
isChatBoxActive
public boolean isChatBoxActive()- Specified by:
isChatBoxActivein interfaceIClientGUI
-
getLocalBots
- Specified by:
getLocalBotsin interfaceILocalBots
-
setGenerationContext
Records what a player's newly generated units were rolled for, replacing any earlier record. Callers record only what a generator actually asked the player, never a default, so that a later roll on a generator that knows nothing cannot erase a real choice.- Parameters:
playerId- the owner of the generated unitscontext- what they were generated for
-
getGenerationContext
- Parameters:
playerId- the player to look up- Returns:
- what that player's units were generated for, or
nullwhen nothing has been recorded for them - they have generated nothing, or only from a generator that asks for no faction, command or rating
-
setSelectedEntityNum
public void setSelectedEntityNum(int selectedEntityNum) - Parameters:
selectedEntityNum- The selectedEntityNum to set.
-
getRandomArmyDialog
-
getRandomNameDialog
-
boardSaveAs
Opens a file dialog box to select a file to save as; saves the board to the file. -
hexMoused
Description copied from interface:BoardViewListenerSent when user clicks, double clicks or drags hex.- Specified by:
hexMousedin interfaceBoardViewListener- Parameters:
event- an event
-
hexCursor
Description copied from interface:BoardViewListenerSent when BoardView 'cursor' is set to Hex.- Specified by:
hexCursorin interfaceBoardViewListener- Parameters:
b- an event
-
boardHexHighlighted
Description copied from interface:BoardViewListenerSent when Hex is highlighted.- Specified by:
boardHexHighlightedin interfaceBoardViewListener- Parameters:
b- an event
-
hexSelected
Description copied from interface:BoardViewListenerSent when Hex is selected through a call to the select method (this is not a mouse click event, although many mouse clicks lead to the hex being selected).- Specified by:
hexSelectedin interfaceBoardViewListener- Parameters:
b- The select event- See Also:
-
firstLOSHex
Description copied from interface:BoardViewListenerSent when firstLOS is set.- Specified by:
firstLOSHexin interfaceBoardViewListener- Parameters:
b- an event
-
secondLOSHex
Description copied from interface:BoardViewListenerSent when secondLOS is set.- Specified by:
secondLOSHexin interfaceBoardViewListener- Parameters:
b- an event
-
finishedMovingUnits
Description copied from interface:BoardViewListenerSent when moving units is finished.- Specified by:
finishedMovingUnitsin interfaceBoardViewListener- Parameters:
b- an event
-
unitSelected
Description copied from interface:BoardViewListenerSent when Unit is selected.- Specified by:
unitSelectedin interfaceBoardViewListener- Parameters:
b- an event
-
shouldIgnoreHotKeys
public boolean shouldIgnoreHotKeys()Description copied from interface:IClientGUIReturns true if a dialog is visible on top of the ClientGUI. For example, the MegaMekController should ignore hotkeys if there is a dialog, like the CommonSettingsDialog, open.- Specified by:
shouldIgnoreHotKeysin interfaceIClientGUI- Overrides:
shouldIgnoreHotKeysin classAbstractClientGUI- Returns:
- True when hotkey events should not be forwarded to this ClientGUI
-
getCurrentPanel
Description copied from interface:IHasCurrentPanelThe ClientGUI is split into the main panel (view) at the top, which takes up the majority of the view and the "current panel" which has different controls based on the phase.- Specified by:
getCurrentPanelin interfaceIHasCurrentPanel- Returns:
- the panel for the current phase
-
isProcessingPointblankShot
public boolean isProcessingPointblankShot() -
setPointblankEID
public void setPointblankEID(int eid) -
getPointblankEID
public int getPointblankEID() -
preferenceChange
- Specified by:
preferenceChangein interfaceIPreferenceChangeListener
-
showMovementEnvelope
Shows the movement envelope in the BoardView for the given entity. The movement envelope data is a map of move end Coords to movement points used.- Parameters:
entity- The entity for which the movement envelope ismvEnvData- The movement envelope datagear- The move gear, MovementDisplay.GEAR_LAND or GEAR_JUMP
-
clearMovementEnvelope
public void clearMovementEnvelope()Removes visibility to the Movement Envelope. -
clearTemporarySprites
public void clearTemporarySprites()Removes all temporary sprites from the board, such as pending actions, movement envelope, collapse warnings etc. Does not remove game-state sprites such as units or flares. -
showMovementModifiers
Shows the optimal available movement modifiers in the BoardView.- Parameters:
movePaths- The available longest move paths.
-
showSensorRanges
Shows the sensor/visual ranges for the given entity on its own position in the BoardView- Parameters:
entity- The entity that is looking/sensing
-
showSensorRanges
Shows the sensor/visual ranges for the given entity in the BoardView. The ranges are centered on the given assumedPosition rather than the entity's own position.- Parameters:
entity- The entity that is looking/sensingassumedPosition- The position to center all ranges on
-
showCollapseWarning
Shows collapse warnings in the given list of Coords in the BoardView- Parameters:
warnList- The list of coordinates to show the warning on
-
showSawClearingHexes
@Deprecated(since="0.51.0", forRemoval=true) public void showSawClearingHexes(Map<BoardLocation, Integer> cutHexes) Deprecated, for removal: This API element is subject to removal in a future version.Shows saw clearing indicators on the given hexes in the BoardView.- Parameters:
cutHexes- a map of board locations to turns remaining for saw clearing
-
showGroundObjects
Shows ground object icons in the given list of Coords in the BoardView- Parameters:
groundObjectList- The list of coordinates to show
-
showFiringSolutions
Shows firing solutions from the viewpoint of the given entity on targets- Parameters:
entity- The attacking entity
-
getMainPanel
-
getDisplayedUnit
- Returns:
- The unit currently shown in the Unit Display. Note: This can be a unit than the one that is selected to move or fire.
-
getDisplayedWeapon
Returns the weapon that is currently selected in the Unit Display. The selection can be void for various reasons, therefore this returns it as an Optional. Note: this method does some additional checks to avoid bugs where the weapon of the same ID on the unit is different from the selected weapon or is not even present on the unit. Also, the displayed unit is checked to be an active unit (i.e. can be found in game.getEntity()). It will log an error and return null otherwise. Using the returned weapon should be fairly safe.- Returns:
- The weapon that is currently selected in the Unit Display, if any
-
getDisplayedAmmo
-
weaponSelected
Description copied from interface:MekDisplayListenerSent when user selects a weapon in the weapon panel.- Specified by:
weaponSelectedin interfaceMekDisplayListener- Parameters:
b- an event
-
updateFiringArc
Updates the shown firing arc. The given entity should be the one that has taken an action such as moving or torso twisting or the unit whose selected weapon has changed. This method will check if the given unit is the one displayed in the unit viewer and/or the currently acting unit and update or remove the firing arcs accordingly.- Parameters:
entity- The unit that has acted or is otherwise the origin of the update
-
clearFieldOfFire
public void clearFieldOfFire()Removes the field of fire from the BoardView and clears the cached values in the sprite handler. -
getCurrentHex
Return the Current Hex, used by client commands for the visually impaired- Returns:
- the current Hex
-
setCurrentHex
Set the Current Hex, used by client commands for the visually impaired -
setCurrentHex
-
hideFleeZone
public void hideFleeZone() -
isCurrentBoardViewShowingAnimation
public boolean isCurrentBoardViewShowingAnimation()Returns true when the currently shownBoardViewis showing some animation and should not be centered on another hex or be hidden right now. An example is showing a unit's move animation.- Returns:
- True when the currently shown BoardView is in the process of showing some animation
-
centerOnHex
Shows the BoardView of the given location, if it exists, and centers on its coords.- Parameters:
boardLocation- The location to show and center on
-
centerOnUnit
Shows the BoardView of the given targetable, if it exists, and centers on its position, if that exists.- Parameters:
targetable- The unit or target to show and center on
-
getBoardView
- Overrides:
getBoardViewin classAbstractClientGUI
-
getBoardView
- Overrides:
getBoardViewin classAbstractClientGUI
-
getBoardView
- Overrides:
getBoardViewin classAbstractClientGUI
-
onAllBoardViews
-
suspendBoardTooltips
public void suspendBoardTooltips() -
activateBoardTooltips
public void activateBoardTooltips() -
getTilesetManager
-