|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public static interface SOCPlayerClient.GameDisplay
A facade for the SOCPlayerClient to use to invoke actions in the GUI
Method Summary | |
---|---|
void |
addToGameList(boolean cannotJoin,
java.lang.String gameName,
java.lang.String gameOptsStr,
boolean addToSrvList)
Add a new game to the initial window's list of games. |
void |
channelCreated(java.lang.String channelName)
|
void |
channelDeleted(java.lang.String channelName)
|
void |
channelJoined(java.lang.String channelName)
|
void |
channelJoined(java.lang.String channelName,
java.lang.String nickname)
|
void |
channelLeft(java.lang.String channelName)
|
void |
channelLeft(java.lang.String channelName,
java.lang.String nickname)
|
void |
channelList(java.util.Collection<java.lang.String> channelNames,
boolean isPractice)
|
void |
channelMemberList(java.lang.String channelName,
java.util.Collection<java.lang.String> members)
|
void |
channelsClosed(java.lang.String message)
|
void |
clickPracticeButton()
Act as if the "practice game" button has been clicked. |
void |
connect(java.lang.String cpass,
java.lang.String cuser)
Prepare to connect and give feedback by showing a message panel. |
boolean |
deleteFromGameList(java.lang.String gameName,
boolean isPractice)
Delete a game from the list. |
void |
enableOptions()
|
void |
focusPassword()
If the password field is currently visible, focus the cursor there for the user to type something. |
PlayerClientListener |
gameJoined(SOCGame game)
|
void |
gameWithOptionsBeginSetup(boolean forPracticeServer,
boolean didAuth)
Want to start a new game, on a server which supports options. |
void |
initVisualElements()
Init the visual elements. |
void |
messageBroadcast(java.lang.String message)
|
void |
messageReceived(java.lang.String channelName,
java.lang.String nickname,
java.lang.String message)
|
void |
optionsReceived(ServerGametypeInfo opts,
boolean isPractice)
Server has sent its game option default values for new games. |
void |
optionsReceived(ServerGametypeInfo opts,
boolean isPractice,
boolean isDash,
boolean hasAllNow)
Server has sent info about a single game option. |
void |
optionsRequested()
|
void |
practiceGameStarting()
|
void |
setMessage(java.lang.String string)
|
void |
setPassword(java.lang.String pw)
Set the contents of the password field. |
void |
showErrorDialog(java.lang.String errMessage,
java.lang.String buttonText)
Show an error dialog which has one button. |
void |
showErrorPanel(java.lang.String err,
boolean canPractice)
After network trouble, show a panel with the error message instead of the main user/password/games/channels panel. |
void |
showStatus(java.lang.String statusText,
boolean debugWarn)
Show server welcome banner or status text. |
void |
showVersion(int versionNumber,
java.lang.String versionString,
java.lang.String buildString,
SOCServerFeatures feats)
After connecting, display the remote server's version on main panel, and update display based on its active SOCServerFeatures . |
void |
updateGameStats(java.lang.String gameName,
int[] scores,
boolean[] robots)
Update this game's stats in the game list display. |
Method Detail |
---|
void initVisualElements()
SOCServerFeatures
.
So, most of the Main Panel elements are initialized here but not
laid out or made visible until a later call to
showVersion(int, String, String, SOCServerFeatures)
when the version and features are known.
void connect(java.lang.String cpass, java.lang.String cuser)
Does not make a network connection.
Call SOCPlayerClient.ClientNetwork.connect(String, int)
when ready to make the connection.
User login and authentication don't occur until a game or channel join is requested; at that time, the user interface will read the name and password stored here.
cpass
- Password text to put into that TextField (obscured)cuser
- User nickname text to put into that TextFieldvoid clickPracticeButton()
void practiceGameStarting()
void setMessage(java.lang.String string)
void showErrorDialog(java.lang.String errMessage, java.lang.String buttonText)
errMessage
- Error message to showbuttonText
- Button text, or null for "OK"void showErrorPanel(java.lang.String err, boolean canPractice)
If we have the startup panel (started as JAR client app, not applet) with buttons to connect to a server or practice, show that instead of the simpler practice-only message panel.
err
- Error message to showcanPractice
- In current state of client, can we start a practice game?void enableOptions()
void showVersion(int versionNumber, java.lang.String versionString, java.lang.String buildString, SOCServerFeatures feats)
SOCServerFeatures
.
Not called for practice server.
If we're running a server, display its listening port # instead.
versionNumber
- Version number, like 1119, from server's Version.versionNumber()
versionString
- Version string, like "1.1.19", from server's Version.version()
buildString
- Build number, from server's Version.buildnum()
feats
- Active optional server features; never null. If server is older than v1.1.19, use the
SOCServerFeatures(true)
constructor.void showStatus(java.lang.String statusText, boolean debugWarn)
statusText
- Status message text from serverdebugWarn
- True if server has Debug Mode activevoid focusPassword()
void setPassword(java.lang.String pw)
void channelJoined(java.lang.String channelName)
void channelJoined(java.lang.String channelName, java.lang.String nickname)
void channelMemberList(java.lang.String channelName, java.util.Collection<java.lang.String> members)
void channelCreated(java.lang.String channelName)
void channelLeft(java.lang.String channelName)
void channelLeft(java.lang.String channelName, java.lang.String nickname)
void channelList(java.util.Collection<java.lang.String> channelNames, boolean isPractice)
void channelDeleted(java.lang.String channelName)
void channelsClosed(java.lang.String message)
void messageBroadcast(java.lang.String message)
void messageReceived(java.lang.String channelName, java.lang.String nickname, java.lang.String message)
PlayerClientListener gameJoined(SOCGame game)
void gameWithOptionsBeginSetup(boolean forPracticeServer, boolean didAuth)
NewGameOptionsFrame
is already
showing, give it focus instead of creating a new one.
For a summary of the flags and variables involved with game options,
and the client/server interaction about their values, see
ServerGametypeInfo
.
forPracticeServer
- Ask SOCPlayerClient.ClientNetwork.practiceServer
, instead of TCP server?didAuth
- If true, the server has authenticated our username and password;
set those input fields read-only.void optionsRequested()
void optionsReceived(ServerGametypeInfo opts, boolean isPractice)
ServerGametypeInfo.newGameWaitingForOpts
flag was set and
has just been cleared. Client should show dialog to create a new game which
will have game options.
opts
- Client's game option info, tracking the TCP or local practice serverisPractice
- True if received from SOCPlayerClient.ClientNetwork.practiceServer
, instead of TCP servervoid optionsReceived(ServerGametypeInfo opts, boolean isPractice, boolean isDash, boolean hasAllNow)
hasAllNow
,
client should check ServerGametypeInfo.newGameWaitingForOpts
and
ServerGametypeInfo.gameInfoWaitingForOpts
, and if either of these
were waiting, show a game info/options dialog for a new game or existing game.
opts
- Client's game option info, tracking the TCP or local practice serverisPractice
- True if received from SOCPlayerClient.ClientNetwork.practiceServer
, instead of TCP serverisDash
- True if the game option was "-"
, indicating the end of the list.
If so, no further options will be sent and any running timeout task related to the
game options can be cancelled.hasAllNow
- If true, all game option info has now been received by the clientvoid addToGameList(boolean cannotJoin, java.lang.String gameName, java.lang.String gameOptsStr, boolean addToSrvList)
SOCPlayerClient.serverGames
list.
cannotJoin
- Can we not join this game?gameName
- the game name to add to the list;
must not have the prefix SOCGames.MARKER_THIS_GAME_UNJOINABLE
.gameOptsStr
- String of packed game options
, or nulladdToSrvList
- Should this game be added to the list of remote-server games?
Practice games should not be added.void updateGameStats(java.lang.String gameName, int[] scores, boolean[] robots)
gameName
- Name of game to updatescores
- Each player position's scorerobots
- Is this position a robot?SOCGameStats
boolean deleteFromGameList(java.lang.String gameName, boolean isPractice)
SOCPlayerClient.serverGames
.
gameName
- the game to removeisPractice
- Game is practice, not at tcp server?
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |