|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.client.ServerGametypeInfo
class ServerGametypeInfo
Track the server's information about the game type: valid game option set, scenarios, etc. Client has one instance for remote tcp server, one for practice server. For simplicity, getters/setters are not included: Synchronize on the object to set/read its fields.
In v2.0.00 and newer, also tracks all SOCScenario
s' i18n localized strings.
Interaction with client-server messages at connect:
SOCGameOption.getAllKnownOptions()
.
SOCGameOption.OTYPE_UNKNOWN
.)
Once these are all received, set allOptionsReceived = true,
clear newGameWaitingForOpts.
NewGameOptionsFrame
.
Server scenario info is sent on demand, instead of sending all info when the client connects:
scenKeys
, client will ask the server for info about that scenario.
Meanwhile it will display game info, and assume the server will reply before the user
clicks "scenario info" in the game info popup.
Before v2.0.00 this class was SOCPlayerClient
.GameOptionServerSet.
Field Summary | |
---|---|
boolean |
allOptionsReceived
If true, we know all options on this server, or the server is too old to support options. |
boolean |
allScenInfoReceived
If true, the server sent us information on all added or changed scenarios, and any localized i18n scenario strings ( allScenStringsReceived ). |
boolean |
allScenStringsReceived
If true, the server sent us all scenarios' i18n strings, has none for our locale, or is too old to support them. |
boolean |
askedDefaultsAlready
Have we asked the server for default values? |
long |
askedDefaultsTime
If askedDefaultsAlready , the time it was asked,
as returned by System.currentTimeMillis() . |
boolean |
defaultsReceived
Has the server told us defaults? |
java.lang.String |
gameInfoWaitingForOpts
If non-null, we're waiting to hear about game options because user has clicked 'game info' on a game. |
boolean |
newGameWaitingForOpts
If true, we've asked the server about defaults or options because we're about to create a new game. |
java.util.Map<java.lang.String,SOCGameOption> |
optionSet
Options will be null if SOCPlayerClient.sVersion
is less than SOCNewGameWithOptions.VERSION_FOR_NEWGAMEWITHOPTIONS (1.1.07). |
java.util.HashSet<java.lang.String> |
scenKeys
Any scenario keynames for which the server has sent us updated info or i18n strings or responded with "unknown". |
Constructor Summary | |
---|---|
ServerGametypeInfo()
Create a new ServerGametypeInfo, with an optionSet defaulting
to our client version's SOCGameOption.getAllKnownOptions() . |
Method Summary | |
---|---|
void |
noMoreOptions(boolean askedDefaults)
The server doesn't have any more options to send (or none at all, from its version). |
java.util.List<java.lang.String> |
receiveDefaults(java.util.Map<java.lang.String,SOCGameOption> servOpts)
Set of default options has been received from the server, examine them. |
boolean |
receiveInfo(SOCGameOptionInfo gi)
After calling receiveDefaults, call this as each GAMEOPTIONGETINFO is received. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean allOptionsReceived
public boolean newGameWaitingForOpts
public java.lang.String gameInfoWaitingForOpts
public java.util.Map<java.lang.String,SOCGameOption> optionSet
SOCPlayerClient.sVersion
is less than SOCNewGameWithOptions.VERSION_FOR_NEWGAMEWITHOPTIONS
(1.1.07).
Otherwise, set from SOCGameOption.getAllKnownOptions()
and update from server as needed.
public boolean askedDefaultsAlready
public boolean defaultsReceived
public long askedDefaultsTime
askedDefaultsAlready
, the time it was asked,
as returned by System.currentTimeMillis()
.
public boolean allScenStringsReceived
The server sends all scenario strings when client has asked for game option defaults for the dialog to create a new game.
scenKeys
,
allScenInfoReceived
public boolean allScenInfoReceived
allScenStringsReceived
).
scenKeys
public java.util.HashSet<java.lang.String> scenKeys
allScenStringsReceived
or allScenStringsReceived
.
Constructor Detail |
---|
public ServerGametypeInfo()
optionSet
defaulting
to our client version's SOCGameOption.getAllKnownOptions()
.
Method Detail |
---|
public void noMoreOptions(boolean askedDefaults)
Check the server version against SOCNewGameWithOptions.VERSION_FOR_NEWGAMEWITHOPTIONS
(1.1.07). If the server is too old to understand options, right after calling this method
you must set optionSet
= null.
askedDefaults
- Should we also set the askedDefaultsAlready flag? It not, leave it unchanged.public java.util.List<java.lang.String> receiveDefaults(java.util.Map<java.lang.String,SOCGameOption> servOpts)
servOpts
- The allowable SOCGameOption
received from the server.
Assumes has been parsed already against the locally known opts,
so ones that we don't know are SOCGameOption.OTYPE_UNKNOWN
.
public boolean receiveInfo(SOCGameOptionInfo gi)
gi
- Message from server with info on one parameter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |