Package VASSAL.build.module.map
Class Flare
java.lang.Object
VASSAL.search.AbstractImageFinder
VASSAL.build.AbstractBuildable
VASSAL.build.AbstractConfigurable
VASSAL.build.module.map.Flare
- All Implemented Interfaces:
MouseListener,EventListener,AutoConfigurable,Buildable,Configurable,GameComponent,Drawable,PropertyNameSource,CommandEncoder,ComponentDescription,ValidityChecker,Translatable,Auditable,ImageSearchTarget,SearchTarget,UniqueIdManager.Identifyable
public class Flare
extends AbstractConfigurable
implements CommandEncoder, GameComponent, Drawable, MouseListener, UniqueIdManager.Identifyable, ComponentDescription
Allows a player to ping a location ("send up a flare") by clicking on a map with the correct modifier key
combination held down (default: Alt+LeftClick). Can be shown as an animated colored circle, or a plain one.
If reportFormat field is provided, a message is also displayed in the chat log.
Flare will work with both online play and PBEM play.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA configurer for different combinations of modifier keystatic classA configurer for our reportFormat, which includes the unique $FlareLocation$, $FlareZone$, $FlareMap$ properties as well as $PlayerName$ and $PlayerSide$ in the "Insert" pulldown.Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
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 Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected Stringprotected static final UniqueIdManagerstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, localizedName, myI18nData, nameFields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validatorFields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidIn case reports use HTML and refer to any image filesvoidAdds this component to a Buildable component.Deserializes string command info into a Flare Command.voidDraw the Flare at current animation framebooleanFlare is always drawn above countersSerializes Flare commands into string form.Class<?>[]String[]Attribute names for this component's buildFile (xml) entry.String[]Attribute names for this component's buildFile (xml) entry.Class<?>[]Attribute types for this component's buildFile (xml) entry.Gets current attribute value in string form.static StringgetId()getMap()When saving a game, each GameComponent should return aCommandthat, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return nullvoidvoidvoidvoidCheck for our modifier key, and if so launch a Flare sequence on our map, and send a command to other players' along with a Chat Log message if a Report Format has been specified in the component.voidvoidremoveFrom(Buildable parent) Removes this component from a Buildable parent.voidsetAttribute(String key, Object value) Sets the value of one of this component's attributes.voidRecord our clicked point on the mapvoidSets our unique ID (among Flares), so that multiple Flares don't inadvertently start each other when we send commands to other clients.voidsetup(boolean gameStarting) Notify the GameComponent that a game has started/endedvoidstartAnimation(boolean isLocal) Start the Flare animation.Methods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getAttributeVisibility, getConfigureComponents, getConfigureName, getConfigurer, getExpressionList, getI18nData, getI18nPrefix, getLocalizedConfigureName, getMenuTextList, getNamedKeyStrokeList, getPropertyList, getTypeName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameMethods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, build, buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getNonFolderAncestor, getPropertyNames, setAncestor, validateMethods inherited from class VASSAL.search.AbstractImageFinder
getAllImageNames, getLocalImageNamesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface VASSAL.script.expression.Auditable
getComponentName, getComponentTypeNameMethods inherited from interface VASSAL.build.Buildable
build, getBuildElement, isMandatory, isMovable, isUniqueMethods inherited from interface VASSAL.tools.UniqueIdManager.Identifyable
getConfigureName
-
Field Details
-
COMMAND_PREFIX
- See Also:
-
idMgr
-
id
-
CIRCLE_SIZE
- See Also:
-
CIRCLE_SCALE
- See Also:
-
CIRCLE_COLOR
- See Also:
-
FLARE_KEY
- See Also:
-
PULSES
- See Also:
-
PULSES_PER_SEC
- See Also:
-
REPORT_FORMAT
- See Also:
-
NAME
- See Also:
-
NO_ANIMATION
- See Also:
-
DESCRIPTION
- See Also:
-
FLARE_ALT_LOCAL
-
FLARE_CTRL_LOCAL
-
FLARE_COMMAND_LOCAL
-
FLARE_ALT_SHIFT_LOCAL
-
FLARE_SHIFT_COMMAND_LOCAL
-
FLARE_CTRL_SHIFT_LOCAL
-
FLARE_ALT_COMMAND_LOCAL
-
FLARE_CTRL_ALT_LOCAL
-
FLARE_ALT_SHIFT_COMMAND_LOCAL
-
FLARE_CTRL_ALT_SHIFT_LOCAL
-
FLARE_ALT
- See Also:
-
FLARE_CTRL
- See Also:
-
FLARE_ALT_SHIFT
- See Also:
-
FLARE_CTRL_SHIFT
- See Also:
-
FLARE_CTRL_ALT
- See Also:
-
FLARE_CTRL_ALT_SHIFT
- See Also:
-
FLARE_NAME
- See Also:
-
FLARE_LOCATION
- See Also:
-
FLARE_ZONE
- See Also:
-
FLARE_MAP
- See Also:
-
-
Constructor Details
-
Flare
public Flare()
-
-
Method Details
-
getDescription
- Specified by:
getDescriptionin interfaceComponentDescription- Returns:
- String description of this component, displayed in Editor.
-
getConfigureTypeName
- Returns:
- String name of component class. The part in [..] in the Editor.
-
getMap
- Returns:
- the Map associated with this Flare component.
-
getAttributeTypes
Attribute types for this component's buildFile (xml) entry. These launch the proper configurers when the component is edited in the Editor.- Specified by:
getAttributeTypesin interfaceAutoConfigurable- Specified by:
getAttributeTypesin classAbstractConfigurable- Returns:
- list of classes for attributes
-
getAttributeNames
Attribute names for this component's buildFile (xml) entry.- Specified by:
getAttributeNamesin interfaceAutoConfigurable- Specified by:
getAttributeNamesin classAbstractBuildable- Returns:
- list of names for attributes
-
getAttributeDescriptions
Attribute names for this component's buildFile (xml) entry. These show up in the Editor next to the configurers for each attribute.- Specified by:
getAttributeDescriptionsin interfaceAutoConfigurable- Specified by:
getAttributeDescriptionsin classAbstractConfigurable- Returns:
- list of names for attributes
-
getAttributeValueString
Gets current attribute value in string form.- Specified by:
getAttributeValueStringin interfaceAutoConfigurable- Specified by:
getAttributeValueStringin interfaceTranslatable- Specified by:
getAttributeValueStringin classAbstractBuildable- Parameters:
key- - attribute name- Returns:
- current the value of one of this component's attributes, in string form.
-
setAttribute
Sets the value of one of this component's attributes.- Specified by:
setAttributein interfaceAutoConfigurable- Specified by:
setAttributein interfaceTranslatable- Specified by:
setAttributein classAbstractBuildable- Parameters:
key- the name of the attributevalue- new value for attribute. Can pass either the Object itself or the String version.
-
getHelpFile
- Specified by:
getHelpFilein interfaceConfigurable- Returns:
- Help file for this component, accessed when "Help" button in Editor is clicked while configuring component.
-
addTo
-
removeFrom
Removes this component from a Buildable parent.- Specified by:
removeFromin interfaceConfigurable- Parameters:
parent- - the Map to remove the Flare from.
-
startAnimation
public void startAnimation(boolean isLocal) Start the Flare animation.- Parameters:
isLocal- - true if this Flare was launched on this client (i.e. by this player). Otherwise, center on the ping location if user preferences are set for centering on opponent moves.
-
draw
-
drawAboveCounters
public boolean drawAboveCounters()Flare is always drawn above counters- Specified by:
drawAboveCountersin interfaceDrawable- Returns:
- true
-
encode
Serializes Flare commands into string form.- Specified by:
encodein interfaceCommandEncoder- Parameters:
c- Command- Returns:
- String version of Flare Command, or null if not a Flare Command.
-
decode
Deserializes string command info into a Flare Command.- Specified by:
decodein interfaceCommandEncoder- Parameters:
s- String for a Flare Command- Returns:
- Flare Command object
-
getAllowableConfigureComponents
- Specified by:
getAllowableConfigureComponentsin interfaceConfigurable- Returns:
- a list of valid sub-component Classes. If a Class
appears in this list, then instances of that class may be added
to this component from the Editor's
ConfigureTreewindow by right-clicking on the component and selecting the appropriate "Add" option.
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener- Parameters:
e- MouseEvent
-
mousePressed
Check for our modifier key, and if so launch a Flare sequence on our map, and send a command to other players' along with a Chat Log message if a Report Format has been specified in the component.- Specified by:
mousePressedin interfaceMouseListener- Parameters:
e- - a MouseEvent
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener- Parameters:
e- MouseEvent
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
e- MouseEvent
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
e- MouseEvent
-
setup
public void setup(boolean gameStarting) Description copied from interface:GameComponentNotify the GameComponent that a game has started/ended- Specified by:
setupin interfaceGameComponent- Parameters:
gameStarting- true if starting a game, false if ending one
-
getRestoreCommand
Description copied from interface:GameComponentWhen saving a game, each GameComponent should return aCommandthat, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return null- Specified by:
getRestoreCommandin interfaceGameComponent- Returns:
- Theoretically returns the command to "restore" this from a saved game or when adding a new player, but of course Flare doesn't need to be "restored", so null.
-
setClickPoint
Record our clicked point on the map- Parameters:
p- - point where player clicked and where flare should be shown
-
getClickPoint
- Returns:
- point where player clicked and where flare should be shown
-
setId
Sets our unique ID (among Flares), so that multiple Flares don't inadvertently start each other when we send commands to other clients.- Specified by:
setIdin interfaceUniqueIdManager.Identifyable- Parameters:
id- Sets our unique ID
-
getId
- Specified by:
getIdin interfaceUniqueIdManager.Identifyable- Returns:
- unique ID of this flare, for purposes of distinguishing between Flare commands
-
getFormattedStringList
- Specified by:
getFormattedStringListin interfaceSearchTarget- Overrides:
getFormattedStringListin classAbstractConfigurable- Returns:
- a list of any Message Format strings referenced in the Configurable, if any (for search)
-
addLocalImageNames
In case reports use HTML and refer to any image files- Specified by:
addLocalImageNamesin interfaceImageSearchTarget- Overrides:
addLocalImageNamesin classAbstractImageFinder- Parameters:
s- Collection to add image names to
-