Create a way to find out what the resource path is for the component & action in question.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@517 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2008-05-30 03:17:24 +00:00
parent 3839762bc8
commit c2561037f0
3 changed files with 31 additions and 0 deletions
@@ -70,6 +70,18 @@ public class CharacterComponent implements Serializable
return _frameProvider.getFrames(this, action, type);
}
/**
* Returns the path to the image frames for the specified action animation or null if
* no animation for the specified action is available for this component.
*
* @param type null for the normal action frames or one of the custom
* action sub-types: {@link StandardActions#SHADOW_TYPE}, etc.
*/
public String getFramePath (String action, String type)
{
return _frameProvider.getFramePath(this, action, type);
}
/**
* Returns true if this component is equal to the other component. The
* comparison is made on <code>componentId</code>.
@@ -34,4 +34,12 @@ public interface FrameProvider
*/
public ActionFrames getFrames (
CharacterComponent component, String action, String type);
/**
* Returns the file path of the animation frames (in the eight sprite directions) for
* the specified action of the specified component. May return null if
* the specified action does not exist for the specified component.
*/
public String getFramePath (
CharacterComponent component, String action, String type);
}
@@ -350,6 +350,17 @@ public class BundledComponentRepository
}
}
// from interface FrameProvider
public String getFramePath (CharacterComponent component, String action, String type)
{
String imgpath = action;
if (type != null) {
imgpath += "_" + type;
}
String root = component.componentClass.name + "/" + component.name + "/";
return _bundle.getIdent() + root + imgpath + BundleUtil.IMAGE_EXTENSION;
}
@Override // from IMImageProvider
public Mirage getTileImage (String path, Rectangle bounds, Colorization[] zations)
{