Split out the creation of the file & network resource bundles so that subclasses can potentially create their own extensions to these.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@515 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -720,19 +720,37 @@ public class ResourceManager
|
|||||||
List<ResourceBundle> dlist)
|
List<ResourceBundle> dlist)
|
||||||
{
|
{
|
||||||
if (setType.equals(FILE_SET_TYPE)) {
|
if (setType.equals(FILE_SET_TYPE)) {
|
||||||
FileResourceBundle bundle = new FileResourceBundle(getResourceFile(path), true,
|
FileResourceBundle bundle =
|
||||||
_unpack);
|
createFileResourceBundle(getResourceFile(path), true, _unpack);
|
||||||
if (!bundle.isUnpacked() || !bundle.sourceIsReady()) {
|
if (!bundle.isUnpacked() || !bundle.sourceIsReady()) {
|
||||||
dlist.add(bundle);
|
dlist.add(bundle);
|
||||||
}
|
}
|
||||||
return bundle;
|
return bundle;
|
||||||
} else if (setType.equals(NETWORK_SET_TYPE)) {
|
} else if (setType.equals(NETWORK_SET_TYPE)) {
|
||||||
return new NetworkResourceBundle(_networkRootPath, path, getResourceList());
|
return createNetworkResourceBundle(_networkRootPath, path, getResourceList());
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Unknown set type: " + setType);
|
throw new IllegalArgumentException("Unknown set type: " + setType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an appropriate bundle for fetching resources from files.
|
||||||
|
*/
|
||||||
|
protected FileResourceBundle createFileResourceBundle(
|
||||||
|
File source, boolean delay, boolean unpack)
|
||||||
|
{
|
||||||
|
return new FileResourceBundle(source, delay, unpack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an appropriate bundle for fetching resources from the network.
|
||||||
|
*/
|
||||||
|
protected NetworkResourceBundle createNetworkResourceBundle(
|
||||||
|
String root, String path, HashSet<String> rsrcList)
|
||||||
|
{
|
||||||
|
return new NetworkResourceBundle(root, path, rsrcList);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads an image from the supplied file. Supports {@link FastImageIO} files and formats
|
* Loads an image from the supplied file. Supports {@link FastImageIO} files and formats
|
||||||
* supported by {@link ImageIO} and will load the appropriate one based on the useFastIO param.
|
* supported by {@link ImageIO} and will load the appropriate one based on the useFastIO param.
|
||||||
|
|||||||
Reference in New Issue
Block a user