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 class
ObscurableOptions.SetAllowed
-
Field Summary
Fields Modifier and Type Field Description static String
COMMAND_ID
static String
PREFS_KEY
-
Constructor Summary
Constructors Constructor Description ObscurableOptions(String settings)
Create a private set of ObscurableOptions. -
Method Summary
Modifier and Type Method Description void
allow(String id)
void
allowAll()
void
allowNone()
void
allowSome(String preferencesPrompt)
Command
decode(String command)
Translate a String into aCommand
void
decodeOptions(String s)
Set the current options from an encoded stringvoid
disallow(String id)
String
encode(Command c)
Translate aCommand
into a StringString
encodeOptions()
Encode the current ObscurableOptions as a Stringstatic ObscurableOptions
getInstance()
Return the current global ObscurableOptionsCommand
getRestoreCommand()
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 nullboolean
isUnmaskable(String id)
void
setPrompt(String preferencesPrompt)
Set the text accompanying the "Allow opponent to unmask" control in the Preferencesvoid
setup(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:CommandEncoder
Translate a String into aCommand
- Specified by:
decode
in interfaceCommandEncoder
-
encode
Description copied from interface:CommandEncoder
Translate aCommand
into a String- Specified by:
encode
in 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: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
-
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
- 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
-