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
Modifier and TypeClassDescriptionstatic class
A configurer for different combinations of modifier keystatic class
A 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
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
protected String
protected static final UniqueIdManager
static final String
static final String
static final String
static final String
static final String
Fields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, localizedName, myI18nData, name
Fields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validator
Fields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
In case reports use HTML and refer to any image filesvoid
Adds this component to a Buildable component.Deserializes string command info into a Flare Command.void
Draw the Flare at current animation frameboolean
Flare 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 String
getId()
getMap()
When saving a game, each GameComponent should return aCommand
that, when executed, restores the GameComponent to its state when the game was saved If this component has no persistent state, return nullvoid
void
void
void
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.void
void
removeFrom
(Buildable parent) Removes this component from a Buildable parent.void
setAttribute
(String key, Object value) Sets the value of one of this component's attributes.void
Record our clicked point on the mapvoid
Sets our unique ID (among Flares), so that multiple Flares don't inadvertently start each other when we send commands to other clients.void
setup
(boolean gameStarting) Notify the GameComponent that a game has started/endedvoid
startAnimation
(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, setConfigureName
Methods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, build, buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getNonFolderAncestor, getPropertyNames, setAncestor, validate
Methods inherited from class VASSAL.search.AbstractImageFinder
getAllImageNames, getLocalImageNames
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface VASSAL.script.expression.Auditable
getComponentName, getComponentTypeName
Methods inherited from interface VASSAL.build.Buildable
build, getBuildElement, isMandatory, isMovable, isUnique
Methods 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:
getDescription
in 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:
getAttributeTypes
in interfaceAutoConfigurable
- Specified by:
getAttributeTypes
in classAbstractConfigurable
- Returns:
- list of classes for attributes
-
getAttributeNames
Attribute names for this component's buildFile (xml) entry.- Specified by:
getAttributeNames
in interfaceAutoConfigurable
- Specified by:
getAttributeNames
in 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:
getAttributeDescriptions
in interfaceAutoConfigurable
- Specified by:
getAttributeDescriptions
in classAbstractConfigurable
- Returns:
- list of names for attributes
-
getAttributeValueString
Gets current attribute value in string form.- Specified by:
getAttributeValueString
in interfaceAutoConfigurable
- Specified by:
getAttributeValueString
in interfaceTranslatable
- Specified by:
getAttributeValueString
in 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:
setAttribute
in interfaceAutoConfigurable
- Specified by:
setAttribute
in interfaceTranslatable
- Specified by:
setAttribute
in 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:
getHelpFile
in 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:
removeFrom
in 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:
drawAboveCounters
in interfaceDrawable
- Returns:
- true
-
encode
Serializes Flare commands into string form.- Specified by:
encode
in 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:
decode
in interfaceCommandEncoder
- Parameters:
s
- String for a Flare Command- Returns:
- Flare Command object
-
getAllowableConfigureComponents
- Specified by:
getAllowableConfigureComponents
in 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
ConfigureTree
window by right-clicking on the component and selecting the appropriate "Add" option.
-
mouseClicked
- Specified by:
mouseClicked
in 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:
mousePressed
in interfaceMouseListener
- Parameters:
e
- - a MouseEvent
-
mouseReleased
- Specified by:
mouseReleased
in interfaceMouseListener
- Parameters:
e
- MouseEvent
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
- Parameters:
e
- MouseEvent
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
- Parameters:
e
- MouseEvent
-
setup
public void setup(boolean gameStarting) Description copied from interface:GameComponent
Notify the GameComponent that a game has started/ended- Specified by:
setup
in interfaceGameComponent
- Parameters:
gameStarting
- true if starting a game, false if ending one
-
getRestoreCommand
Description copied from interface:GameComponent
When saving a game, each GameComponent should return aCommand
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 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:
setId
in interfaceUniqueIdManager.Identifyable
- Parameters:
id
- Sets our unique ID
-
getId
- Specified by:
getId
in interfaceUniqueIdManager.Identifyable
- Returns:
- unique ID of this flare, for purposes of distinguishing between Flare commands
-
getFormattedStringList
- Specified by:
getFormattedStringList
in interfaceSearchTarget
- Overrides:
getFormattedStringList
in 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:
addLocalImageNames
in interfaceImageSearchTarget
- Overrides:
addLocalImageNames
in classAbstractImageFinder
- Parameters:
s
- Collection to add image names to
-