Package VASSAL.build.module
Class ObscurableOptions
java.lang.Object
VASSAL.build.module.ObscurableOptions
- All Implemented Interfaces:
GameComponent,CommandEncoder
public class ObscurableOptions extends Object implements CommandEncoder, GameComponent
Determines whether players are allowed to unmask other players pieces. The module designer may
set the option to always on, always off, or let the players determine it with a Preferences setting.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classObscurableOptions.SetAllowed -
Field Summary
Fields Modifier and Type Field Description static StringCOMMAND_IDstatic StringPREFS_KEY -
Constructor Summary
Constructors Constructor Description ObscurableOptions(String settings)Create a private set of ObscurableOptions. -
Method Summary
Modifier and Type Method Description voidallow(String id)voidallowAll()voidallowNone()voidallowSome(String preferencesPrompt)Commanddecode(String command)Translate a String into aCommandvoiddecodeOptions(String s)Set the current options from an encoded stringvoiddisallow(String id)Stringencode(Command c)Translate aCommandinto a StringStringencodeOptions()Encode the current ObscurableOptions as a Stringstatic ObscurableOptionsgetInstance()Return the current global ObscurableOptionsCommandgetRestoreCommand()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 nullbooleanisUnmaskable(String id)voidsetPrompt(String preferencesPrompt)Set the text accompanying the "Allow opponent to unmask" control in the Preferencesvoidsetup(boolean gameStarting)Notify the GameComponent that a game has started/ended
-
Field Details
-
COMMAND_ID
- See Also:
- Constant Field Values
-
PREFS_KEY
- See Also:
- Constant Field Values
-
-
Constructor Details
-
ObscurableOptions
Create a private set of ObscurableOptions. If no setting are passed, use the current global settings.- Parameters:
settings- encoded settings
-
-
Method Details
-
getInstance
Return the current global ObscurableOptions- Returns:
- global Options
-
allowSome
-
setPrompt
Set the text accompanying the "Allow opponent to unmask" control in the Preferences -
allowAll
public void allowAll() -
allowNone
public void allowNone() -
allow
-
disallow
-
decode
Description copied from interface:CommandEncoderTranslate a String into aCommand- Specified by:
decodein interfaceCommandEncoder
-
encode
Description copied from interface:CommandEncoderTranslate aCommandinto a String- Specified by:
encodein interfaceCommandEncoder
-
encodeOptions
Encode the current ObscurableOptions as a String- Returns:
- encoded options
-
decodeOptions
Set the current options from an encoded string- Parameters:
s- encoded string
-
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
-
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- if true, a game is starting. If false, then a game is ending
-
isUnmaskable
- Returns:
- true if pieces belonging to the given id are unmaskable by other players
-