|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.crowd.server.PlaceManager
com.threerings.whirled.server.SceneManager
com.threerings.whirled.spot.server.SpotSceneManager
com.threerings.stage.server.StageSceneManager
public class StageSceneManager
Defines extensions to the basic Stage scene manager specific to displaying isometric "stage" scenes (these may be indoor, outdoor or aboard a vessel).
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.whirled.spot.server.SpotSceneManager |
|---|
SpotSceneManager.ClusterRecord |
| Nested classes/interfaces inherited from class com.threerings.crowd.server.PlaceManager |
|---|
PlaceManager.DelegateOp, PlaceManager.MessageHandler |
| Field Summary | |
|---|---|
protected ArrayList<Rectangle> |
_footprints
Rectangles describing the footprints (in tile coordinates) of all of our scene objects. |
protected HashIntMap<Rectangle> |
_loners
Rectangles containing a "footprint" for the users that aren't in any clusters. |
protected StageMisoSceneModel |
_mmodel
Our miso scene data extracted for convenience and efficiency. |
protected HashSet<Point> |
_plocs
Contains the (tile) coordinates of all of our portals. |
protected StageScene |
_sscene
A casted reference to our scene data. |
protected StageSceneObject |
_ssobj
A casted reference to our scene object. |
protected static int[] |
PORTAL_DX
Used by computeEnteringLocation(BodyObject,Portal,int). |
protected static int[] |
PORTAL_DY
Used by computeEnteringLocation(BodyObject,Portal,int). |
protected static int[] |
TARGET_SIZE
The dimensions of a cluster with the specified number of occupants. |
protected static int[] |
X_OFF
Used by canAddBody(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject). |
protected static int[] |
Y_OFF
Used by canAddBody(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject). |
| Fields inherited from class com.threerings.whirled.spot.server.SpotSceneManager |
|---|
_clusters, _enterers |
| Fields inherited from class com.threerings.whirled.server.SceneManager |
|---|
_invoker, _scene, _screg, _updates |
| Fields inherited from class com.threerings.crowd.server.PlaceManager |
|---|
_bodyUpdater, _config, _deathListener, _delegates, _dispatcher, _dispatcherFinders, _injector, _invmgr, _locator, _marshallers, _msghandlers, _occInfo, _occListener, _omgr, _plobj, _registry, _shutdownInterval |
| 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 | |
|---|---|
StageSceneManager()
|
|
| Method Summary | |
|---|---|
void |
addObject(ClientObject caller,
com.threerings.miso.data.ObjectInfo info,
InvocationService.ConfirmListener listener)
Handles a StageSceneService.addObject(com.threerings.miso.data.ObjectInfo, com.threerings.presents.client.InvocationService.ConfirmListener) request. |
boolean |
addObject(com.threerings.miso.data.ObjectInfo info,
boolean killOverlap,
boolean allowOverlap)
Adds the supplied object to this scene. |
protected void |
bodyAdded(SpotSceneManager.ClusterRecord clrec,
BodyObject body)
Called when a user is added to a cluster. |
protected void |
bodyLeft(int bodyOid)
|
protected void |
bodyRemoved(SpotSceneManager.ClusterRecord clrec,
BodyObject body)
Called when a user is removed from a cluster. |
protected boolean |
canAddBody(SpotSceneManager.ClusterRecord clrec,
BodyObject body)
Verifies that the specified cluster can be expanded to include another body. |
protected void |
checkCanCluster(BodyObject initiator,
BodyObject target)
Gives derived classes an opportunity to veto a user's attempt to start a cluster with another user. |
protected boolean |
checkContains(Iterable<? extends Rectangle> rects,
int tx,
int ty)
Helper function for validateLocation(BodyObject,StageLocation,boolean). |
protected boolean |
checkEntry(com.threerings.miso.util.MisoSceneMetrics metrics,
BodyObject body,
int tx,
int ty,
StageLocation loc)
Helper function for computeEnteringLocation(BodyObject,Portal,int). |
protected boolean |
checkIntersects(Iterable<? extends Rectangle> rects,
Rectangle rect,
Rectangle ignore)
Helper function for canAddBody(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject). |
protected boolean |
checkPortals(Rectangle rect)
Helper function for canAddBody(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject). |
protected boolean |
checkViolatesPassability(Rectangle rect)
Helper function for canAddBody(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject). |
protected SceneLocation |
computeEnteringLocation(BodyObject body,
Portal entry,
int minDistance)
Returns an entering location for body somewhere at least minDistance tiles away from entry. |
protected SceneLocation |
computeEnteringLocation(BodyObject body,
Portal from,
Portal entry)
Called when the supplied body is entering our scene via the specified portal. |
protected SceneLocation |
computeEnteringLocation(BodyObject body,
StageLocation base,
int minDistance)
Returns an entering location for body somewhere at least minDistance tiles away from base. |
protected void |
computeFootprints()
Computes the footprints of all objects and portals in this scene. |
protected PlaceObject |
createPlaceObject()
|
protected void |
didStartup()
We're fully ready to go, so now we register ourselves with the scene registry which will make us available to the clients and system at large. |
com.threerings.media.util.AStarPathUtil.TraversalPred |
getCanStandPred()
Returns a traversal predicate for use with StageSceneUtil.findStandingSpot(java.awt.Rectangle, int, com.threerings.media.util.AStarPathUtil.TraversalPred, java.lang.Object, java.awt.Point, int) that
validates whether a player can stand in the searched spots. |
protected static SceneLocation |
getClosestLoc(List<SceneLocation> locs,
SceneLocation optimalLocation)
Locates and removes the location in the list closest to the supplied location. |
protected void |
gotSceneData(Object extras)
A method that can be overridden by derived classes to perform initialization processing after we receive our scene information but before we're started up (and hence registered as an active place). |
boolean |
isPassable(int tx,
int ty)
Returns true if the specified tile coordinate is passable (the base tile is passable and it is not in the footprint of an object). |
boolean |
mayStandAtLocation(BodyObject source,
StageLocation loc)
Called by NPPs to determine whether or not they can stand at the specified location. |
protected void |
positionBody(Cluster cl,
int bodyOid,
List<SceneLocation> locs)
Helper function for bodyAdded(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject). |
protected void |
recordUpdate(SceneUpdate update,
boolean tilesModified)
Applies the supplied scene update to our runtime scene and then fires off an invocation unit to apply the update to the scene database. |
void |
removeObjects(ClientObject caller,
com.threerings.miso.data.ObjectInfo[] info,
InvocationService.ConfirmListener listener)
Handles a StageSceneService.removeObjects(com.threerings.miso.data.ObjectInfo[], com.threerings.presents.client.InvocationService.ConfirmListener) request. |
protected void |
sceneTilesModified()
Called when any change is made to a scene's base or object tiles (resulting in a change in the way the scene looks). |
void |
setColor(int classId,
int colorId)
Changes the default colorization for the specified color class. |
protected void |
updateLocation(BodyObject source,
Location loc)
Updates the location of the specified body. |
protected boolean |
validateLocation(BodyObject source,
Location loc)
Derived classes can override this method and validate that the specified body can stand in the requested location. |
protected boolean |
validateLocation(BodyObject source,
StageLocation loc,
boolean allowPortals)
Helper function for mayStandAtLocation(com.threerings.crowd.data.BodyObject, com.threerings.stage.data.StageLocation) and validateLocation(BodyObject,Location). |
| Methods inherited from class com.threerings.whirled.spot.server.SpotSceneManager |
|---|
addOccupantInfo, assignStartingLocation, clearEnteringBody, createClusterRecord, getCluster, handleChangeLoc, handleClusterMessageRequest, handleClusterSpeakRequest, handleJoinCluster, locationForBody, mapEnteringBody, mayTraversePortal, moveBodyToDefaultPortal, moveToDefaultPortal, removeFromCluster, willTraversePortal |
| Methods inherited from class com.threerings.whirled.server.SceneManager |
|---|
didShutdown, getLocation, getScene, getUpdates, isPersistent, recordUpdate, setSceneData, toString, where |
| Methods inherited from class com.threerings.crowd.server.PlaceManager |
|---|
addDelegate, addDispatcher, addProvider, applyToDelegates, applyToOccupants, bodyEntered, bodyUpdated, bodyWillEnter, bodyWillLeave, cancelShutdowner, checkPermissions, checkShutdownInterval, createSpeakHandler, didInit, getAccessController, getConfig, getPlaceObject, getPlaceObjectClass, idleUnloadPeriod, init, isValidSpeaker, messageReceived, permissionsFailed, placeBecameEmpty, ratifyBodyEntry, registerMessageHandler, shouldCreateSpeakService, shouldDeclareEmpty, shutdown, startup, toString, updateOccupantInfo |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected StageSceneObject _ssobj
protected StageScene _sscene
protected StageMisoSceneModel _mmodel
protected ArrayList<Rectangle> _footprints
protected HashIntMap<Rectangle> _loners
protected HashSet<Point> _plocs
protected static final int[] TARGET_SIZE
protected static final int[] X_OFF
canAddBody(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject).
protected static final int[] Y_OFF
canAddBody(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject).
protected static final int[] PORTAL_DX
computeEnteringLocation(BodyObject,Portal,int).
protected static final int[] PORTAL_DY
computeEnteringLocation(BodyObject,Portal,int).
| Constructor Detail |
|---|
public StageSceneManager()
| Method Detail |
|---|
public com.threerings.media.util.AStarPathUtil.TraversalPred getCanStandPred()
StageSceneUtil.findStandingSpot(java.awt.Rectangle, int, com.threerings.media.util.AStarPathUtil.TraversalPred, java.lang.Object, java.awt.Point, int) that
validates whether a player can stand in the searched spots.
public boolean addObject(com.threerings.miso.data.ObjectInfo info,
boolean killOverlap,
boolean allowOverlap)
killOverlap - if true, overlapping object will be removed, and the allowOverlap
argument will be ignored.allowOverlap - if true, overlapping objects will be allowed but one must be *very*
careful to ensure that they know what they are doing (i.e. the objects have render priorities
that correctly handle the overlap).
public void setColor(int classId,
int colorId)
public boolean isPassable(int tx,
int ty)
public boolean mayStandAtLocation(BodyObject source,
StageLocation loc)
public void addObject(ClientObject caller,
com.threerings.miso.data.ObjectInfo info,
InvocationService.ConfirmListener listener)
throws InvocationException
StageSceneProviderStageSceneService.addObject(com.threerings.miso.data.ObjectInfo, com.threerings.presents.client.InvocationService.ConfirmListener) request.
addObject in interface StageSceneProviderInvocationException
public void removeObjects(ClientObject caller,
com.threerings.miso.data.ObjectInfo[] info,
InvocationService.ConfirmListener listener)
throws InvocationException
StageSceneProviderStageSceneService.removeObjects(com.threerings.miso.data.ObjectInfo[], com.threerings.presents.client.InvocationService.ConfirmListener) request.
removeObjects in interface StageSceneProviderInvocationExceptionprotected void gotSceneData(Object extras)
SceneManager
gotSceneData in class SpotSceneManagerextras - optional additional information supplied by the repository when the scene was
loaded, or null if the repository provided no extras.
protected void recordUpdate(SceneUpdate update,
boolean tilesModified)
protected void sceneTilesModified()
protected void didStartup()
SceneManager
didStartup in class SpotSceneManagerprotected PlaceObject createPlaceObject()
createPlaceObject in class PlaceManagerprotected void bodyLeft(int bodyOid)
bodyLeft in class SpotSceneManager
protected void updateLocation(BodyObject source,
Location loc)
SpotSceneManager
updateLocation in class SpotSceneManagerprotected void computeFootprints()
protected boolean validateLocation(BodyObject source,
StageLocation loc,
boolean allowPortals)
mayStandAtLocation(com.threerings.crowd.data.BodyObject, com.threerings.stage.data.StageLocation) and validateLocation(BodyObject,Location).
protected boolean checkContains(Iterable<? extends Rectangle> rects,
int tx,
int ty)
validateLocation(BodyObject,StageLocation,boolean).
protected SceneLocation computeEnteringLocation(BodyObject body,
Portal from,
Portal entry)
SpotSceneManager
computeEnteringLocation in class SpotSceneManagerfrom - the portal the body followed to get to this scene (or null).entry - the portal referenced by the from portal's targetPortalId or the scene's
default entrance if the from portal did not exist or had no target portal.
protected SceneLocation computeEnteringLocation(BodyObject body,
Portal entry,
int minDistance)
protected SceneLocation computeEnteringLocation(BodyObject body,
StageLocation base,
int minDistance)
protected boolean checkEntry(com.threerings.miso.util.MisoSceneMetrics metrics,
BodyObject body,
int tx,
int ty,
StageLocation loc)
computeEnteringLocation(BodyObject,Portal,int).
protected boolean validateLocation(BodyObject source,
Location loc)
SpotSceneManagertrue in all
circumstances; stand where ye may!
validateLocation in class SpotSceneManager
protected boolean canAddBody(SpotSceneManager.ClusterRecord clrec,
BodyObject body)
SpotSceneManager
canAddBody in class SpotSceneManager
protected boolean checkIntersects(Iterable<? extends Rectangle> rects,
Rectangle rect,
Rectangle ignore)
canAddBody(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject).
protected boolean checkPortals(Rectangle rect)
canAddBody(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject).
protected boolean checkViolatesPassability(Rectangle rect)
canAddBody(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject).
protected void bodyAdded(SpotSceneManager.ClusterRecord clrec,
BodyObject body)
SpotSceneManager
bodyAdded in class SpotSceneManager
protected void positionBody(Cluster cl,
int bodyOid,
List<SceneLocation> locs)
bodyAdded(com.threerings.whirled.spot.server.SpotSceneManager.ClusterRecord, com.threerings.crowd.data.BodyObject).
protected void bodyRemoved(SpotSceneManager.ClusterRecord clrec,
BodyObject body)
SpotSceneManager
bodyRemoved in class SpotSceneManager
protected void checkCanCluster(BodyObject initiator,
BodyObject target)
throws InvocationException
SpotSceneManagerInvocationException indicating the reason for veto.
checkCanCluster in class SpotSceneManagerInvocationException
protected static SceneLocation getClosestLoc(List<SceneLocation> locs,
SceneLocation optimalLocation)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||