Class FiringDisplay

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ListSelectionListener, BoardViewListener, KeyBindReceiver, GameListener, IPreferenceChangeListener, Distractable
Direct Known Subclasses:
PointblankShotDisplay

public class FiringDisplay extends AttackPhaseDisplay implements ListSelectionListener
See Also:
  • Field Details

    • showTargetChoice

      protected boolean showTargetChoice
    • twisting

      protected boolean twisting
    • visibleTargets

      protected Entity[] visibleTargets
    • lastTargetID

      protected int lastTargetID
    • ash

      protected AimedShotHandler ash
    • isStrafing

      protected boolean isStrafing
    • phaseInternalBombs

      protected int phaseInternalBombs
  • Constructor Details

    • FiringDisplay

      public FiringDisplay(ClientGUI clientgui)
      Creates and lays out a new firing phase display for the specified clientgui.getClient().
  • Method Details

    • getDoneButtonLabel

      protected String getDoneButtonLabel()
      Description copied from class: AttackPhaseDisplay
      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.
      Specified by:
      getDoneButtonLabel in class AttackPhaseDisplay
      Returns:
      text for label
    • getSkipTurnButtonLabel

      protected String getSkipTurnButtonLabel()
      Description copied from class: AttackPhaseDisplay
      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.
      Specified by:
      getSkipTurnButtonLabel in class AttackPhaseDisplay
      Returns:
      text for label
    • setButtons

      protected void setButtons()
      Description copied from class: StatusBarPhaseDisplay
      set button that should be displayed.
      Specified by:
      setButtons in class StatusBarPhaseDisplay
    • setButtonsTooltips

      protected void setButtonsTooltips()
      Description copied from class: StatusBarPhaseDisplay
      set button tool tips that should be displayed.
      Specified by:
      setButtonsTooltips in class StatusBarPhaseDisplay
    • twistLeft

      protected void twistLeft()
    • twistRight

      protected void twistRight()
    • shouldPerformClearKeyCommand

      protected boolean shouldPerformClearKeyCommand()
    • registerKeyCommands

      protected void registerKeyCommands()
      Register all of the CommandActions for this panel display.
    • getButtonList

      protected ArrayList<MegaMekButton> getButtonList()
      Description copied from class: StatusBarPhaseDisplay
      Returns the list of buttons that should be displayed.
      Specified by:
      getButtonList in class StatusBarPhaseDisplay
    • selectEntity

      public void selectEntity(int en)
      Selects an entity, by number, for firing.
    • beginMyTurn

      protected void beginMyTurn()
      Does turn start stuff
    • endMyTurn

      protected void endMyTurn()
      Does end turn stuff.
    • disableButtons

      protected void disableButtons()
      Disables all buttons in the interface
    • changeMode

      protected void changeMode(boolean forward)
      Fire Mode - Adds a Fire Mode Change to the current Attack Action
    • changeCalled

      protected void changeCalled()
      Called Shots - changes the current called shots selection
    • ready

      public void ready()
      Description copied from class: AbstractPhaseDisplay
      Tells the display to finish the current player turn and send all planned actions to the server. Planned actions are e.g. movement, attacks or deployment. Usually, the planned actions are all actions that, together, make up a single unit's turn, e.g. all weapon attacks of one unit.
      Specified by:
      ready in class AbstractPhaseDisplay
    • doSearchlight

      protected void doSearchlight()
      fire searchlight
    • fire

      public void fire()
      Adds a weapon attack with the currently selected weapon to the attack queue.
    • nextWeapon

      public void nextWeapon()
      Skips to the next weapon
    • doSpot

      protected void doSpot()
      The entity spends the rest of its turn spotting
    • clearAttacks

      protected void clearAttacks()
      Removes all current fire
    • removeTempAttacks

      protected void removeTempAttacks()
      Removes temp attacks from the game and board
    • removeLastFiring

      protected void removeLastFiring()
      removes the last action
    • refreshAll

      protected void refreshAll()
      Refreshes all displays.
    • updateForNewAction

      protected void updateForNewAction()
      Make any necessary updates in the GUI after a new action has been added.
    • target

      public void target(Targetable t)
      Targets something
    • updateTarget

      public void updateTarget()
      Targets something
    • torsoTwist

      public void torsoTwist(Coords twistTarget)
      Torso twist in the proper direction.
    • torsoTwist

      public void torsoTwist(int twistDir)
      Adds a torso twist (a.k.a. secondary facing change) to the pending actions. This first clears out any existing attacks!
      Parameters:
      twistDir - 0 for twisting to the left, 1 to the right
    • hexMoused

      public void hexMoused(BoardViewEvent event)
      Description copied from interface: BoardViewListener
      Sent when user clicks, double clicks or drags hex.
      Specified by:
      hexMoused in interface BoardViewListener
      Overrides:
      hexMoused in class AbstractPhaseDisplay
      Parameters:
      event - an event
    • hexSelected

      public void hexSelected(BoardViewEvent event)
      Description copied from interface: BoardViewListener
      Sent 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:
      hexSelected in interface BoardViewListener
      Overrides:
      hexSelected in class AbstractPhaseDisplay
      Parameters:
      event - The select event
      See Also:
    • gameTurnChange

      public void gameTurnChange(GameTurnChangeEvent e)
      Specified by:
      gameTurnChange in interface GameListener
      Overrides:
      gameTurnChange in class AbstractPhaseDisplay
    • gamePhaseChange

      public void gamePhaseChange(GamePhaseChangeEvent e)
      Specified by:
      gamePhaseChange in interface GameListener
      Overrides:
      gamePhaseChange in class AbstractPhaseDisplay
    • actionPerformed

      public void actionPerformed(ActionEvent ev)
      Specified by:
      actionPerformed in interface ActionListener
    • updateFlipArms

      public void updateFlipArms(boolean armsFlipped)
      update for change of arms-flipping status
      Parameters:
      armsFlipped -
    • updateSearchlight

      protected void updateSearchlight()
    • setFireEnabled

      protected void setFireEnabled(boolean enabled)
    • setTwistEnabled

      protected void setTwistEnabled(boolean enabled)
    • setSkipEnabled

      protected void setSkipEnabled(boolean enabled)
    • setFindClubEnabled

      protected void setFindClubEnabled(boolean enabled)
    • setNextTargetEnabled

      protected void setNextTargetEnabled(boolean enabled)
    • setFlipArmsEnabled

      protected void setFlipArmsEnabled(boolean enabled)
    • setSpotEnabled

      protected void setSpotEnabled(boolean enabled)
    • setSearchlightEnabled

      protected void setSearchlightEnabled(boolean enabled)
    • setFireModeEnabled

      protected void setFireModeEnabled(boolean enabled)
    • adaptFireModeEnabled

      protected void adaptFireModeEnabled(Mounted<?> m)
      Enables the mode button when mode switching is allowed (always true except for LAMs with certain weapons) and the weapon has modes. Disables otherwise.
      Parameters:
      m - The active weapon
    • setFireCalledEnabled

      protected void setFireCalledEnabled(boolean enabled)
    • setFireClearTurretEnabled

      protected void setFireClearTurretEnabled(boolean enabled)
    • setFireClearWeaponJamEnabled

      protected void setFireClearWeaponJamEnabled(boolean enabled)
    • setStrafeEnabled

      protected void setStrafeEnabled(boolean enabled)
    • setNextEnabled

      protected void setNextEnabled(boolean enabled)
    • setActivateSPAEnabled

      protected void setActivateSPAEnabled(boolean enabled)
    • clear

      public void clear()
      Description copied from class: StatusBarPhaseDisplay
      Clears the actions of this phase. Called usually when the ESC key is pressed.
      Specified by:
      clear in class StatusBarPhaseDisplay
    • finishedMovingUnits

      public void finishedMovingUnits(BoardViewEvent b)
      Description copied from interface: BoardViewListener
      Sent when moving units is finished.
      Specified by:
      finishedMovingUnits in interface BoardViewListener
      Overrides:
      finishedMovingUnits in class AbstractPhaseDisplay
      Parameters:
      b - an event
    • unitSelected

      public void unitSelected(BoardViewEvent event)
      Description copied from interface: BoardViewListener
      Sent when Unit is selected.
      Specified by:
      unitSelected in interface BoardViewListener
      Overrides:
      unitSelected in class AbstractPhaseDisplay
      Parameters:
      event - an event
    • valueChanged

      public void valueChanged(ListSelectionEvent event)
      Specified by:
      valueChanged in interface ListSelectionListener
    • removeAllListeners

      public void removeAllListeners()
      Description copied from interface: Distractable
      Stop just ignoring events and actually stop listening to them.
      Specified by:
      removeAllListeners in interface Distractable
      Overrides:
      removeAllListeners in class ActionPhaseDisplay
    • getTarget

      public Targetable getTarget()