|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.client.SOCPlayerClient.GameManager
public static class SOCPlayerClient.GameManager
Nested class for processing outgoing messages (putting).
Before v2.0.00, most of these fields and methods were part of the main SOCPlayerClient
class.
Field Summary | |
---|---|
private SOCPlayerClient |
client
|
private SOCPlayerClient.ClientNetwork |
net
|
Constructor Summary | |
---|---|
SOCPlayerClient.GameManager(SOCPlayerClient client)
|
Method Summary | |
---|---|
void |
acceptOffer(SOCGame ga,
int from)
the user is accepting an offer |
void |
bankTrade(SOCGame ga,
SOCResourceSet give,
SOCResourceSet get)
the user wants to trade with the bank or a port. |
void |
buildRequest(SOCGame ga,
int piece)
request to build something |
void |
buyDevCard(SOCGame ga)
request to buy a development card |
void |
cancelBuildRequest(SOCGame ga,
int piece)
request to cancel building something |
void |
changeFace(SOCGame ga,
int id)
the user is changing the face image |
void |
choosePirate(SOCGame ga)
The user is reacting to the move pirate request. |
void |
choosePlayer(SOCGame ga,
int ch)
The user chose a player to steal from, or (game state SOCGame.WAITING_FOR_ROBBER_OR_PIRATE )
chose whether to move the robber or the pirate,
or (game state SOCGame.WAITING_FOR_ROB_CLOTH_OR_RESOURCE )
chose whether to steal a resource or cloth. |
void |
chooseRobber(SOCGame ga)
The user is reacting to the move robber request. |
void |
clearOffer(SOCGame ga)
the user is clearing an offer |
void |
considerMove(SOCGame ga,
java.lang.String pname,
SOCPlayingPiece piece)
send a command to the server with a message asking a robot to show the debug info for a possible move after a move has been made |
void |
considerTarget(SOCGame ga,
java.lang.String pname,
SOCPlayingPiece piece)
send a command to the server with a message asking a robot to show the debug info for a possible move before a move has been made |
void |
discard(SOCGame ga,
SOCResourceSet rs)
the user wants to discard |
void |
discoveryPick(SOCGame ga,
SOCResourceSet rscs)
the user picked 2 resources to discover |
void |
endTurn(SOCGame ga)
the user is done with the turn |
void |
leaveGame(SOCGame ga)
the user leaves the given game |
void |
monopolyPick(SOCGame ga,
int res)
the user picked a resource to monopolize |
void |
movePieceRequest(SOCGame ga,
int pn,
int ptype,
int fromCoord,
int toCoord)
Ask the server to move this piece to a different coordinate. |
void |
moveRobber(SOCGame ga,
SOCPlayer pl,
int coord)
the player wants to move the robber or the pirate ship. |
void |
offerTrade(SOCGame ga,
SOCTradeOffer offer)
the user is making an offer to trade with another player. |
void |
pickResources(SOCGame ga,
SOCResourceSet rs)
The user has picked these resources to gain from the gold hex. |
void |
pickSpecialItem(SOCGame ga,
java.lang.String typeKey,
int gi,
int pi)
The current user wants to pick a Special Item . |
void |
playDevCard(SOCGame ga,
int dc)
the user wants to play a development card |
void |
playInventoryItem(SOCGame ga,
int itype)
The current user wants to play a special SOCInventoryItem . |
private boolean |
put(java.lang.String s,
boolean isPractice)
Write a message to the net or practice server. |
void |
putPiece(SOCGame ga,
SOCPlayingPiece pp)
put a piece on the board, using the SOCPutPiece message. |
void |
rejectOffer(SOCGame ga)
the user is rejecting the current offers |
void |
resetBoardRequest(SOCGame ga)
Player wants to request to reset the board (same players, new game, new layout). |
void |
resetBoardVote(SOCGame ga,
int pn,
boolean voteYes)
Player is responding to a board-reset vote from another player. |
void |
rollDice(SOCGame ga)
the user rolls the dice |
void |
sendSimpleRequest(SOCPlayer pl,
int reqtype)
The player wants to send a simple request to the server, such as SOCSimpleRequest.SC_PIRI_FORT_ATTACK to attack their
pirate fortress in scenario option _SC_PIRI . |
void |
sendSimpleRequest(SOCPlayer pl,
int reqtype,
int value1,
int value2)
The player wants to send a simple request to the server, such as SOCSimpleRequest.SC_PIRI_FORT_ATTACK to attack their
pirate fortress in scenario option _SC_PIRI ,
with optional value1 and value2 parameters. |
void |
sendText(SOCGame ga,
java.lang.String me)
send a text message to the people in the game |
void |
setSeatLock(SOCGame ga,
int pn,
SOCGame.SeatLockState sl)
The user is locking or unlocking a seat. |
void |
sitDown(SOCGame ga,
int pn)
the user sits down to play |
void |
startGame(SOCGame ga)
the user is starting the game |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final SOCPlayerClient client
private final SOCPlayerClient.ClientNetwork net
Constructor Detail |
---|
SOCPlayerClient.GameManager(SOCPlayerClient client)
Method Detail |
---|
private boolean put(java.lang.String s, boolean isPractice)
s
- the messageisPractice
- Put to the practice server, not tcp network?
SOCPlayerClient.ClientNetwork.localTCPServer
is considered "network" here.
Use isPractice only with SOCPlayerClient.ClientNetwork.practiceServer
.
public void buyDevCard(SOCGame ga)
ga
- the gamepublic void buildRequest(SOCGame ga, int piece)
ga
- the gamepiece
- the type of piece, from SOCPlayingPiece
constants,
or -1 to request the Special Building Phase.public void cancelBuildRequest(SOCGame ga, int piece)
ga
- the gamepiece
- the type of piece, from SOCPlayingPiece constantspublic void putPiece(SOCGame ga, SOCPlayingPiece pp)
SOCPutPiece
message.
If the game is in SOCGame.debugFreePlacement
mode,
send the SOCDebugFreePlace
message instead.
ga
- the game where the action is taking placepp
- the piece being placedpublic void movePieceRequest(SOCGame ga, int pn, int ptype, int fromCoord, int toCoord)
ga
- the game where the action is taking placepn
- The piece's player numberptype
- The piece type, such as SOCPlayingPiece.SHIP
fromCoord
- Move the piece from heretoCoord
- Move the piece to herepublic void moveRobber(SOCGame ga, SOCPlayer pl, int coord)
ga
- the gamepl
- the playercoord
- edge where the player wants the robber, or negative edge for the pirate shippublic void sendSimpleRequest(SOCPlayer pl, int reqtype)
SOCSimpleRequest.SC_PIRI_FORT_ATTACK
to attack their
pirate fortress in scenario option _SC_PIRI
.
Using network message request types within the client breaks abstraction, but prevents having a lot of very similar methods for simple requests.
pl
- the requesting playerreqtype
- the request type as defined in SOCSimpleRequest
sendSimpleRequest(SOCPlayer, int, int, int)
public void sendSimpleRequest(SOCPlayer pl, int reqtype, int value1, int value2)
SOCSimpleRequest.SC_PIRI_FORT_ATTACK
to attack their
pirate fortress in scenario option _SC_PIRI
,
with optional value1
and value2
parameters.
Using network message request types within the client breaks abstraction, but prevents having a lot of very similar methods for simple requests.
pl
- the requesting playerreqtype
- the request type as defined in SOCSimpleRequest
value1
- First optional detail value, or 0value2
- Second optional detail value, or 0sendSimpleRequest(SOCPlayer, int)
public void sendText(SOCGame ga, java.lang.String me)
ga
- the gameme
- the messagepublic void leaveGame(SOCGame ga)
ga
- the gamepublic void sitDown(SOCGame ga, int pn)
ga
- the gamepn
- the number of the seat where the user wants to sitpublic void startGame(SOCGame ga)
ga
- the gamepublic void rollDice(SOCGame ga)
ga
- the gamepublic void endTurn(SOCGame ga)
ga
- the gamepublic void discard(SOCGame ga, SOCResourceSet rs)
ga
- the gamepublic void pickResources(SOCGame ga, SOCResourceSet rs)
SOCGame.WAITING_FOR_DISCOVERY
, has picked these
2 free resources from a Discovery/Year of Plenty card.
ga
- the gamers
- The resources to pickpublic void choosePlayer(SOCGame ga, int ch)
SOCGame.WAITING_FOR_ROBBER_OR_PIRATE
)
chose whether to move the robber or the pirate,
or (game state SOCGame.WAITING_FOR_ROB_CLOTH_OR_RESOURCE
)
chose whether to steal a resource or cloth.
ga
- the gamech
- the player number,
or SOCChoosePlayer.CHOICE_MOVE_ROBBER
to move the robber
or SOCChoosePlayer.CHOICE_MOVE_PIRATE
to move the pirate ship.
See SOCChoosePlayer.SOCChoosePlayer(String, int)
for meaning
of ch for game state WAITING_FOR_ROB_CLOTH_OR_RESOURCE.public void chooseRobber(SOCGame ga)
ga
- the gamepublic void choosePirate(SOCGame ga)
ga
- the gamepublic void rejectOffer(SOCGame ga)
ga
- the gamepublic void acceptOffer(SOCGame ga, int from)
ga
- the gamefrom
- the number of the player that is making the offerpublic void clearOffer(SOCGame ga)
ga
- the gamepublic void bankTrade(SOCGame ga, SOCResourceSet give, SOCResourceSet get)
ga
- the gamegive
- what is being offeredget
- what the player wantspublic void offerTrade(SOCGame ga, SOCTradeOffer offer)
ga
- the gameoffer
- the trade offerpublic void playDevCard(SOCGame ga, int dc)
ga
- the gamedc
- the type of development cardpublic void playInventoryItem(SOCGame ga, int itype)
SOCInventoryItem
.
Send the server a SOCInventoryItemAction
(currentPlayerNumber, PLAY, itype, rc=0)
message.
ga
- the gameitype
- the special inventory item type picked by player,
from SOCInventoryItem.itype
public void pickSpecialItem(SOCGame ga, java.lang.String typeKey, int gi, int pi)
Special Item
.
Send the server a SOCSetSpecialItem
(PICK, typeKey, gi, pi, owner=-1, coord=-1, level=0)
message.
ga
- GametypeKey
- Special item type. Typically a SOCGameOption
keyname; see the SOCSpecialItem
class javadoc for details.gi
- Game Item Index, as in SOCGame.getSpecialItem(String, int)
or
SOCSpecialItem.playerPickItem(String, SOCGame, SOCPlayer, int, int)
, or -1pi
- Player Item Index, as in SOCSpecialItem.playerPickItem(String, SOCGame, SOCPlayer, int, int)
,
or -1public void discoveryPick(SOCGame ga, SOCResourceSet rscs)
ga
- the gamerscs
- the resourcespublic void monopolyPick(SOCGame ga, int res)
ga
- the gameres
- the resourcepublic void changeFace(SOCGame ga, int id)
ga
- the gameid
- the image idpublic void setSeatLock(SOCGame ga, int pn, SOCGame.SeatLockState sl)
ga
- the gamepn
- the seat numbersl
- new seat lock state; remember that servers older than v2.0.00 won't recognize CLEAR_ON_RESET
public void resetBoardRequest(SOCGame ga)
SOCResetBoardRequest
to server;
it will either respond with a
SOCResetBoardAuth
message,
or will tell other players to vote yes/no on the request.
Before calling, check player.hasAskedBoardReset()
and game.getResetVoteActive().
public void resetBoardVote(SOCGame ga, int pn, boolean voteYes)
SOCResetBoardRequest
to server;
it will either respond with a
SOCResetBoardAuth
message,
or will tell other players to vote yes/no on the request.
ga
- Game to vote onpn
- Player number of our player who is votingvoteYes
- If true, this player votes yes; if false, nopublic void considerMove(SOCGame ga, java.lang.String pname, SOCPlayingPiece piece)
ga
- the gamepname
- the robot namepiece
- the piece to considerpublic void considerTarget(SOCGame ga, java.lang.String pname, SOCPlayingPiece piece)
ga
- the gamepname
- the robot namepiece
- the piece to consider
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |