Package VASSAL.counters
Class Obscurable
java.lang.Object
VASSAL.counters.Decorator
VASSAL.counters.Obscurable
- All Implemented Interfaces:
PropertyNameSource
,PropertySource
,EditablePiece
,GamePiece
,PropertyExporter
,StateMergeable
,TranslatablePiece
,PersistentPropertyContainer
public class Obscurable extends Decorator implements TranslatablePiece
-
Field Summary
Fields Modifier and Type Field Description protected PieceAccess
access
protected static char
BACKGROUND
protected KeyCommand[]
commandsWithoutPeek
protected KeyCommand[]
commandsWithPeek
protected static String
DEFAULT_PEEK_COMMAND
protected char
displayStyle
protected KeyCommand
hide
protected String
hideCommand
static String
ID
protected static char
IMAGE
protected String
imageName
protected static char
INSET
protected NamedKeyStroke
keyCommand
protected String
maskName
protected String
obscuredBy
protected ObscurableOptions
obscuredOptions
protected GamePiece
obscuredToMeView
protected String
obscuredToOthersImage
protected GamePiece
obscuredToOthersView
protected char
obscureKey
protected KeyCommand
peek
protected static char
PEEK
protected String
peekCommand
protected boolean
peeking
protected NamedKeyStroke
peekKey
Fields inherited from interface VASSAL.counters.PropertyExporter
LOCALIZED_NAME
Fields inherited from interface VASSAL.i18n.TranslatablePiece
PREFIX
-
Constructor Summary
Constructors Constructor Description Obscurable()
Obscurable(String type, GamePiece d)
-
Method Summary
Modifier and Type Method Description protected Rectangle
bBoxObscuredToMe()
protected Rectangle
bBoxObscuredToOthers()
Rectangle
boundingBox()
The area which this GamePiece occupies when drawn at the point (0,0)void
draw(Graphics g, int x, int y, Component obs, double zoom)
Draw this GamePieceprotected void
drawObscuredToMe(Graphics g, int x, int y, Component obs, double zoom)
protected void
drawObscuredToOthers(Graphics g, int x, int y, Component obs, double zoom)
String
getDescription()
A plain-English description of this type of piecePieceEditor
getEditor()
Get the configurer for this traitHelpFile
getHelpFile()
PieceI18nData
getI18nData()
Return I18n data for this pieceKeyCommand[]
getKeyCommands()
The set of key commands that will populate the piece's right-click menu.String
getLocalizedName()
Return the translated name for this piece.Object
getLocalizedProperty(Object key)
String
getName()
The plain English name for this pieceprotected String
getName(String maskedName, boolean localized)
Object
getProperty(Object key)
List<String>
getPropertyNames()
Return Property names exposed by this traitShape
getShape()
The shape of the piece from the user's viewpoint.boolean
isMaskable()
Return true if this piece can be masked/unmasked by the current playerboolean
isMaskableBy(String id)
Deprecated, for removal: This API element is subject to removal in a future version.boolean
isPeeking()
Return true if the piece is currently being "peeked at"Command
keyEvent(KeyStroke stroke)
Append the command returned byDecorator.myKeyEvent(javax.swing.KeyStroke)
with the command returned by the inner piece'sGamePiece.keyEvent(javax.swing.KeyStroke)
method.KeyCommand[]
myGetKeyCommands()
String
myGetState()
String
myGetType()
Command
myKeyEvent(KeyStroke stroke)
The response of this trait alone to the given KeyStrokevoid
mySetState(String in)
Set just the state of this traitvoid
mySetType(String in)
Set the type information for this piece.boolean
obscuredToMe()
boolean
obscuredToOthers()
static void
setAllHidden(boolean allHidden)
Deprecated, for removal: This API element is subject to removal in a future version.void
setProperty(Object key, Object val)
Other properties, possibly game-specific, can be associated with a piece.Methods inherited from class VASSAL.counters.Decorator
getCommandDescription, getDecorator, getI18nData, getI18nData, getId, getInner, getInnermost, getMap, getOuter, getOutermost, getParent, getPersistentProperty, getPosition, getProperties, getState, getTranslation, getType, isSelected, mergeState, putOldProperties, repack, reportDataError, reportDataError, reportDataError, setId, setInner, setMap, setOldProperties, setOldProperties, setParent, setPersistentProperty, setPosition, setSelected, setState, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface VASSAL.counters.GamePiece
getId, getMap, getParent, getPosition, getState, getType, setId, setMap, setParent, setPosition, setState
Methods inherited from interface VASSAL.counters.PropertyExporter
getProperties
-
Field Details
-
ID
- See Also:
- Constant Field Values
-
INSET
protected static final char INSET- See Also:
- Constant Field Values
-
BACKGROUND
protected static final char BACKGROUND- See Also:
- Constant Field Values
-
PEEK
protected static final char PEEK- See Also:
- Constant Field Values
-
IMAGE
protected static final char IMAGE- See Also:
- Constant Field Values
-
DEFAULT_PEEK_COMMAND
- See Also:
- Constant Field Values
-
obscureKey
protected char obscureKey -
keyCommand
-
peekKey
-
imageName
-
obscuredToOthersImage
-
obscuredBy
-
obscuredOptions
-
hideCommand
-
peekCommand
-
obscuredToMeView
-
obscuredToOthersView
-
peeking
protected boolean peeking -
displayStyle
protected char displayStyle -
maskName
-
access
-
commandsWithPeek
-
commandsWithoutPeek
-
hide
-
peek
-
-
Constructor Details
-
Obscurable
public Obscurable() -
Obscurable
-
-
Method Details
-
mySetState
Description copied from class:Decorator
Set just the state of this trait- Specified by:
mySetState
in classDecorator
- See Also:
Decorator.myGetState()
-
mySetType
Description copied from interface:EditablePiece
Set the type information for this piece. SeeDecorator.myGetType()
- Specified by:
mySetType
in interfaceEditablePiece
-
myGetType
- Specified by:
myGetType
in classDecorator
- Returns:
- the type of this trait alone
- See Also:
Decorator.getType()
-
myGetState
- Specified by:
myGetState
in classDecorator
- Returns:
- the state of this trait alone
- See Also:
Decorator.getState()
-
boundingBox
Description copied from interface:GamePiece
The area which this GamePiece occupies when drawn at the point (0,0)- Specified by:
boundingBox
in interfaceGamePiece
-
getShape
Description copied from interface:GamePiece
The shape of the piece from the user's viewpoint. This defines the area in which the user must click to select or move the piece, for example. LikeGamePiece.boundingBox()
, it assumes the position is (0,0) and must be translated to the actual location where the piece is being drawn. -
obscuredToMe
public boolean obscuredToMe() -
obscuredToOthers
public boolean obscuredToOthers() -
setProperty
Description copied from interface:GamePiece
Other properties, possibly game-specific, can be associated with a piece. The properties may or may not need to be encoded in the piece'sGamePiece.getState()
method.- Specified by:
setProperty
in interfaceGamePiece
- Overrides:
setProperty
in classDecorator
-
getProperty
- Specified by:
getProperty
in interfaceGamePiece
- Specified by:
getProperty
in interfacePropertySource
- Overrides:
getProperty
in classDecorator
-
getLocalizedProperty
- Specified by:
getLocalizedProperty
in interfacePropertySource
- Overrides:
getLocalizedProperty
in classDecorator
-
draw
Description copied from interface:GamePiece
Draw this GamePiece -
drawObscuredToMe
-
drawObscuredToOthers
-
isPeeking
public boolean isPeeking()Return true if the piece is currently being "peeked at" -
bBoxObscuredToMe
-
bBoxObscuredToOthers
-
getLocalizedName
Description copied from class:Decorator
Return the translated name for this piece. Most pieces do not have translatable elements, so just return the standard name- Specified by:
getLocalizedName
in interfaceGamePiece
- Overrides:
getLocalizedName
in classDecorator
-
getName
Description copied from interface:GamePiece
The plain English name for this piece -
getName
-
getKeyCommands
Description copied from class:Decorator
The set of key commands that will populate the piece's right-click menu. The key commands are accessible through theProperties.KEY_COMMANDS
property. The commands for a Decorator are a composite ofDecorator.myGetKeyCommands()
and the commands of its inner piece.- Overrides:
getKeyCommands
in classDecorator
- Returns:
- the commands for this piece and its inner piece
-
myGetKeyCommands
- Specified by:
myGetKeyCommands
in classDecorator
- Returns:
- the commands for this trait alone
- See Also:
Decorator.getKeyCommands()
-
isMaskableBy
Deprecated, for removal: This API element is subject to removal in a future version.Return true if this piece can be masked/unmasked by the current player- Parameters:
id
- ignored
-
isMaskable
public boolean isMaskable()Return true if this piece can be masked/unmasked by the current player -
keyEvent
Description copied from class:Decorator
Append the command returned byDecorator.myKeyEvent(javax.swing.KeyStroke)
with the command returned by the inner piece'sGamePiece.keyEvent(javax.swing.KeyStroke)
method.- Specified by:
keyEvent
in interfaceGamePiece
- Overrides:
keyEvent
in classDecorator
- Parameters:
stroke
- Stroke to apply- Returns:
- Generated Command or null if no effect
- See Also:
ForwardToKeyBuffer
-
myKeyEvent
Description copied from class:Decorator
The response of this trait alone to the given KeyStroke- Specified by:
myKeyEvent
in classDecorator
- Parameters:
stroke
- Stroke to apply- Returns:
- Generated Command or null if no effect
- See Also:
Decorator.keyEvent(javax.swing.KeyStroke)
-
getDescription
Description copied from interface:EditablePiece
A plain-English description of this type of piece- Specified by:
getDescription
in interfaceEditablePiece
-
getHelpFile
- Specified by:
getHelpFile
in interfaceEditablePiece
-
getEditor
Description copied from interface:EditablePiece
Get the configurer for this trait- Specified by:
getEditor
in interfaceEditablePiece
- Overrides:
getEditor
in classDecorator
-
setAllHidden
@Deprecated(since="2020-08-06", forRemoval=true) public static void setAllHidden(boolean allHidden)Deprecated, for removal: This API element is subject to removal in a future version.If true, then all masked pieces are considered masked to all players. Used to temporarily draw pieces as they appear to other players- Parameters:
allHidden
- True to hide all pieces
-
getI18nData
Description copied from class:Decorator
Return I18n data for this piece- Specified by:
getI18nData
in interfaceTranslatablePiece
- Overrides:
getI18nData
in classDecorator
- Returns:
- I18n data
-
getPropertyNames
Return Property names exposed by this trait- Specified by:
getPropertyNames
in interfacePropertyNameSource
- Overrides:
getPropertyNames
in classDecorator
-