public class SceneDirector extends com.threerings.presents.client.BasicDirector implements SceneCodes, com.threerings.crowd.client.LocationDirector.FailureHandler, SceneReceiver, SceneService.SceneMoveListener
LocationDirector
in order to do this).
Note that when the scene director is in use instead of the location director, scene ids
instead of place oids will be supplied to LocationObserver.locationMayChange(int) and LocationObserver.locationChangeFailed(int, java.lang.String).
| Modifier and Type | Class and Description |
|---|---|
static interface |
SceneDirector.MoveHandler
Used to recover from a problem after a completed moveTo.
|
SCENE_UPDATE, WHIRLED_GROUP| Constructor and Description |
|---|
SceneDirector(WhirledContext ctx,
com.threerings.crowd.client.LocationDirector locdir,
SceneRepository screp,
SceneFactory fact)
Creates a new scene director with the specified context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPendingForcedMove(Runnable move) |
void |
cancelMoveRequest() |
void |
clientDidLogoff(com.threerings.presents.client.Client client) |
void |
didLeaveScene()
Called to clean up our place and scene state information when we leave a scene.
|
void |
forcedMove(int sceneId)
Used to communicate a required move notification to the client.
|
SceneModel |
getPendingModel()
Returns the model loaded in preparation for a scene transition.
|
int |
getPendingSceneId()
Returns the scene id set in preparation for a scene transition.
|
Scene |
getScene()
Returns the display scene object associated with the scene we currently occupy or null if we
currently occupy no scene.
|
boolean |
movePending()
Returns true if there is a pending move request.
|
void |
moveRequiresServerSwitch(String hostname,
int[] ports)
Indicates that the client must switch to the specified server and reissue its move
request in order to relocate to its desired scene.
|
void |
moveSucceeded(int placeId,
com.threerings.crowd.data.PlaceConfig config)
Indicates that a move succeeded.
|
void |
moveSucceededWithScene(int placeId,
com.threerings.crowd.data.PlaceConfig config,
SceneModel model)
Indicates that a move succeeded and that the client's cached scene information should be
updated with the supplied data.
|
void |
moveSucceededWithUpdates(int placeId,
com.threerings.crowd.data.PlaceConfig config,
SceneUpdate[] updates)
Indicates that a move succeeded and that the client's cached scene information should be
updated with the supplied data.
|
boolean |
moveTo(int sceneId)
Requests that this client move the specified scene.
|
boolean |
prepareMoveTo(int sceneId,
ResultListener<com.threerings.crowd.data.PlaceConfig> rl)
Prepares to move to the requested scene.
|
void |
recoverFailedMove(int placeId) |
void |
requestFailed(String reason) |
void |
setMoveHandler(SceneDirector.MoveHandler handler)
Sets the moveHandler for use in
recoverFailedMove(int). |
void |
setSceneRepository(SceneRepository screp)
Set the scene repository.
|
void |
updateReceived(SceneUpdate update)
Called by SceneController instances to tell us about an update to the current scene.
|
public SceneDirector(WhirledContext ctx, com.threerings.crowd.client.LocationDirector locdir, SceneRepository screp, SceneFactory fact)
ctx - the active client context.locdir - the location director in use on the client, with which the scene director will
coordinate when changing location.screp - the entity from which the scene director will load scene data from the local
client scene storage. This may be null when the SceneDirector is constructed, but it should
be supplied via setSceneRepository(com.threerings.whirled.client.persist.SceneRepository) prior to really using this director.fact - the factory that knows which derivation of Scene to create for the
current system.public void setSceneRepository(SceneRepository screp)
public Scene getScene()
public boolean movePending()
public boolean moveTo(int sceneId)
public boolean prepareMoveTo(int sceneId,
ResultListener<com.threerings.crowd.data.PlaceConfig> rl)
public SceneModel getPendingModel()
prepareMoveTo(int, com.samskivert.util.ResultListener<com.threerings.crowd.data.PlaceConfig>).public int getPendingSceneId()
getPendingModel(), this is for cooperating directors.public void moveSucceeded(int placeId,
com.threerings.crowd.data.PlaceConfig config)
SceneService.SceneMoveListenermoveSucceeded in interface SceneService.SceneMoveListenerplaceId - the place object id of the newly occupied scene.config - metadata related to the newly occupied scene.public void moveSucceededWithUpdates(int placeId,
com.threerings.crowd.data.PlaceConfig config,
SceneUpdate[] updates)
SceneService.SceneMoveListenermoveSucceededWithUpdates in interface SceneService.SceneMoveListenerplaceId - the place object id of the newly occupied scene.config - metadata related to the newly occupied scene.updates - updates that must be applied to the client's copy of a scene model to
bring it up to date.public void moveSucceededWithScene(int placeId,
com.threerings.crowd.data.PlaceConfig config,
SceneModel model)
SceneService.SceneMoveListenermoveSucceededWithScene in interface SceneService.SceneMoveListenerplaceId - the place object id of the newly occupied scene.config - metadata related to the newly occupied scene.model - a fresh copy of the most recent scene data for the newly occupied scene.public void moveRequiresServerSwitch(String hostname, int[] ports)
SceneService.SceneMoveListenermoveRequiresServerSwitch in interface SceneService.SceneMoveListenerpublic void requestFailed(String reason)
requestFailed in interface com.threerings.presents.client.InvocationService.InvocationListenerpublic void updateReceived(SceneUpdate update)
public void didLeaveScene()
public void setMoveHandler(SceneDirector.MoveHandler handler)
recoverFailedMove(int).public void forcedMove(int sceneId)
SceneReceiverSceneService.moveTo(int, int, com.threerings.whirled.client.SceneService.SceneMoveListener) request to move to the new scene.forcedMove in interface SceneReceiverpublic void recoverFailedMove(int placeId)
recoverFailedMove in interface com.threerings.crowd.client.LocationDirector.FailureHandlerpublic void clientDidLogoff(com.threerings.presents.client.Client client)
clientDidLogoff in interface com.threerings.presents.client.SessionObserverclientDidLogoff in class com.threerings.presents.client.BasicDirectorpublic void cancelMoveRequest()
public void addPendingForcedMove(Runnable move)
Copyright © 2015. All rights reserved.