Class StartupGlobalKeyCommand

All Implemented Interfaces:
AutoConfigurable, Buildable, Configurable, GameComponent, PropertyNameSource, ValidityChecker, Translatable, 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 interface: Buildable
      Adds this component to its parent. In order to make Buildable objects extensible, the child is reponsible for adding itself to the parent. That way, Buildable subcomponents can be defined in an extension package without needing to modify the containing class.
      Specified by:
      addTo in interface Buildable
      Overrides:
      addTo in class MassKeyCommand
    • getConfigureTypeName

      public static String getConfigureTypeName()
    • getHelpFile

      public HelpFile getHelpFile()
      Specified by:
      getHelpFile in interface Configurable
      Overrides:
      getHelpFile in class MassKeyCommand
      Returns:
      a HelpFilte 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