com.threerings.tudey.client.sprite
Class ActorSprite

java.lang.Object
  extended by com.threerings.expr.SimpleScope
      extended by com.threerings.tudey.client.sprite.Sprite
          extended by com.threerings.tudey.client.sprite.ActorSprite
All Implemented Interfaces:
ConfigUpdateListener<ActorConfig>, Scope, ScopeUpdateListener, TudeySceneView.TickParticipant, HasActor

public class ActorSprite
extends Sprite
implements TudeySceneView.TickParticipant, ConfigUpdateListener<ActorConfig>, HasActor

Represents an active element of the scene.


Nested Class Summary
static class ActorSprite.Acting
          Depicts an active actor with activity animations.
static class ActorSprite.Implementation
          The actual sprite implementation.
static class ActorSprite.Moving
          Depicts a mobile actor with optional movement animations.
static class ActorSprite.Original
          Superclass of the original implementations.
static class ActorSprite.StatefulEntry
          Executes animations on the corresponding entry sprite.
 
Field Summary
 
Fields inherited from interface com.threerings.expr.Scope
EPOCH, NOW
 
Constructor Summary
ActorSprite(TudeyContext ctx, TudeySceneView view, int timestamp, Actor actor)
          Creates a new actor sprite.
 
Method Summary
 void attachModel(Model model)
          Attaches a model to this sprite.
 void attachScaledModel(Model model)
          Attaches a model to this sprite, setting its scale to the product of its current scale and an attachment scale specified by the implementation.
 void attachScaledModel(Model model, float baseScale)
          Attaches a model to this sprite, setting its scale to the product of the provided base scale and an attachment scale specified by the implementation.
 void clearMessages()
          Requests that the sprite clear any chat messages being displayed.
 void configUpdated(ConfigEvent<ActorConfig> event)
          Called when a configuration has been updated.
 Component createTooltipComponent(String tiptext)
          Creates a tooltip component for the sprite (will only be called if Sprite.getTooltipText() returns true).
 void detachModel(Model model)
          Detaches a model from this sprite.
 boolean dispatchEvent(Event event)
          Dispatches an event on the sprite.
 boolean displayMessage(com.threerings.crowd.chat.data.UserMessage msg, boolean alreadyDisplayed)
          Gives the sprite a chance to display a message sent by the occupant controlling the actor.
 void dispose()
          Releases the resources associated with this scope.
 Actor getActor()
          Returns a reference to the actor object.
 ActorAdvancer getAdvancer()
          Returns a reference to the advancer used to advance the state, if this is actor is controlled by the client.
 int getFloorFlags()
          Returns the sprite's floor flags.
 int getFloorMask()
          Returns the sprite's floor mask.
 ActorSprite.Implementation getImplementation()
          Returns a reference to the sprite implementation.
 Model getModel()
          Returns the model associated with the sprite (if any).
 List<Model> getModels()
          Returns a reference to all the sprites models.
 String getTooltipText()
          Returns the sprite's tooltip text, or null for none.
 float getTooltipTimeout()
          Returns the sprite's tooltip timeout, or -1 to use the default.
 String getTooltipWindowStyle()
          Returns the sprite's tooltip window style.
 boolean isClickable()
          Determines whether the sprite is clickable.
 boolean isHoverable()
          Determines whether the sprite is hoverable (for purposes of in-game user interaction).
 void occupantEntered(TudeyOccupantInfo info)
          Notes that the occupant controlling this actor has entered.
 void occupantLeft(TudeyOccupantInfo info)
          Notes that the occupant controlling this actor has left.
 void occupantUpdated(TudeyOccupantInfo oinfo, TudeyOccupantInfo ninfo)
          Notes that the occupant controlling this actor has been updated.
 void reinit(int timestamp, Actor actor)
          Reinitializes the sprite.
 void remove(int timestamp)
          Notes that the actor has been removed.
 void spawnAttachedTransientModel(ConfigReference<ModelConfig> ref)
          Gets and attaches a transient model to this sprite.
 Model spawnOffsetTransientModel(ConfigReference<ModelConfig> ref, boolean rotate)
          Spawns a transient model at a z-offset of the location of this sprite.
 Model spawnOffsetTransientModel(ConfigReference<ModelConfig> ref, boolean rotate, float offset)
          Spawns a transient model at a z-offset of the location of this sprite.
 Model spawnTransientModel(ConfigReference<ModelConfig> ref)
          Spawns a transient model at the location (translation and rotation) of this sprite.
 Model spawnTransientModel(ConfigReference<ModelConfig> ref, boolean rotate)
          Spawns a transient model at the location of this sprite.
 boolean tick(int delayedTime)
          Ticks the participant.
 void update(int timestamp, Actor actor)
          Updates this sprite with new state.
 
Methods inherited from class com.threerings.tudey.client.sprite.Sprite
getScopeName, setVisible
 
Methods inherited from class com.threerings.expr.SimpleScope
addListener, get, getParentScope, removeListener, scopeUpdated
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActorSprite

public ActorSprite(TudeyContext ctx,
                   TudeySceneView view,
                   int timestamp,
                   Actor actor)
Creates a new actor sprite.

Method Detail

reinit

public void reinit(int timestamp,
                   Actor actor)
Reinitializes the sprite.


getAdvancer

public ActorAdvancer getAdvancer()
Returns a reference to the advancer used to advance the state, if this is actor is controlled by the client.


getModels

public List<Model> getModels()
Returns a reference to all the sprites models.


getImplementation

public ActorSprite.Implementation getImplementation()
Returns a reference to the sprite implementation.


attachScaledModel

public void attachScaledModel(Model model)
Attaches a model to this sprite, setting its scale to the product of its current scale and an attachment scale specified by the implementation.


attachScaledModel

public void attachScaledModel(Model model,
                              float baseScale)
Attaches a model to this sprite, setting its scale to the product of the provided base scale and an attachment scale specified by the implementation.


attachModel

public void attachModel(Model model)
Attaches a model to this sprite.


detachModel

public void detachModel(Model model)
Detaches a model from this sprite.


spawnAttachedTransientModel

public void spawnAttachedTransientModel(ConfigReference<ModelConfig> ref)
Gets and attaches a transient model to this sprite.


spawnTransientModel

public Model spawnTransientModel(ConfigReference<ModelConfig> ref)
Spawns a transient model at the location (translation and rotation) of this sprite.


spawnTransientModel

public Model spawnTransientModel(ConfigReference<ModelConfig> ref,
                                 boolean rotate)
Spawns a transient model at the location of this sprite.

Parameters:
rotate - if true, match the rotation as well as the translation of the sprite.

spawnOffsetTransientModel

public Model spawnOffsetTransientModel(ConfigReference<ModelConfig> ref,
                                       boolean rotate)
Spawns a transient model at a z-offset of the location of this sprite.

Parameters:
rotate - if true, match the rotation as well as the translation of the sprite.

update

public void update(int timestamp,
                   Actor actor)
Updates this sprite with new state.


remove

public void remove(int timestamp)
Notes that the actor has been removed.


occupantEntered

public void occupantEntered(TudeyOccupantInfo info)
Notes that the occupant controlling this actor has entered.


occupantLeft

public void occupantLeft(TudeyOccupantInfo info)
Notes that the occupant controlling this actor has left.


occupantUpdated

public void occupantUpdated(TudeyOccupantInfo oinfo,
                            TudeyOccupantInfo ninfo)
Notes that the occupant controlling this actor has been updated.


displayMessage

public boolean displayMessage(com.threerings.crowd.chat.data.UserMessage msg,
                              boolean alreadyDisplayed)
Gives the sprite a chance to display a message sent by the occupant controlling the actor.

Returns:
true if the sprite displayed the message.

clearMessages

public void clearMessages()
Requests that the sprite clear any chat messages being displayed.


tick

public boolean tick(int delayedTime)
Description copied from interface: TudeySceneView.TickParticipant
Ticks the participant.

Specified by:
tick in interface TudeySceneView.TickParticipant
Parameters:
delayedTime - the current delayed client time.
Returns:
true to continue ticking the participant, false to remove it from the list.

configUpdated

public void configUpdated(ConfigEvent<ActorConfig> event)
Description copied from interface: ConfigUpdateListener
Called when a configuration has been updated.

Specified by:
configUpdated in interface ConfigUpdateListener<ActorConfig>

getActor

public Actor getActor()
Description copied from interface: HasActor
Returns a reference to the actor object.

Specified by:
getActor in interface HasActor

getModel

public Model getModel()
Description copied from class: Sprite
Returns the model associated with the sprite (if any).

Overrides:
getModel in class Sprite

getFloorFlags

public int getFloorFlags()
Description copied from class: Sprite
Returns the sprite's floor flags.

Overrides:
getFloorFlags in class Sprite

getFloorMask

public int getFloorMask()
Description copied from class: Sprite
Returns the sprite's floor mask.

Overrides:
getFloorMask in class Sprite

isHoverable

public boolean isHoverable()
Description copied from class: Sprite
Determines whether the sprite is hoverable (for purposes of in-game user interaction).

Overrides:
isHoverable in class Sprite

isClickable

public boolean isClickable()
Description copied from class: Sprite
Determines whether the sprite is clickable.

Overrides:
isClickable in class Sprite

getTooltipText

public String getTooltipText()
Description copied from class: Sprite
Returns the sprite's tooltip text, or null for none.

Overrides:
getTooltipText in class Sprite

getTooltipTimeout

public float getTooltipTimeout()
Description copied from class: Sprite
Returns the sprite's tooltip timeout, or -1 to use the default.

Overrides:
getTooltipTimeout in class Sprite

getTooltipWindowStyle

public String getTooltipWindowStyle()
Description copied from class: Sprite
Returns the sprite's tooltip window style.

Overrides:
getTooltipWindowStyle in class Sprite

createTooltipComponent

public Component createTooltipComponent(String tiptext)
Description copied from class: Sprite
Creates a tooltip component for the sprite (will only be called if Sprite.getTooltipText() returns true).

Overrides:
createTooltipComponent in class Sprite

dispatchEvent

public boolean dispatchEvent(Event event)
Description copied from class: Sprite
Dispatches an event on the sprite.

Overrides:
dispatchEvent in class Sprite
Returns:
true if the sprite handled the event, false if it should be handled elsewhere.

dispose

public void dispose()
Description copied from class: SimpleScope
Releases the resources associated with this scope.

Overrides:
dispose in class SimpleScope

spawnOffsetTransientModel

public Model spawnOffsetTransientModel(ConfigReference<ModelConfig> ref,
                                       boolean rotate,
                                       float offset)
Spawns a transient model at a z-offset of the location of this sprite.

Parameters:
rotate - if true, match the rotation as well as the translation of the sprite.


Copyright © 2011. All Rights Reserved.