|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.presents.client.BasicDirector
com.threerings.crowd.client.OccupantDirector
public class OccupantDirector
The occupant director listens for occupants of places to enter and exit, and dispatches notices to interested parties about these events.
It will eventually provide a framework for keeping track of occupant information in a network efficient manner. The idea being that we want to store as little information about occupants as possible in the place object (probably just body oid and username), but upon entering a place, this will be all we know about the occupants. We then dispatch a request to get information about all of the occupants in the room (things like avatar information for a graphical display or perhaps their ratings in the game that is associated with a place for a gaming site) which we then pass on to the occupant observers when it becomes available.
This information would be cached and we could return cached information for occupants for which we have cached info. We will probably want to still make a request for the occupant info so that we can update non-static occupant data rather than permanently using what's in the cache.
| Field Summary | |
|---|---|
protected com.samskivert.util.ObserverList<OccupantObserver> |
_observers
The occupant observers to keep abreast of occupant antics. |
protected PlaceObject |
_place
The user's current location. |
| Fields inherited from class com.threerings.presents.client.BasicDirector |
|---|
_availableInStandalone, _ctx |
| Constructor Summary | |
|---|---|
OccupantDirector(CrowdContext ctx)
Constructs a new occupant director with the supplied context. |
|
| Method Summary | |
|---|---|
void |
addOccupantObserver(OccupantObserver obs)
Adds the specified occupant observer to the list. |
void |
clientDidLogoff(Client client)
Called after the client has been logged off of the server and has disconnected. |
void |
entryAdded(EntryAddedEvent<OccupantInfo> event)
Deals with all of the processing when an occupant shows up. |
void |
entryRemoved(EntryRemovedEvent<OccupantInfo> event)
Deals with all of the processing when an occupant leaves. |
void |
entryUpdated(EntryUpdatedEvent<OccupantInfo> event)
Deals with all of the processing when an occupant is updated. |
OccupantInfo |
getOccupantInfo(int bodyOid)
Returns the occupant info for the user in question if it exists in the currently occupied place. |
OccupantInfo |
getOccupantInfo(Name username)
Returns the occupant info for the user in question if it exists in the currently occupied place. |
void |
locationChangeFailed(int placeId,
String reason)
This is called on all location observers when a location change request is rejected by the server or fails for some other reason. |
void |
locationDidChange(PlaceObject place)
Called when we have switched to a new location. |
boolean |
locationMayChange(int placeId)
Called when someone has requested that we switch to a new location. |
void |
removeOccupantObserver(OccupantObserver obs)
Removes the specified occupant observer from the list. |
| Methods inherited from class com.threerings.presents.client.BasicDirector |
|---|
assertAvailable, clientDidLogon, clientObjectDidChange, clientObjectUpdated, clientWillLogon, fetchServices, isAvailable, isAvailableInStandalone, registerServices, setAvailableInStandalone |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected com.samskivert.util.ObserverList<OccupantObserver> _observers
protected PlaceObject _place
| Constructor Detail |
|---|
public OccupantDirector(CrowdContext ctx)
| Method Detail |
|---|
public void addOccupantObserver(OccupantObserver obs)
public void removeOccupantObserver(OccupantObserver obs)
public OccupantInfo getOccupantInfo(int bodyOid)
public OccupantInfo getOccupantInfo(Name username)
public void clientDidLogoff(Client client)
SessionObserver
clientDidLogoff in interface SessionObserverclientDidLogoff in class BasicDirectorpublic boolean locationMayChange(int placeId)
LocationObserver
locationMayChange in interface LocationObserverpublic void locationDidChange(PlaceObject place)
LocationObserver
locationDidChange in interface LocationObserverplace - the place object that represents the new location or
null if we have switched to no location.
public void locationChangeFailed(int placeId,
String reason)
LocationObserver
locationChangeFailed in interface LocationObserverplaceId - the place id to which we attempted to relocate, but
failed.reason - the reason code that explains why the location change
request was rejected or otherwise failed.public void entryAdded(EntryAddedEvent<OccupantInfo> event)
entryAdded in interface SetListener<OccupantInfo>event - The event that was dispatched on the object.public void entryUpdated(EntryUpdatedEvent<OccupantInfo> event)
entryUpdated in interface SetListener<OccupantInfo>event - The event that was dispatched on the object.public void entryRemoved(EntryRemovedEvent<OccupantInfo> event)
entryRemoved in interface SetListener<OccupantInfo>event - The event that was dispatched on the object.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||