public class ParlorDirector extends com.threerings.presents.client.BasicDirector implements ParlorCodes, ParlorReceiver
ALREADY_AT_TABLE, BANNED_FROM_TABLE, GAME_ALREADY_STARTED, INVALID_TABLE_POSITION, INVITATION_ACCEPTED, INVITATION_COUNTERED, INVITATION_REFUSED, INVITEE_NOT_ONLINE, MUST_BE_CREATOR, NO_SELF_BOOT, NO_SUCH_TABLE, NOT_AT_TABLE, PARLOR_GROUP, TABLE_POSITION_OCCUPIED| Constructor and Description |
|---|
ParlorDirector(ParlorContext ctx)
Constructs a parlor director and provides it with the parlor context that it can use to
access the client services that it needs to provide its own services.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addGameReadyObserver(GameReadyObserver observer)
Adds the specified observer to the list of entities that are notified when we receive a game
ready notification.
|
void |
clientDidLogoff(com.threerings.presents.client.Client client) |
void |
gameIsReady(int gameOid)
Dispatched to the client when a game in which they are a
participant is ready for play.
|
Invitation |
invite(com.threerings.util.Name invitee,
GameConfig config,
InvitationResponseObserver observer)
Requests that the named user be invited to a game described by the supplied game config.
|
void |
receivedInvite(int remoteId,
com.threerings.util.Name inviter,
GameConfig config)
Called by the invocation services when another user has invited us
to play a game.
|
void |
receivedInviteCancellation(int remoteId)
Called by the invocation services when an outstanding invitation
has been cancelled by the inviting user.
|
void |
receivedInviteResponse(int remoteId,
int code,
Object arg)
Called by the invocation services when another user has responded
to our invitation by either accepting, refusing or countering it.
|
void |
removeGameReadyObserver(GameReadyObserver observer)
Removes the specified observer from the list of entities that are notified when we receive a
game ready notification.
|
void |
setInvitationHandler(InvitationHandler handler)
Sets the invitation handler, which is the entity that will be notified when we receive
incoming invitation notifications and when invitations have been cancelled.
|
void |
startSolitaire(GameConfig config,
com.threerings.presents.client.InvocationService.ConfirmListener listener)
Requests that the specified single player game be started.
|
public ParlorDirector(ParlorContext ctx)
ctx - the parlor context in use by the client.public void setInvitationHandler(InvitationHandler handler)
handler - our new invitation handler.public void addGameReadyObserver(GameReadyObserver observer)
public void removeGameReadyObserver(GameReadyObserver observer)
public Invitation invite(com.threerings.util.Name invitee, GameConfig config, InvitationResponseObserver observer)
invitee - the user to invite.config - the configuration of the game to which the user is being invited.observer - the entity that will be notified if this invitation is accepted, refused or
countered.public void startSolitaire(GameConfig config, com.threerings.presents.client.InvocationService.ConfirmListener listener)
config - the configuration of the single player game to be started.listener - a listener to be informed of failure if the game cannot be started.public void clientDidLogoff(com.threerings.presents.client.Client client)
clientDidLogoff in interface com.threerings.presents.client.SessionObserverclientDidLogoff in class com.threerings.presents.client.BasicDirectorpublic void gameIsReady(int gameOid)
ParlorReceivergameIsReady in interface ParlorReceivergameOid - the object id of the game object.public void receivedInvite(int remoteId,
com.threerings.util.Name inviter,
GameConfig config)
ParlorReceiverreceivedInvite in interface ParlorReceiverremoteId - the unique indentifier for this invitation (used
when countering or responding).inviter - the username of the inviting user.config - the configuration information for the game to which
we've been invited.public void receivedInviteResponse(int remoteId,
int code,
Object arg)
ParlorReceiverreceivedInviteResponse in interface ParlorReceiverremoteId - the indentifier for the invitation on question.code - the response code, either ParlorCodes.INVITATION_ACCEPTED or ParlorCodes.INVITATION_REFUSED or ParlorCodes.INVITATION_COUNTERED.arg - in the case of a refused invitation, a string
containing a message provided by the invited user explaining the
reason for refusal (the empty string if no explanation was
provided). In the case of a countered invitation, a new game config
object with the modified game configuration.public void receivedInviteCancellation(int remoteId)
ParlorReceiverreceivedInviteCancellation in interface ParlorReceiverremoteId - the indentifier of the cancelled invitation.Copyright © 2015. All rights reserved.