Load tileset descriptions from an XML file.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@57 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
//
|
||||
// $Id: CompiledTileSetManager.java,v 1.2 2001/07/16 18:59:31 shaper Exp $
|
||||
// $Id: CompiledTileSetManager.java,v 1.3 2001/07/17 17:21:33 shaper Exp $
|
||||
|
||||
package com.threerings.cocktail.miso.tile;
|
||||
|
||||
import com.samskivert.util.Config;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class CompiledTileSetManager extends TileSetManagerImpl
|
||||
{
|
||||
public CompiledTileSetManager (Config config)
|
||||
public void loadTileSets (InputStream tis) throws IOException
|
||||
{
|
||||
super(config);
|
||||
// TBD
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,41 @@
|
||||
//
|
||||
// $Id: EditableTileSetManager.java,v 1.2 2001/07/16 18:59:31 shaper Exp $
|
||||
// $Id: EditableTileSetManager.java,v 1.3 2001/07/17 17:21:33 shaper Exp $
|
||||
|
||||
package com.threerings.cocktail.miso.tile;
|
||||
|
||||
import com.samskivert.util.Config;
|
||||
import com.threerings.cocktail.miso.Log;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Extends general tileset manager functionality to allow reading
|
||||
* tileset information from XML files. The XML file format allows for
|
||||
* improved version-control, and makes tilesets easier to view, edit,
|
||||
* and re-use than might otherwise be the case.
|
||||
*/
|
||||
public class EditableTileSetManager extends TileSetManagerImpl
|
||||
{
|
||||
public EditableTileSetManager (Config config)
|
||||
public void loadTileSets (InputStream tis) throws IOException
|
||||
{
|
||||
super(config);
|
||||
// read all tileset descriptions from the XML input stream
|
||||
XMLTileSetParser parser = new XMLTileSetParser();
|
||||
parser.loadTileSets(tis);
|
||||
|
||||
// grab any resulting tileset objects
|
||||
ArrayList tsets = parser.getTileSets();
|
||||
if (tsets == null) {
|
||||
Log.warning("No tileset descriptions found [tis=" + tis + "].");
|
||||
return;
|
||||
}
|
||||
|
||||
// and copy them into the main tileset hashtable
|
||||
int size = tsets.size();
|
||||
for (int ii = 0; ii < size; ii++) {
|
||||
TileSet tset = (TileSet)tsets.get(ii);
|
||||
_tilesets.put(tset.getId(), tset);
|
||||
Log.info("Adding tileset to cache [tset=" + tset + "].");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user