public class CharacterManager extends Object implements DirectionCodes
CARDINAL_DIRECTIONS, CCW, CW, DIRECTION_COUNT, DOWN, EAST, EASTNORTHEAST, EASTSOUTHEAST, FINE_DIRECTION_COUNT, HORIZONTAL, LEFT, NONE, NORTH, NORTHEAST, NORTHNORTHEAST, NORTHNORTHWEST, NORTHWEST, RIGHT, SOUTH, SOUTHEAST, SOUTHSOUTHEAST, SOUTHSOUTHWEST, SOUTHWEST, UP, VERTICAL, WEST, WESTNORTHWEST, WESTSOUTHWEST| Constructor and Description |
|---|
CharacterManager(ImageManager imgr,
ComponentRepository crepo)
Constructs the character manager.
|
| Modifier and Type | Method and Description |
|---|---|
ActionFrames |
getActionFrames(CharacterDescriptor descrip,
String action)
Obtains the composited animation frames for the specified action for a
character with the specified descriptor.
|
ActionSequence |
getActionSequence(String action)
Returns the action sequence instance with the specified name or
null if no such sequence exists.
|
CharacterSprite |
getCharacter(CharacterDescriptor desc)
Returns a
CharacterSprite representing the character
described by the given CharacterDescriptor, or
null if an error occurs. |
<T extends CharacterSprite> |
getCharacter(CharacterDescriptor desc,
Class<T> charClass)
Returns a
CharacterSprite representing the character
described by the given CharacterDescriptor, or
null if an error occurs. |
ComponentRepository |
getComponentRepository()
Returns the component repository being used by this manager.
|
void |
resolveActionSequence(CharacterDescriptor desc,
String action)
Informs the character manager that the action sequence for the
given character descriptor is likely to be needed in the near
future and so any efforts that can be made to load it into the
action sequence cache in advance should be undertaken.
|
void |
setActionCache(ActionCache cache)
Instructs the character manager to use the provided cache for
composited action animations.
|
static void |
setCacheSize(int cacheKilobytes)
Sets the size of the cache used for composited animation frames.
|
void |
setCharacterClass(Class<? extends CharacterSprite> charClass)
Instructs the character manager to construct instances of this
derived class of
CharacterSprite when creating new sprites. |
public CharacterManager(ImageManager imgr, ComponentRepository crepo)
public static void setCacheSize(int cacheKilobytes)
public ComponentRepository getComponentRepository()
public void setCharacterClass(Class<? extends CharacterSprite> charClass)
CharacterSprite when creating new sprites.IllegalArgumentException - thrown if the supplied class
does not derive from CharacterSprite.public void setActionCache(ActionCache cache)
public CharacterSprite getCharacter(CharacterDescriptor desc)
CharacterSprite representing the character
described by the given CharacterDescriptor, or
null if an error occurs.desc - the character descriptor.public <T extends CharacterSprite> T getCharacter(CharacterDescriptor desc, Class<T> charClass)
CharacterSprite representing the character
described by the given CharacterDescriptor, or
null if an error occurs.desc - the character descriptor.charClass - the CharacterSprite derived class that
should be instantiated instead of the configured default (which is
set via setCharacterClass(java.lang.Class<? extends com.threerings.cast.CharacterSprite>)).public ActionFrames getActionFrames(CharacterDescriptor descrip, String action) throws NoSuchComponentException
NoSuchComponentException - thrown if any of the components in
the supplied descriptor do not exist.IllegalArgumentException - thrown if any of the components
referenced in the descriptor do not support the specified action.public void resolveActionSequence(CharacterDescriptor desc, String action)
This will eventually be revamped to spiffily load action sequences in the background.
public ActionSequence getActionSequence(String action)
Copyright © 2015. All rights reserved.