Added support for falling back to a "default" action image for components
that do not have an image specificly for a particular action sequence. In the future, I'd like to at least provide a mechanism for specifying on a per action sequence basis which action sequence to fall back to in the event that a component is missing imagery for that sequence. Then the default mecahism could be used without forcing all action sequences for a particular class of components to be exactly alike. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1614 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ActionSequence.java,v 1.4 2002/06/26 23:53:06 mdb Exp $
|
||||
// $Id: ActionSequence.java,v 1.5 2002/07/24 22:24:05 mdb Exp $
|
||||
|
||||
package com.threerings.cast;
|
||||
|
||||
@@ -15,6 +15,16 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class ActionSequence implements Serializable
|
||||
{
|
||||
/**
|
||||
* Defines the name of the default action sequence. When component
|
||||
* tilesets are loaded to build a set of composited images for a
|
||||
* particular action sequence, a check is first made for a component
|
||||
* tileset specific to the action sequence and then for the
|
||||
* component's default tileset if the action specific tileset did not
|
||||
* exist.
|
||||
*/
|
||||
public static final String DEFAULT_SEQUENCE = "default";
|
||||
|
||||
/** The action sequence name. */
|
||||
public String name;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: BundledComponentRepository.java,v 1.15 2002/06/26 23:53:06 mdb Exp $
|
||||
// $Id: BundledComponentRepository.java,v 1.16 2002/07/24 22:24:05 mdb Exp $
|
||||
|
||||
package com.threerings.cast.bundle;
|
||||
|
||||
@@ -263,11 +263,6 @@ public class BundledComponentRepository
|
||||
public ActionFrames getFrames (
|
||||
CharacterComponent component, String action)
|
||||
{
|
||||
// load up the tileset for this action
|
||||
String path = component.componentClass.name + "/" +
|
||||
component.name + "/" + action +
|
||||
BundleUtil.TILESET_EXTENSION;
|
||||
|
||||
// obtain the action sequence definition for this action
|
||||
ActionSequence actseq = (ActionSequence)_actions.get(action);
|
||||
if (actseq == null) {
|
||||
@@ -277,8 +272,21 @@ public class BundledComponentRepository
|
||||
return null;
|
||||
}
|
||||
|
||||
// first try loading up a tileset customized for this action
|
||||
String root = component.componentClass.name + "/" +
|
||||
component.name + "/";
|
||||
String path = root + action + BundleUtil.TILESET_EXTENSION;
|
||||
|
||||
try {
|
||||
TileSet aset = (TileSet)BundleUtil.loadObject(_bundle, path);
|
||||
TileSet aset = null;
|
||||
aset = (TileSet)BundleUtil.loadObject(_bundle, path);
|
||||
if (aset == null) {
|
||||
Log.info("Falling back to default [path=" + path + "].");
|
||||
// try loading the default tileset
|
||||
path = root + ActionSequence.DEFAULT_SEQUENCE +
|
||||
BundleUtil.TILESET_EXTENSION;
|
||||
aset = (TileSet)BundleUtil.loadObject(_bundle, path);
|
||||
}
|
||||
aset.setImageProvider(this);
|
||||
return new TileSetFrameImage(aset, actseq);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user