Created XMLUtil to centralize our XML machinations and allow for

code-sharing between the tileset and scene XML antics.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@87 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Walter Korman
2001-07-20 08:08:59 +00:00
parent 758b9667e4
commit 3e82036691
6 changed files with 105 additions and 21 deletions
@@ -1,8 +1,15 @@
//
// $Id: CompiledSceneManager.java,v 1.3 2001/07/18 21:45:42 shaper Exp $
// $Id: CompiledSceneManager.java,v 1.4 2001/07/20 08:08:59 shaper Exp $
package com.threerings.miso.scene;
import java.io.InputStream;
import java.io.IOException;
public class CompiledSceneManager extends SceneManagerImpl
{
public void loadScenes (InputStream in) throws IOException
{
}
}
@@ -1,8 +1,15 @@
//
// $Id: EditableSceneManager.java,v 1.3 2001/07/18 21:45:42 shaper Exp $
// $Id: EditableSceneManager.java,v 1.4 2001/07/20 08:08:59 shaper Exp $
package com.threerings.miso.scene;
import java.io.InputStream;
import java.io.IOException;
public class EditableSceneManager extends SceneManagerImpl
{
public void loadScenes (InputStream in) throws IOException
{
}
}
@@ -1,8 +1,11 @@
//
// $Id: SceneManager.java,v 1.3 2001/07/18 21:45:42 shaper Exp $
// $Id: SceneManager.java,v 1.4 2001/07/20 08:08:59 shaper Exp $
package com.threerings.miso.scene;
import java.io.IOException;
import java.io.InputStream;
/**
* Manages the various scenes that are displayed during the game and
* provides simplified retrieval and caching facilities.
@@ -19,4 +22,16 @@ public interface SceneManager
* layer id.
*/
public String[] getLayerNames ();
/**
* Load all scene objects described in the specified file into the
* set of available scenes.
*/
public void loadScenes (String fname);
/**
* Load all scene objects described in the specified input stream
* into the set of available scenes.
*/
public void loadScenes (InputStream in) throws IOException;
}
@@ -1,8 +1,15 @@
//
// $Id: SceneManagerImpl.java,v 1.3 2001/07/18 21:45:42 shaper Exp $
// $Id: SceneManagerImpl.java,v 1.4 2001/07/20 08:08:59 shaper Exp $
package com.threerings.miso.scene;
import com.threerings.miso.Log;
import com.samskivert.util.ConfigUtil;
import java.io.IOException;
import java.io.InputStream;
public abstract class SceneManagerImpl implements SceneManager
{
public Scene getScene (int sid)
@@ -15,4 +22,21 @@ public abstract class SceneManagerImpl implements SceneManager
{
return Scene.XLATE_LAYERS;
}
public void loadScenes (String fname)
{
try {
InputStream tis = ConfigUtil.getStream(fname);
if (tis == null) {
Log.warning("Couldn't find file [fname=" + fname + "].");
return;
}
loadScenes(tis);
} catch (IOException ioe) {
Log.warning("Exception loading tileset [fname=" + fname +
", ioe=" + ioe + "].");
}
}
}