Class AttackPhaseDisplay
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
megamek.client.ui.widget.SkinnedJPanel
megamek.client.ui.panels.phaseDisplay.AbstractPhaseDisplay
megamek.client.ui.panels.phaseDisplay.StatusBarPhaseDisplay
megamek.client.ui.panels.phaseDisplay.ActionPhaseDisplay
megamek.client.ui.panels.phaseDisplay.AttackPhaseDisplay
- All Implemented Interfaces:
ActionListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,BoardViewListener,KeyBindReceiver,GameListener,IPreferenceChangeListener,Distractable
- Direct Known Subclasses:
FiringDisplay,InfantryVsInfantryCombatDisplay,PhysicalDisplay,PreEndDeclarationsDisplay,TargetingPhaseDisplay
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class megamek.client.ui.panels.phaseDisplay.StatusBarPhaseDisplay
StatusBarPhaseDisplay.CommandComparator, StatusBarPhaseDisplay.PhaseCommandNested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EntityActionLogprotected static final intPassed topendingDirectionalMountFacings(int)as the excluded location when the caller wants the pending mount facing actions of every location preserved.Fields inherited from class megamek.client.ui.panels.phaseDisplay.ActionPhaseDisplay
butSkipTurn, clientgui, currentEntity, gameFields inherited from class megamek.client.ui.panels.phaseDisplay.StatusBarPhaseDisplay
buttonsPerGroup, buttonsPerRow, clientGUI, currentButtonGroup, GUIP, MIN_BUTTON_SIZE, numButtonGroups, panButtons, panStatusFields inherited from class megamek.client.ui.panels.phaseDisplay.AbstractPhaseDisplay
butDone, DONE_BUTTON_WIDTHFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAttack(int index, EntityAction entityAction) add an attack at the given index to the local temporary attack listprotected voidaddAttack(EntityAction entityAction) add an attack to the end of the local temporary attack listprotected voidClears the pending attack queue and resets any declared facing.protected voiddeclareSecondaryFacing(int facing) Declares a change of the unit's secondary facing (a torso/turret twist) to the given facing, as if the player had used the Twist control.voidFlips the selected weapon's 2-point Directional Torso Mount between the front and rear arc (BMM p.83).protected abstract Stringcalled by updateDonePanel to populate the label text of the Done button.protected abstract Stringcalled by updateDonePanel to populate the label text of the NoAction button.protected List<DirectionalMountFacingAction> pendingDirectionalMountFacings(int excludedLocation) Collects the pending Directional Torso Mount facing actions (BMM p.83) so they can be re-added after aclearAttacks()that is only meant to rebuild the weapon attacks (a torso twist or another mount flip).protected voidRecomputes the to-hit / target information after a mount-facing change.protected voidremoves all elements from the local temporary attack listprotected voidvoidOpens the facing dialog for a dual-turret vehicle's rear (main) turret - the "Rotate Rr.voidOpens the facing dialog for the selected weapon's rotatable mount - a Mek shoulder/head/quad turret, a vehicle dual turret, or a Directional Torso Mount (issues #1040, #6518) - so turrets can be aimed with an action button, not only the right-click menu.protected voidsetFlipMountEnabled(boolean enabled) Enables or disables the Flip Mount button.protected voidsetRotateRearTurretEnabled(boolean enabled) Enables or disables the second Rotate Turret button (the rear turret of a dual-turret vehicle).protected voidsetRotateTurretEnabled(boolean enabled) Enables or disables the Rotate Turret button.protected voidsetRotateTurretLabel(boolean dualTurretTank) Relabels the Rotate Turret button for the selected unit: on a dual-turret vehicle it reads "Rotate Fr.protected voidcalled to reset, show, hide and relabel the Done panel buttons.protected voidEnables the flip-mount button only when the selected weapon is in a 2-point Directional Torso Mount whose arc can still be changed - i.e.protected voidEnables the rotate-turret buttons.Methods inherited from class megamek.client.ui.panels.phaseDisplay.ActionPhaseDisplay
checkNagForCrushingBuildings, checkNagForDishonor, checkNagForMASC, checkNagForMechanicalJumpFallDamage, checkNagForNoAction, checkNagForNoUnJamRAC, checkNagForOverheat, checkNagForPSR, checkNagForSprint, checkNagForWiGELanding, checkNagLaunchDoors, clearMarkedHexes, clearMovementSprites, currentEntity, getCurrentEntity, initDonePanelForNewTurn, needNagForCrushingBuildings, needNagForDishonor, needNagForLaunchDoors, needNagForMASC, needNagForMechanicalJumpFallDamage, needNagForNoAction, needNagForNoUnJamRAC, needNagForOther, needNagForOverheat, needNagForPSR, needNagForSprint, needNagForWiGELanding, performDoneNoAction, preferenceChange, removeAllListeners, setupDonePanel, shouldReceiveDoneKeyCommand, updateDonePanelButtonsMethods inherited from class megamek.client.ui.panels.phaseDisplay.StatusBarPhaseDisplay
addToDonePanel, clear, createButton, createToolTip, extendTimer, getButtonList, getRemainingPlayerWithTurns, isTimerExpired, playerNameOrUnknown, setButtons, setButtonsTooltips, setStatusBarText, setStatusBarWithNotDonePlayers, setupButtonPanel, setupStatusBar, shouldReceiveKeyCommands, startTimer, stopTimerMethods inherited from class megamek.client.ui.panels.phaseDisplay.AbstractPhaseDisplay
boardHexHighlighted, finishedMovingUnits, firstLOSHex, gameBoardChanged, gameBoardNew, gameClientFeedbackRequest, gameEnd, gameEntityChange, gameEntityNew, gameEntityNewOffboard, gameEntityRemove, gameMapQuery, gameNewAction, gamePhaseChange, gamePlayerChange, gamePlayerChat, gamePlayerConnected, gamePlayerDisconnected, gameReport, gameSettingsChange, gameTurnChange, gameVictory, getButDone, getClientGUI, hexCursor, hexMoused, hexSelected, isIgnoringEvents, isMyTurn, ready, secondLOSHex, sendDone, setIgnoringEvents, unitSelectedMethods inherited from class megamek.client.ui.widget.SkinnedJPanel
paintComponentMethods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.event.ActionListener
actionPerformedMethods inherited from interface megamek.common.event.GameListener
gamePlayerStrategicAction, gamePollChange, gameScriptedEvent, gameToast, gameUnitChange
-
Field Details
-
NO_EXCLUDED_LOCATION
protected static final int NO_EXCLUDED_LOCATIONPassed topendingDirectionalMountFacings(int)as the excluded location when the caller wants the pending mount facing actions of every location preserved.- See Also:
-
attacks
-
-
Constructor Details
-
AttackPhaseDisplay
-
-
Method Details
-
getDoneButtonLabel
called by updateDonePanel to populate the label text of the Done button. Usually wraps a call to Messages.getString(...Fire) but can be extended to add more details.- Returns:
- text for label
-
getSkipTurnButtonLabel
called by updateDonePanel to populate the label text of the NoAction button. Usually wraps a call to Messages.getString(...Skip) but can be extended to add more details.- Returns:
- text for label
-
updateDonePanel
protected void updateDonePanel()Description copied from class:ActionPhaseDisplaycalled to reset, show, hide and relabel the Done panel buttons. Override to change button labels and states, being sure to callActionPhaseDisplay.updateDonePanelButtons(String, String, boolean, List)to set the button labels and states- Specified by:
updateDonePanelin classActionPhaseDisplay
-
removeAttack
-
removeAllAttacks
protected void removeAllAttacks()removes all elements from the local temporary attack list -
addAttack
add an attack at the given index to the local temporary attack list -
addAttack
add an attack to the end of the local temporary attack list -
clearAttacks
protected void clearAttacks()Clears the pending attack queue and resets any declared facing. The default is a no-op; displays that hold a pending attack list override this soflipDirectionalMount()can rebuild the queue. -
refreshTargetAfterMountChange
protected void refreshTargetAfterMountChange()Recomputes the to-hit / target information after a mount-facing change. The default is a no-op; attack displays override this to refresh their target panel (they cannot share a singleupdateTarget()because its visibility differs across the display family). -
setFlipMountEnabled
protected void setFlipMountEnabled(boolean enabled) Enables or disables the Flip Mount button. The default is a no-op; displays that provide the button override this to toggle their own button and menu item.- Parameters:
enabled- whether the Flip Mount button should be enabled
-
setRotateTurretEnabled
protected void setRotateTurretEnabled(boolean enabled) Enables or disables the Rotate Turret button. The default is a no-op; displays that provide the button override this to toggle their own button and menu item.- Parameters:
enabled- whether the Rotate Turret button should be enabled
-
setRotateRearTurretEnabled
protected void setRotateRearTurretEnabled(boolean enabled) Enables or disables the second Rotate Turret button (the rear turret of a dual-turret vehicle). The default is a no-op; displays that provide the button override this to toggle their own button and menu item.- Parameters:
enabled- whether the rear-turret rotate button should be enabled
-
setRotateTurretLabel
protected void setRotateTurretLabel(boolean dualTurretTank) Relabels the Rotate Turret button for the selected unit: on a dual-turret vehicle it reads "Rotate Fr. Turret" (the second button covers the rear turret); on every other unit it reads the plain "Rotate Turret". The default is a no-op; displays that provide the button override this.- Parameters:
dualTurretTank-truewhen the selected unit is a dual-turret vehicle
-
flipDirectionalMount
public void flipDirectionalMount()Flips the selected weapon's 2-point Directional Torso Mount between the front and rear arc (BMM p.83). A Directional Torso Mount is a single mount holding every directional-mount weapon in one torso location, so the whole mount flips together. The facing is queued as aDirectionalMountFacingAction(applied by the server when the turn is committed) rather than sent immediately, so it composes with a torso twist or arms flip declared in the same turn and can still be cleared. -
pendingDirectionalMountFacings
Collects the pending Directional Torso Mount facing actions (BMM p.83) so they can be re-added after aclearAttacks()that is only meant to rebuild the weapon attacks (a torso twist or another mount flip). The mount arc is a persistent, separately-declared state, not a weapon attack, so it must survive the clear.- Parameters:
excludedLocation- a location to omit because the caller re-declares it itself, orNO_EXCLUDED_LOCATIONto keep all- Returns:
- the pending mount facing actions to preserve
-
updateFlipMount
protected void updateFlipMount()Enables the flip-mount button only when the selected weapon is in a 2-point Directional Torso Mount whose arc can still be changed - i.e. it is a directional mount, is not a 360-degree turret (which has no front/rear to flip), has not been locked by damage, and has not already changed facing in an earlier phase this turn (once per turn, like a torso twist). Logs the decision for any directional-mount unit to aid playtesting. -
rotateSelectedMount
public void rotateSelectedMount()Opens the facing dialog for the selected weapon's rotatable mount - a Mek shoulder/head/quad turret, a vehicle dual turret, or a Directional Torso Mount (issues #1040, #6518) - so turrets can be aimed with an action button, not only the right-click menu. -
rotateRearTurret
public void rotateRearTurret()Opens the facing dialog for a dual-turret vehicle's rear (main) turret - the "Rotate Rr. Turret" button. The rear turret follows the unit's secondary facing, so the rotation is declared as a turret twist. -
declareSecondaryFacing
protected void declareSecondaryFacing(int facing) Declares a change of the unit's secondary facing (a torso/turret twist) to the given facing, as if the player had used the Twist control. The default is a no-op; attack displays override this with their twist-declaration path (which clears pending attacks like any twist). Used byrotateSelectedMount()for vehicle main turrets, whose rotation is a turret twist.- Parameters:
facing- the absolute facing (0-5) to twist to
-
updateRotateTurret
protected void updateRotateTurret()Enables the rotate-turret buttons. Vehicle turrets rotate as a whole (independent of the selected weapon): a dual-turret vehicle gets both buttons - front turret on the first, rear turret on the second - while a single-turret vehicle gets only the first, for its main turret. On Meks the first button follows the selected weapon's rotatable mount (a Mek turret or a 360-degree Directional Torso Mount) as long as its facing can still be changed.
-