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 PieceAccessaccessprotected static charBACKGROUNDprotected KeyCommand[]commandsWithoutPeekprotected KeyCommand[]commandsWithPeekprotected static StringDEFAULT_PEEK_COMMANDprotected chardisplayStyleprotected KeyCommandhideprotected StringhideCommandstatic StringIDprotected static charIMAGEprotected StringimageNameprotected static charINSETprotected NamedKeyStrokekeyCommandprotected StringmaskNameprotected StringobscuredByprotected ObscurableOptionsobscuredOptionsprotected GamePieceobscuredToMeViewprotected StringobscuredToOthersImageprotected GamePieceobscuredToOthersViewprotected charobscureKeyprotected KeyCommandpeekprotected static charPEEKprotected StringpeekCommandprotected booleanpeekingprotected NamedKeyStrokepeekKeyFields inherited from interface VASSAL.counters.PropertyExporter
LOCALIZED_NAMEFields 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 RectanglebBoxObscuredToMe()protected RectanglebBoxObscuredToOthers()RectangleboundingBox()The area which this GamePiece occupies when drawn at the point (0,0)voiddraw(Graphics g, int x, int y, Component obs, double zoom)Draw this GamePieceprotected voiddrawObscuredToMe(Graphics g, int x, int y, Component obs, double zoom)protected voiddrawObscuredToOthers(Graphics g, int x, int y, Component obs, double zoom)StringgetDescription()A plain-English description of this type of piecePieceEditorgetEditor()Get the configurer for this traitHelpFilegetHelpFile()PieceI18nDatagetI18nData()Return I18n data for this pieceKeyCommand[]getKeyCommands()The set of key commands that will populate the piece's right-click menu.StringgetLocalizedName()Return the translated name for this piece.ObjectgetLocalizedProperty(Object key)StringgetName()The plain English name for this pieceprotected StringgetName(String maskedName, boolean localized)ObjectgetProperty(Object key)List<String>getPropertyNames()Return Property names exposed by this traitShapegetShape()The shape of the piece from the user's viewpoint.booleanisMaskable()Return true if this piece can be masked/unmasked by the current playerbooleanisMaskableBy(String id)Deprecated, for removal: This API element is subject to removal in a future version.booleanisPeeking()Return true if the piece is currently being "peeked at"CommandkeyEvent(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()StringmyGetState()StringmyGetType()CommandmyKeyEvent(KeyStroke stroke)The response of this trait alone to the given KeyStrokevoidmySetState(String in)Set just the state of this traitvoidmySetType(String in)Set the type information for this piece.booleanobscuredToMe()booleanobscuredToOthers()static voidsetAllHidden(boolean allHidden)Deprecated, for removal: This API element is subject to removal in a future version.voidsetProperty(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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface VASSAL.counters.GamePiece
getId, getMap, getParent, getPosition, getState, getType, setId, setMap, setParent, setPosition, setStateMethods 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:DecoratorSet just the state of this trait- Specified by:
mySetStatein classDecorator- See Also:
Decorator.myGetState()
-
mySetType
Description copied from interface:EditablePieceSet the type information for this piece. SeeDecorator.myGetType()- Specified by:
mySetTypein interfaceEditablePiece
-
myGetType
- Specified by:
myGetTypein classDecorator- Returns:
- the type of this trait alone
- See Also:
Decorator.getType()
-
myGetState
- Specified by:
myGetStatein classDecorator- Returns:
- the state of this trait alone
- See Also:
Decorator.getState()
-
boundingBox
Description copied from interface:GamePieceThe area which this GamePiece occupies when drawn at the point (0,0)- Specified by:
boundingBoxin interfaceGamePiece
-
getShape
Description copied from interface:GamePieceThe 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:GamePieceOther 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:
setPropertyin interfaceGamePiece- Overrides:
setPropertyin classDecorator
-
getProperty
- Specified by:
getPropertyin interfaceGamePiece- Specified by:
getPropertyin interfacePropertySource- Overrides:
getPropertyin classDecorator
-
getLocalizedProperty
- Specified by:
getLocalizedPropertyin interfacePropertySource- Overrides:
getLocalizedPropertyin classDecorator
-
draw
Description copied from interface:GamePieceDraw 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:DecoratorReturn the translated name for this piece. Most pieces do not have translatable elements, so just return the standard name- Specified by:
getLocalizedNamein interfaceGamePiece- Overrides:
getLocalizedNamein classDecorator
-
getName
Description copied from interface:GamePieceThe plain English name for this piece -
getName
-
getKeyCommands
Description copied from class:DecoratorThe set of key commands that will populate the piece's right-click menu. The key commands are accessible through theProperties.KEY_COMMANDSproperty. The commands for a Decorator are a composite ofDecorator.myGetKeyCommands()and the commands of its inner piece.- Overrides:
getKeyCommandsin classDecorator- Returns:
- the commands for this piece and its inner piece
-
myGetKeyCommands
- Specified by:
myGetKeyCommandsin 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:DecoratorAppend the command returned byDecorator.myKeyEvent(javax.swing.KeyStroke)with the command returned by the inner piece'sGamePiece.keyEvent(javax.swing.KeyStroke)method.- Specified by:
keyEventin interfaceGamePiece- Overrides:
keyEventin classDecorator- Parameters:
stroke- Stroke to apply- Returns:
- Generated Command or null if no effect
- See Also:
ForwardToKeyBuffer
-
myKeyEvent
Description copied from class:DecoratorThe response of this trait alone to the given KeyStroke- Specified by:
myKeyEventin 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:EditablePieceA plain-English description of this type of piece- Specified by:
getDescriptionin interfaceEditablePiece
-
getHelpFile
- Specified by:
getHelpFilein interfaceEditablePiece
-
getEditor
Description copied from interface:EditablePieceGet the configurer for this trait- Specified by:
getEditorin interfaceEditablePiece- Overrides:
getEditorin 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:DecoratorReturn I18n data for this piece- Specified by:
getI18nDatain interfaceTranslatablePiece- Overrides:
getI18nDatain classDecorator- Returns:
- I18n data
-
getPropertyNames
Return Property names exposed by this trait- Specified by:
getPropertyNamesin interfacePropertyNameSource- Overrides:
getPropertyNamesin classDecorator
-