|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soc.client.SOCPlayerInterface.ClientBridge
private static class SOCPlayerInterface.ClientBridge
Client Bridge to translate interface to SOCPlayerInterface methods.
For most methods here, PlayerClientListener
will have their javadoc.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface soc.client.PlayerClientListener |
---|
PlayerClientListener.UpdateType |
Field Summary | |
---|---|
(package private) SOCPlayerInterface |
pi
|
Constructor Summary | |
---|---|
SOCPlayerInterface.ClientBridge(SOCPlayerInterface pi)
Create a new ClientBridge for this playerinterface and its SOCGame . |
Method Summary | |
---|---|
void |
boardLayoutUpdated()
|
void |
boardPotentialsUpdated()
|
void |
boardReset(SOCGame newGame,
int newSeatNumber,
int requestingPlayerNumber)
|
void |
boardResetVoteCast(SOCPlayer voter,
boolean vote)
|
void |
boardResetVoteRejected()
|
void |
boardResetVoteRequested(SOCPlayer requestor)
|
void |
boardUpdated()
|
void |
buildRequestCanceled(SOCPlayer player)
|
void |
debugFreePlaceModeToggled(boolean isEnabled)
|
void |
devCardDeckUpdated()
|
void |
diceRolled(SOCPlayer player,
int rollSum)
Show a dice roll result. |
void |
diceRolledResources(java.util.List<java.lang.Integer> pnum,
java.util.List<SOCResourceSet> rsrc)
Receive a notification that the dice roll resulted in players gaining resources. |
void |
gameDisconnected(java.lang.String errorMessage)
|
void |
gameEnded(java.util.Map<SOCPlayer,java.lang.Integer> scores)
|
void |
gameStarted()
Game play is starting (leaving state SOCGame.NEW ). |
void |
gameStateChanged(int gameState)
Update interface after game state has changed. |
void |
invItemPlayRejected(int type,
int reasonCode)
Client player's request to play a special SOCInventoryItem was rejected by the server. |
void |
largestArmyRefresh(SOCPlayer old,
SOCPlayer potentialNew)
The largest army might have changed, so update |
void |
longestRoadRefresh(SOCPlayer old,
SOCPlayer potentialNew)
The longest road might have changed, so update |
void |
membersListed(java.util.Collection<java.lang.String> names)
The current game members (players and observers) are listed, and the game is about to start. |
void |
messageBroadcast(java.lang.String msg)
|
void |
messageSent(java.lang.String nickname,
java.lang.String message)
A game text message was received from server, or a chat message from another player. |
void |
pieceValueUpdated(SOCPlayingPiece piece)
A playing piece's value was updated: _SC_CLVI village cloth count, or
_SC_PIRI pirate fortress strength. |
void |
playerCanCancelInvItemPlay(SOCPlayer player,
boolean canCancel)
A player is playing or placing a special SOCInventoryItem , such as
a gift trade port in scenario _SC_FTRI . |
void |
playerDevCardUpdated(SOCPlayer player,
boolean addedPlayable)
A player is drawing or playing a development card, or a card or special SOCInventoryItem has been added or removed from their hand's inventory. |
void |
playerElementUpdated(SOCPlayer player,
PlayerClientListener.UpdateType utype)
Update one part of the player's status, such as their number of settlements remaining. |
void |
playerFaceChanged(SOCPlayer player,
int faceId)
A player has changed their face icon. |
void |
playerJoined(java.lang.String nickname)
A client (us or someone else) has joined the game. |
void |
playerLeft(java.lang.String nickname,
SOCPlayer player)
A client player or observer is leaving the game. |
void |
playerPickSpecialItem(java.lang.String typeKey,
SOCGame ga,
SOCPlayer pl,
int gi,
int pi,
boolean isPick,
int coord,
int level,
java.lang.String sv)
Show the results of a player's PICK of a known Special Item ,
or the server's DECLINE of the client player's pick request. |
void |
playerPieceMoved(SOCPlayer player,
int sourceCoordinate,
int targetCoordinate,
int pieceType)
A player has moved a piece on the board. |
void |
playerPiecePlaced(SOCPlayer player,
int coordinate,
int pieceType)
A player has placed a piece on the board. |
void |
playerPieceRemoved(SOCPlayer player,
int pieceCoordinate,
int pieceType)
A player's piece has been removed from the board. |
void |
playerResourcesUpdated(SOCPlayer player)
A player's total resource count has been updated. |
void |
playerSetSpecialItem(java.lang.String typeKey,
SOCGame ga,
SOCPlayer pl,
int gi,
int pi,
boolean isSet)
Show the results of a player's SET or CLEAR of a known Special Item . |
void |
playerSitdown(int playerNumber,
java.lang.String sitterNickname)
A client has sat down to become an active player. |
void |
playerStats(java.util.EnumMap<PlayerClientListener.UpdateType,java.lang.Integer> stats)
A player's game stats, such as resource totals received from dice rolls, should be displayed. |
void |
playerSVPAwarded(SOCPlayer player,
int numSvp,
java.lang.String awardDescription)
A player has been awarded Special Victory Point(s). |
void |
playerTurnSet(int playerNumber)
Game's current player has changed. |
void |
requestedChoosePlayer(java.util.List<SOCPlayer> choices,
boolean isNoneAllowed)
This player must choose a player for robbery. |
void |
requestedChooseRobResourceType(SOCPlayer player)
|
void |
requestedDiceRoll()
|
void |
requestedDiscard(int countToDiscard)
The game requests that the client player discard a particular number of resource cards. |
void |
requestedGoldResourceCountUpdated(SOCPlayer player,
int countToSelect)
This player must pick this many gold-hex resources, or no longer needs to pick them. |
void |
requestedResourceSelect(int countToDiscard)
The client player gets some free resources of their choice. |
void |
requestedSpecialBuild(SOCPlayer player)
|
void |
requestedTrade(SOCPlayer offerer)
|
void |
requestedTradeClear(SOCPlayer offerer)
|
void |
requestedTradeRejection(SOCPlayer rejecter)
|
void |
requestedTradeReset(SOCPlayer playerToReset)
|
void |
robberMoved()
|
void |
scen_SC_PIRI_pirateFortressAttackResult(boolean wasRejected,
int defStrength,
int resultShipsLost)
In scenario _SC_PIRI, present the server's response to a Pirate Fortress Attack request from the current player (the client or another player), which may be: Rejected, Lost, Tied, or Won. |
void |
seatLockUpdated()
|
void |
simpleAction(int pn,
int acttype,
int value1,
int value2)
A "simple action" has occurred in the game and should be displayed. |
void |
simpleRequest(int pn,
int reqtype,
int value1,
int value2)
A player's "simple request" has been sent to the entire game, or the server
has replied to our own simple request, and this should be displayed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
final SOCPlayerInterface pi
Constructor Detail |
---|
public SOCPlayerInterface.ClientBridge(SOCPlayerInterface pi)
SOCGame
.
pi
- A player interface, already linked to a gameMethod Detail |
---|
public void diceRolled(SOCPlayer player, int rollSum)
diceRolled
in interface PlayerClientListener
player
- May be null
if the current player was null when the dice roll was received from the server.rollSum
- The sum of the dice rolled. May be -1 for some game events.public void diceRolledResources(java.util.List<java.lang.Integer> pnum, java.util.List<SOCResourceSet> rsrc)
PlayerClientListener
PlayerClientListener.diceRolled(SOCPlayer, int)
.
diceRolledResources
in interface PlayerClientListener
pnum
- Player numbers, same format as SOCDiceResultResources.playerNum
rsrc
- Resources gained by each pn
, same format as SOCDiceResultResources.playerRsrc
public void playerJoined(java.lang.String nickname)
PlayerClientListener
PlayerClientListener.playerSitdown(int, String)
is called,
then they will be an active player.
playerJoined
in interface PlayerClientListener
nickname
- New client's player/observer namepublic void playerLeft(java.lang.String nickname, SOCPlayer player)
PlayerClientListener
playerLeft
in interface PlayerClientListener
nickname
- The player name. Will not be null
player
- May be null
if the current player is an observer.public void playerSitdown(int playerNumber, java.lang.String sitterNickname)
PlayerClientListener
PlayerClientListener.playerJoined(String)
was called earlier on this client.
SOCGame.addPlayer(String, int)
has just been called.
playerSitdown
in interface PlayerClientListener
playerNumber
- New player's playerNumber in the game; the seat number they've sat down atsitterNickname
- New player's namepublic void playerTurnSet(int playerNumber)
playerTurnSet
in interface PlayerClientListener
playerNumber
- New current player number whose turn it is.public void playerPiecePlaced(SOCPlayer player, int coordinate, int pieceType)
PlayerClientListener
playerPiecePlaced
in interface PlayerClientListener
pieceType
- A piece type identifier, such as SOCPlayingPiece.CITY
public void playerPieceMoved(SOCPlayer player, int sourceCoordinate, int targetCoordinate, int pieceType)
PlayerClientListener
SOCShip
pieces can sometimes be moved.
Not used when the robber or pirate is moved; see PlayerClientListener.robberMoved()
.
playerPieceMoved
in interface PlayerClientListener
pieceType
- A piece type identifier, such as SOCPlayingPiece.CITY
public void playerPieceRemoved(SOCPlayer player, int pieceCoordinate, int pieceType)
PlayerClientListener
_SC_PIRI
.
playerPieceRemoved
in interface PlayerClientListener
player
- Player who owns the shippieceCoordinate
- Ship's node coordinatepieceType
- The piece type identifier SOCPlayingPiece.SHIP
public void playerSVPAwarded(SOCPlayer player, int numSvp, java.lang.String awardDescription)
PlayerClientListener
playerSVPAwarded
in interface PlayerClientListener
player
- The player awarded special victory points. Will not be null
numSvp
- The count of how many new special victory points were awardedawardDescription
- A user-display message describing the reason for the awardpublic void playerResourcesUpdated(SOCPlayer player)
PlayerClientListener
playerResourcesUpdated
in interface PlayerClientListener
player
- The playerpublic void playerElementUpdated(SOCPlayer player, PlayerClientListener.UpdateType utype)
PlayerClientListener
playerElementUpdated
in interface PlayerClientListener
player
- May be null
utype
- The type of element to updatepublic void requestedSpecialBuild(SOCPlayer player)
requestedSpecialBuild
in interface PlayerClientListener
public void requestedGoldResourceCountUpdated(SOCPlayer player, int countToSelect)
PlayerClientListener
PlayerClientListener.requestedResourceSelect(int)
is used for that.
requestedGoldResourceCountUpdated
in interface PlayerClientListener
player
- The playercountToSelect
- Number of free resources they must pick, or 0 if they've just picked thempublic void playerDevCardUpdated(SOCPlayer player, boolean addedPlayable)
PlayerClientListener
SOCInventoryItem
has been added or removed from their hand's inventory.
If this inventory update comes from playing a special SOCInventoryItem
, call
PlayerClientListener.playerCanCancelInvItemPlay(SOCPlayer, boolean)
after calling this method.
playerDevCardUpdated
in interface PlayerClientListener
player
- The playeraddedPlayable
- True if the update added a dev card or item that's playable nowpublic void playerCanCancelInvItemPlay(SOCPlayer player, boolean canCancel)
PlayerClientListener
SOCInventoryItem
, such as
a gift trade port in scenario _SC_FTRI
. Set a flag that indicates
if this play or placement can be canceled (returned to player's inventory).
It makes sense to call this for only the client player, since we don't cancel other players' item plays.
playerCanCancelInvItemPlay
in interface PlayerClientListener
player
- The playercanCancel
- True if SOCInventoryItem.canCancelPlay
public void playerFaceChanged(SOCPlayer player, int faceId)
PlayerClientListener
playerFaceChanged
in interface PlayerClientListener
player
- The playerfaceId
- New face icon number;
1 and higher are human face images, 0 is the default robot, -1 is the smarter robot.public void playerStats(java.util.EnumMap<PlayerClientListener.UpdateType,java.lang.Integer> stats)
PlayerClientListener
playerStats
in interface PlayerClientListener
stats
- Player statistic detailspublic void largestArmyRefresh(SOCPlayer old, SOCPlayer potentialNew)
PlayerClientListener
largestArmyRefresh
in interface PlayerClientListener
public void longestRoadRefresh(SOCPlayer old, SOCPlayer potentialNew)
PlayerClientListener
longestRoadRefresh
in interface PlayerClientListener
public void membersListed(java.util.Collection<java.lang.String> names)
SOCPlayerInterface.began(Vector)
.
membersListed
in interface PlayerClientListener
names
- Game member names; to see if each is a player, call SOCGame.getPlayer(String)
.public void boardLayoutUpdated()
boardLayoutUpdated
in interface PlayerClientListener
public void boardUpdated()
boardUpdated
in interface PlayerClientListener
public void pieceValueUpdated(SOCPlayingPiece piece)
PlayerClientListener
_SC_CLVI
village cloth count, or
_SC_PIRI
pirate fortress strength.
Repaint that piece (if needed) on the board.
pieceValueUpdated
in interface PlayerClientListener
piece
- Piece that was updated, includes its new valuepublic void boardPotentialsUpdated()
boardPotentialsUpdated
in interface PlayerClientListener
public void boardReset(SOCGame newGame, int newSeatNumber, int requestingPlayerNumber)
boardReset
in interface PlayerClientListener
public void boardResetVoteRequested(SOCPlayer requestor)
boardResetVoteRequested
in interface PlayerClientListener
public void boardResetVoteCast(SOCPlayer voter, boolean vote)
boardResetVoteCast
in interface PlayerClientListener
public void boardResetVoteRejected()
boardResetVoteRejected
in interface PlayerClientListener
public void seatLockUpdated()
seatLockUpdated
in interface PlayerClientListener
public void gameStarted()
PlayerClientListener
SOCGame.NEW
).
Next move is for players to make their starting placements.
Call SOCGame.setGameState(int)
before calling this method.
Call this method before calling PlayerClientListener.gameStateChanged(int)
.
gameStarted
in interface PlayerClientListener
public void gameStateChanged(int gameState)
PlayerClientListener
SOCGame.setGameState(int)
first.
If the game is now starting, please call in this order:
game.setGameState(newState);
PlayerClientListener.gameStarted()
;
PlayerClientListener.gameStateChanged(int)
;
gameStateChanged
in interface PlayerClientListener
gameState
- One of the codes from SOCGame, such as SOCGame.NEW
public void gameEnded(java.util.Map<SOCPlayer,java.lang.Integer> scores)
gameEnded
in interface PlayerClientListener
public void gameDisconnected(java.lang.String errorMessage)
gameDisconnected
in interface PlayerClientListener
public void messageBroadcast(java.lang.String msg)
messageBroadcast
in interface PlayerClientListener
public void messageSent(java.lang.String nickname, java.lang.String message)
PlayerClientListener
messageSent
in interface PlayerClientListener
nickname
- Player's nickname, or null
for messages from the server itselfmessage
- Message textpublic final void simpleRequest(int pn, int reqtype, int value1, int value2)
PlayerClientListener
"simple request"
has been sent to the entire game, or the server
has replied to our own simple request, and this should be displayed.
This method lets us display simple things from the server without defining a lot of small similar methods.
If other game data messages are sent (resource gains/loss, etc), or other client code must update that data
based on info in the SOCSimpleRequest, this method will be called only after other game data is updated.
Some SimpleRequest reqtype
s update the game data: Client must call
SOCDisplaylessPlayerClient.handleSIMPLEREQUEST(Map, soc.message.SOCSimpleRequest)
to update game before calling this method.
simpleRequest
in interface PlayerClientListener
pn
- The player number requesting or acting, or -1 if our own request was declinedreqtype
- The request type, from SOCSimpleRequest
constants for simplicityvalue1
- First optional detail value, or 0value2
- Second optional detail value, or 0PlayerClientListener.simpleAction(int, int, int, int)
public final void simpleAction(int pn, int acttype, int value1, int value2)
PlayerClientListener
"simple action"
has occurred in the game and should be displayed.
This method lets us show simple things from the server without defining a lot of small similar methods.
This will be called only after other game data is updated (number of dev cards, resource gains/loss, etc).
simpleAction
in interface PlayerClientListener
pn
- The player number acting or acted onacttype
- The action type, from SOCSimpleAction
constants for simplicityvalue1
- First optional detail value, or 0value2
- Second optional detail value, or 0PlayerClientListener.simpleRequest(int, int, int, int)
public void buildRequestCanceled(SOCPlayer player)
buildRequestCanceled
in interface PlayerClientListener
public void invItemPlayRejected(int type, int reasonCode)
PlayerClientListener
SOCInventoryItem
was rejected by the server.
invItemPlayRejected
in interface PlayerClientListener
type
- Item type from SOCInventoryItem.itype
reasonCode
- Optional reason code for the SOCInventoryItemAction.CANNOT_PLAY
action,
corresponding to SOCGame.canPlayInventoryItem(int, int)
return codes, or 0public void playerPickSpecialItem(java.lang.String typeKey, SOCGame ga, SOCPlayer pl, int gi, int pi, boolean isPick, int coord, int level, java.lang.String sv)
PlayerClientListener
PICK
of a known Special Item
,
or the server's DECLINE
of the client player's pick request.
To see which scenario and option typeKey
s pick Special Items,
and scenario-specific usage details, see the SOCSpecialItem
class javadoc.
coord
and level
are sent for convenience, and sometimes may not be from the Special Item you need;
see SOCSetSpecialItem.OP_PICK
for details.
playerPickSpecialItem
in interface PlayerClientListener
typeKey
- Item's typeKey
, as described in the SOCSpecialItem
class javadocga
- Game containing pl
and special itemspl
- Player who picked: Never null
when isPick
,
is null
if server declined our player's requestgi
- Picked this index within game's Special Item list, or -1pi
- Picked this index within pl
's Special Item list, or -1isPick
- True if calling for PICK
, false if server has DECLINE
d the client player's requestcoord
- Optional coordinates on the board for this item, or -1. An edge or a node, depending on item typelevel
- Optional level of construction or strength, or 0sv
- Optional string value from SOCSpecialItem.getStringValue()
, or null
PlayerClientListener.playerSetSpecialItem(String, SOCGame, SOCPlayer, int, int, boolean)
,
SOCSpecialItem.playerPickItem(String, SOCGame, SOCPlayer, int, int)
public void playerSetSpecialItem(java.lang.String typeKey, SOCGame ga, SOCPlayer pl, int gi, int pi, boolean isSet)
PlayerClientListener
SET
or CLEAR
of a known Special Item
.
To see which scenario and option typeKey
s set or clear Special Items,
and scenario-specific usage details, see the SOCSpecialItem
class javadoc.
playerSetSpecialItem
in interface PlayerClientListener
typeKey
- Item's typeKey
, as described in the SOCSpecialItem
class javadocga
- Game containing pl
and special itemspl
- Requesting player; never null
gi
- Set or clear this index within game's Special Item list, or -1pi
- Set or clear this index within pl
's Special Item list, or -1isSet
- True if player has set, false if player has cleared, this item indexPlayerClientListener.playerPickSpecialItem(String, SOCGame, SOCPlayer, int, int, boolean, int, int, String)
,
SOCSpecialItem.playerSetItem(String, SOCGame, SOCPlayer, int, int, boolean)
public void scen_SC_PIRI_pirateFortressAttackResult(boolean wasRejected, int defStrength, int resultShipsLost)
PlayerClientListener
This will be called only after other game pieces are updated (fortress strength, player's ships lost).
scen_SC_PIRI_pirateFortressAttackResult
in interface PlayerClientListener
wasRejected
- True if the server rejected our player's request to attackdefStrength
- Pirate defense strength, unless wasRejected
resultShipsLost
- Result and number of ships lost by the player:
0 if player won (or if rejected); 1 if tied; 2 if player lost to the pirates.public void robberMoved()
robberMoved
in interface PlayerClientListener
public void devCardDeckUpdated()
devCardDeckUpdated
in interface PlayerClientListener
public void requestedDiscard(int countToDiscard)
PlayerClientListener
requestedDiscard
in interface PlayerClientListener
countToDiscard
- Must choose and discard this many cardspublic void requestedResourceSelect(int countToDiscard)
PlayerClientListener
requestedResourceSelect
in interface PlayerClientListener
countToDiscard
- Must choose this many resourcesPlayerClientListener.requestedGoldResourceCountUpdated(SOCPlayer, int)
public void requestedChoosePlayer(java.util.List<SOCPlayer> choices, boolean isNoneAllowed)
PlayerClientListener
requestedChoosePlayer
in interface PlayerClientListener
choices
- The potential victim players to choose fromisNoneAllowed
- If true, player can choose to rob no one (game scenario SC_PIRI)SOCPlayerClient.GameManager.choosePlayer(SOCGame, int)
public void requestedChooseRobResourceType(SOCPlayer player)
requestedChooseRobResourceType
in interface PlayerClientListener
public void requestedTrade(SOCPlayer offerer)
requestedTrade
in interface PlayerClientListener
public void requestedTradeClear(SOCPlayer offerer)
requestedTradeClear
in interface PlayerClientListener
offerer
- May be null
public void requestedTradeRejection(SOCPlayer rejecter)
requestedTradeRejection
in interface PlayerClientListener
public void requestedTradeReset(SOCPlayer playerToReset)
requestedTradeReset
in interface PlayerClientListener
playerToReset
- May be null
to clear all seatspublic void requestedDiceRoll()
requestedDiceRoll
in interface PlayerClientListener
public void debugFreePlaceModeToggled(boolean isEnabled)
debugFreePlaceModeToggled
in interface PlayerClientListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |