com.threerings.whirled.spot.client
Class SpotSceneDirector

java.lang.Object
  extended by com.threerings.presents.client.BasicDirector
      extended by com.threerings.whirled.spot.client.SpotSceneDirector
All Implemented Interfaces:
com.threerings.crowd.chat.data.ChatCodes, com.threerings.crowd.data.LocationCodes, com.threerings.presents.client.SessionObserver, com.threerings.presents.data.InvocationCodes, com.threerings.presents.dobj.AttributeChangeListener, com.threerings.presents.dobj.ChangeListener, com.threerings.presents.dobj.Subscriber<com.threerings.presents.dobj.DObject>, SceneCodes, SpotCodes

public class SpotSceneDirector
extends com.threerings.presents.client.BasicDirector
implements SpotCodes, com.threerings.presents.dobj.Subscriber<com.threerings.presents.dobj.DObject>, com.threerings.presents.dobj.AttributeChangeListener

Extends the standard scene director with facilities to move between locations within a scene.


Field Summary
 
Fields inherited from interface com.threerings.whirled.spot.data.SpotCodes
CLUSTER_CHAT_TYPE, CLUSTER_FULL, INVALID_LOCATION, LOCATION_OCCUPIED, NO_SUCH_CLUSTER, NO_SUCH_PORTAL
 
Fields inherited from interface com.threerings.crowd.chat.data.ChatCodes
BROADCAST_ACCESS, BROADCAST_MODE, CHAT_ACCESS, CHAT_CHANNEL_NOTIFICATION, CHAT_NOTIFICATION, DEFAULT_IDLE_TIME, DEFAULT_MODE, EMOTE_MODE, IDLE_TIME_KEY, LAST_MODE, PLACE_CHAT_TYPE, SHOUT_MODE, SUCCESS, THINK_MODE, USER_CHAT_TYPE, USER_DISCONNECTED, USER_NOT_ONLINE, XLATE_MODES
 
Fields inherited from interface com.threerings.whirled.data.SceneCodes
SCENE_UPDATE, WHIRLED_GROUP
 
Fields inherited from interface com.threerings.crowd.data.LocationCodes
ALREADY_THERE, MOVE_IN_PROGRESS, NO_SUCH_PLACE
 
Fields inherited from interface com.threerings.presents.data.InvocationCodes
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR
 
Constructor Summary
SpotSceneDirector(WhirledContext ctx, com.threerings.crowd.client.LocationDirector locdir, SceneDirector scdir)
          Creates a new spot scene director with the specified context and which will cooperate with the supplied scene director.
 
Method Summary
 void attributeChanged(com.threerings.presents.dobj.AttributeChangedEvent event)
           
 void changeLocation(Location loc, ResultListener<Location> listener)
          Issues a request to change our location within the scene to the specified location.
 void clientDidLogoff(com.threerings.presents.client.Client client)
           
 void clientDidLogon(com.threerings.presents.client.Client client)
           
 void clientObjectDidChange(com.threerings.presents.client.Client client)
           
 Location getIntendedLocation()
          Returns our current location unless we have a location change pending, in which case our pending location is returned.
 void joinCluster(int froid, ResultListener<Void> listener)
          Issues a request to join the cluster associated with the specified user (starting one if necessary).
 void objectAvailable(com.threerings.presents.dobj.DObject object)
           
 boolean requestClusterSpeak(String message)
          Sends a chat message to the other users in the cluster to which the location that we currently occupy belongs.
 boolean requestClusterSpeak(String message, byte mode)
          Sends a chat message to the other users in the cluster to which the location that we currently occupy belongs.
 void requestFailed(int oid, com.threerings.presents.dobj.ObjectAccessException cause)
           
 void setChatDirector(com.threerings.crowd.chat.client.ChatDirector chatdir)
          Configures this spot scene director with a chat director, with which it will coordinate to implement cluster chatting.
 boolean traversePortal(int portalId)
          Requests that this client move to the location specified by the supplied portal id.
 boolean traversePortal(int portalId, ResultListener<com.threerings.crowd.data.PlaceConfig> rl)
          Requests that this client move to the location specified by the supplied portal id.
 
Methods inherited from class com.threerings.presents.client.BasicDirector
clientWillLogon, isAvailableInStandalone, setAvailableInStandalone
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpotSceneDirector

public SpotSceneDirector(WhirledContext ctx,
                         com.threerings.crowd.client.LocationDirector locdir,
                         SceneDirector scdir)
Creates a new spot scene director with the specified context and which will cooperate with the supplied scene director.

Parameters:
ctx - the active client context.
locdir - the location director with which we will be cooperating.
scdir - the scene director with which we will be cooperating.
Method Detail

setChatDirector

public void setChatDirector(com.threerings.crowd.chat.client.ChatDirector chatdir)
Configures this spot scene director with a chat director, with which it will coordinate to implement cluster chatting.


getIntendedLocation

public Location getIntendedLocation()
Returns our current location unless we have a location change pending, in which case our pending location is returned.


traversePortal

public boolean traversePortal(int portalId)
Requests that this client move to the location specified by the supplied portal id. A request will be made and when the response is received, the location observers will be notified of success or failure.

Returns:
true if the request was issued, false if it was rejected by a location observer or because we have another request outstanding.

traversePortal

public boolean traversePortal(int portalId,
                              ResultListener<com.threerings.crowd.data.PlaceConfig> rl)
Requests that this client move to the location specified by the supplied portal id. A request will be made and when the response is received, the location observers will be notified of success or failure.


changeLocation

public void changeLocation(Location loc,
                           ResultListener<Location> listener)
Issues a request to change our location within the scene to the specified location.

Parameters:
loc - the new location to which to move.
listener - will be notified of success or failure. Most client entities find out about location changes via changes to the occupant info data, but the initiator of a location change request can be notified of its success or failure, primarily so that it can act in anticipation of a successful location change (like by starting a sprite moving toward the new location), but backtrack if it finds out that the location change failed.

joinCluster

public void joinCluster(int froid,
                        ResultListener<Void> listener)
Issues a request to join the cluster associated with the specified user (starting one if necessary).

Parameters:
froid - the bodyOid of another user; the calling user will be made to join the target user's cluster.
listener - will be notified of success or failure.

requestClusterSpeak

public boolean requestClusterSpeak(String message)
Sends a chat message to the other users in the cluster to which the location that we currently occupy belongs.

Returns:
true if a cluster speak message was delivered, false if we are not in a valid cluster and refused to deliver the request.

requestClusterSpeak

public boolean requestClusterSpeak(String message,
                                   byte mode)
Sends a chat message to the other users in the cluster to which the location that we currently occupy belongs.

Returns:
true if a cluster speak message was delivered, false if we are not in a valid cluster and refused to deliver the request.

objectAvailable

public void objectAvailable(com.threerings.presents.dobj.DObject object)
Specified by:
objectAvailable in interface com.threerings.presents.dobj.Subscriber<com.threerings.presents.dobj.DObject>

requestFailed

public void requestFailed(int oid,
                          com.threerings.presents.dobj.ObjectAccessException cause)
Specified by:
requestFailed in interface com.threerings.presents.dobj.Subscriber<com.threerings.presents.dobj.DObject>

attributeChanged

public void attributeChanged(com.threerings.presents.dobj.AttributeChangedEvent event)
Specified by:
attributeChanged in interface com.threerings.presents.dobj.AttributeChangeListener

clientDidLogon

public void clientDidLogon(com.threerings.presents.client.Client client)
Specified by:
clientDidLogon in interface com.threerings.presents.client.SessionObserver
Overrides:
clientDidLogon in class com.threerings.presents.client.BasicDirector

clientObjectDidChange

public void clientObjectDidChange(com.threerings.presents.client.Client client)
Specified by:
clientObjectDidChange in interface com.threerings.presents.client.SessionObserver
Overrides:
clientObjectDidChange in class com.threerings.presents.client.BasicDirector

clientDidLogoff

public void clientDidLogoff(com.threerings.presents.client.Client client)
Specified by:
clientDidLogoff in interface com.threerings.presents.client.SessionObserver
Overrides:
clientDidLogoff in class com.threerings.presents.client.BasicDirector


Copyright © 2011. All Rights Reserved.