Class StartupGlobalKeyCommand

All Implemented Interfaces:
AutoConfigurable, Buildable, Configurable, GameComponent, PropertyNameSource, ValidityChecker, Translatable, ImageSearchTarget, SearchTarget, RecursionLimiter.Loopable

public class StartupGlobalKeyCommand extends GlobalKeyCommand implements GameComponent
A Global Key Command that is automatically invoked on game start-up, once the various Key Listeners have been started.

If multiple start-up commands need to be run, they should be combined in a MultiAction Button and then launched from a single instance of StartupGlobalKeyCommand, as the sequence in which multiple instances of StartupGlobalKeyCommand are fired is undetermined.

Author:
Pieter Geerkens
  • Constructor Details

    • StartupGlobalKeyCommand

      public StartupGlobalKeyCommand()
  • Method Details

    • addTo

      public void addTo(Buildable parent)
      Description copied from class: AbstractToolbarItem
      Default behavior adds the button to the module toolbar.
      Specified by:
      addTo in interface Buildable
      Overrides:
      addTo in class MassKeyCommand
      Parameters:
      parent - parent Buildable to add this component to as a subcomponent.
    • getConfigureTypeName

      public static String getConfigureTypeName()
    • getHelpFile

      public HelpFile getHelpFile()
      Specified by:
      getHelpFile in interface Configurable
      Overrides:
      getHelpFile in class MassKeyCommand
      Returns:
      a HelpFile describing how to use and configure * this component
    • getAttributeVisibility

      public VisibilityCondition getAttributeVisibility(String key)
      Description copied from class: AbstractConfigurable
      By default, all attributes are visible
      Specified by:
      getAttributeVisibility in interface AutoConfigurable
      Overrides:
      getAttributeVisibility in class GlobalKeyCommand
      Parameters:
      key - Name (key) of one of this component's attributes
      Returns:
      a VisibilityCondition for this attribute, or null if attribute should always be visible.
    • setup

      public void setup(boolean gameStarting)
      Description copied from interface: GameComponent
      Notify the GameComponent that a game has started/ended
      Specified by:
      setup in interface GameComponent
      Parameters:
      gameStarting - if true, a game is starting. If false, then a game is ending
    • getRestoreCommand

      public Command getRestoreCommand()
      Description copied from interface: GameComponent
      When saving a game, each GameComponent should return a Command that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null
      Specified by:
      getRestoreCommand in interface GameComponent