diff --git a/src/java/com/threerings/miso/client/SceneManager.java b/src/java/com/threerings/miso/client/SceneManager.java deleted file mode 100644 index 069dbb991..000000000 --- a/src/java/com/threerings/miso/client/SceneManager.java +++ /dev/null @@ -1,57 +0,0 @@ -// -// $Id: SceneManager.java,v 1.7 2001/07/24 16:10:19 shaper Exp $ - -package com.threerings.miso.scene; - -import com.samskivert.util.IntMap; - -/** - * The SceneManager provides a single access point for retrieving and - * caching the various scenes that make up a game. - */ -public class SceneManager -{ - /** - * Initialize the SceneManager with the given scene repository. - * - * @param repo the scene repository. - */ - public SceneManager (SceneRepository repo) - { - _repo = repo; - } - - /** - * Return the Scene object for the specified scene id. - * - * @param sid the scene id. - * @return the Scene object. - */ - public Scene getScene (int sid) - { - // TBD - return null; - } - - public SceneRepository getSceneRepository () - { - return _repo; - } - - /** - * Return a String array of all scene layer names ordered by - * ascending layer id. - * - * @return the layer names. - */ - public String[] getLayerNames () - { - return Scene.XLATE_LAYERS; - } - - /** The repository used to read and write scenes. */ - protected SceneRepository _repo; - - /** The currently cached scenes. */ - protected IntMap _scenes = new IntMap(); -} diff --git a/src/java/com/threerings/miso/client/SceneRepository.java b/src/java/com/threerings/miso/client/SceneRepository.java index c1cf0bd08..adcc09396 100644 --- a/src/java/com/threerings/miso/client/SceneRepository.java +++ b/src/java/com/threerings/miso/client/SceneRepository.java @@ -1,12 +1,21 @@ // -// $Id: SceneRepository.java,v 1.1 2001/07/24 16:10:19 shaper Exp $ +// $Id: SceneRepository.java,v 1.2 2001/08/15 00:00:51 mdb Exp $ package com.threerings.miso.scene; +import java.io.IOException; + /** * The SceneRepository interface manages persistent scene storage. */ public interface SceneRepository { - // TBD + /** + * Loads and returns the scene object with the specified id. + * + * @param fname the full pathname to the file. + * + * @return the scene object. + */ + public Scene loadScene (String fname) throws IOException; } diff --git a/src/java/com/threerings/miso/util/MisoContext.java b/src/java/com/threerings/miso/util/MisoContext.java index 0029f736b..2a79862ec 100644 --- a/src/java/com/threerings/miso/util/MisoContext.java +++ b/src/java/com/threerings/miso/util/MisoContext.java @@ -1,11 +1,10 @@ // -// $Id: MisoContext.java,v 1.2 2001/07/21 01:51:10 shaper Exp $ +// $Id: MisoContext.java,v 1.3 2001/08/15 00:00:51 mdb Exp $ package com.threerings.miso.util; import com.samskivert.util.Context; import com.threerings.miso.tile.TileManager; -import com.threerings.miso.scene.SceneManager; public interface MisoContext extends Context { @@ -14,10 +13,4 @@ public interface MisoContext extends Context * for the lifetime of the application. */ public TileManager getTileManager (); - - /** - * Return a reference to the SceneManager. This reference is - * valid for the lifetime of the application. - */ - public SceneManager getSceneManager (); } diff --git a/src/java/com/threerings/miso/util/MisoUtil.java b/src/java/com/threerings/miso/util/MisoUtil.java index 4f9ac6ff0..6a41a4db7 100644 --- a/src/java/com/threerings/miso/util/MisoUtil.java +++ b/src/java/com/threerings/miso/util/MisoUtil.java @@ -1,5 +1,5 @@ // -// $Id: MisoUtil.java,v 1.5 2001/08/13 15:00:24 shaper Exp $ +// $Id: MisoUtil.java,v 1.6 2001/08/15 00:00:51 mdb Exp $ package com.threerings.miso.util; @@ -33,27 +33,26 @@ public class MisoUtil } /** - * Create a SceneManager object, reading the class - * name to instantiate from the config object. + * Create an XMLFileSceneRepository object, reading the + * name of the class to instantiate from the config object. * * @param config the Config object. * - * @return the new scene manager object or null if an error occurred. + * @return the new scene repository object or null if an error + * occurred. */ - public static SceneManager - createSceneManager (Config config, TileManager tilemgr) + public static XMLFileSceneRepository createSceneRepository ( + Config config, TileManager tilemgr) { try { - SceneRepositoryImpl scenerepo = (SceneRepositoryImpl) + XMLFileSceneRepository scenerepo = (XMLFileSceneRepository) config.instantiateValue("miso.scenerepo", DEF_SCENEREPO); scenerepo.init(config, tilemgr); - - SceneManager scenemgr = new SceneManager(scenerepo); - - return scenemgr; + return scenerepo; } catch (Exception e) { - Log.warning("Failed to instantiate scene manager [e=" + e + "]."); + Log.warning("Failed to instantiate scene repository " + + "[e=" + e + "]."); return null; } } @@ -106,8 +105,8 @@ public class MisoUtil * * @return the new tileset manager object or null if an error occurred. */ - protected static TileSetManager - createTileSetManager (Config config, ImageManager imgmgr) + protected static TileSetManager createTileSetManager ( + Config config, ImageManager imgmgr) { TileSetManagerImpl tilesetmgr = null; try { diff --git a/tests/src/java/com/threerings/miso/viewer/ViewerApp.java b/tests/src/java/com/threerings/miso/viewer/ViewerApp.java index 42d077830..d05f1854d 100644 --- a/tests/src/java/com/threerings/miso/viewer/ViewerApp.java +++ b/tests/src/java/com/threerings/miso/viewer/ViewerApp.java @@ -1,5 +1,5 @@ // -// $Id: ViewerApp.java,v 1.3 2001/08/02 00:42:02 shaper Exp $ +// $Id: ViewerApp.java,v 1.4 2001/08/15 00:00:51 mdb Exp $ package com.threerings.miso.viewer; @@ -8,8 +8,9 @@ import java.io.IOException; import com.samskivert.swing.util.SwingUtil; import com.samskivert.util.Config; + import com.threerings.miso.Log; -import com.threerings.miso.scene.SceneManager; +import com.threerings.miso.scene.SceneRepository; import com.threerings.miso.tile.TileManager; import com.threerings.miso.util.MisoUtil; import com.threerings.miso.viewer.util.ViewerContext; @@ -33,7 +34,7 @@ public class ViewerApp // create the handles on our various services _config = createConfig(); _tilemgr = MisoUtil.createTileManager(_config, _frame); - _scenemgr = MisoUtil.createSceneManager(_config, _tilemgr); + _screpo = MisoUtil.createSceneRepository(_config, _tilemgr); _ctx = new ViewerContextImpl(); // initialize the frame with the now-prepared context @@ -63,8 +64,8 @@ public class ViewerApp /** * The implementation of the ViewerContext interface that provides - * handles to the config and manager objects that offer commonly - * used services. + * handles to the config and manager objects that offer commonly used + * services. */ protected class ViewerContextImpl implements ViewerContext { @@ -73,15 +74,15 @@ public class ViewerApp return _config; } - public SceneManager getSceneManager () - { - return _scenemgr; - } - public TileManager getTileManager () { return _tilemgr; } + + public SceneRepository getSceneRepository () + { + return _screpo; + } } /** @@ -108,8 +109,8 @@ public class ViewerApp /** The config object. */ protected Config _config; - /** The scene manager object. */ - protected SceneManager _scenemgr; + /** The scene repository. */ + protected SceneRepository _screpo; /** The tile manager object. */ protected TileManager _tilemgr; diff --git a/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java b/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java index c3e53a415..a705d7f11 100644 --- a/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java +++ b/tests/src/java/com/threerings/miso/viewer/ViewerSceneViewPanel.java @@ -1,5 +1,5 @@ // -// $Id: ViewerSceneViewPanel.java,v 1.7 2001/08/14 23:35:22 mdb Exp $ +// $Id: ViewerSceneViewPanel.java,v 1.8 2001/08/15 00:00:51 mdb Exp $ package com.threerings.miso.viewer; @@ -13,7 +13,7 @@ import com.threerings.media.sprite.*; import com.threerings.miso.Log; import com.threerings.miso.scene.*; -import com.threerings.miso.scene.xml.XMLFileSceneRepository; +import com.threerings.miso.scene.SceneRepository; import com.threerings.miso.util.*; import com.threerings.miso.viewer.util.ViewerContext; @@ -49,9 +49,7 @@ public class ViewerSceneViewPanel extends SceneViewPanel */ protected void prepareStartingScene () { - // get the scene repository - XMLFileSceneRepository repo = (XMLFileSceneRepository) - _ctx.getSceneManager().getSceneRepository(); + SceneRepository screpo = _ctx.getSceneRepository(); // get the starting scene filename Config config = _ctx.getConfig(); @@ -59,7 +57,7 @@ public class ViewerSceneViewPanel extends SceneViewPanel try { // load and set up the scene - _view.setScene(repo.loadScene(fname)); + _view.setScene(screpo.loadScene(fname)); } catch (IOException ioe) { Log.warning("Exception loading scene [fname=" + fname + ", ioe=" + ioe + "]."); diff --git a/tests/src/java/com/threerings/miso/viewer/util/ViewerContext.java b/tests/src/java/com/threerings/miso/viewer/util/ViewerContext.java index 51d94c95a..645b46990 100644 --- a/tests/src/java/com/threerings/miso/viewer/util/ViewerContext.java +++ b/tests/src/java/com/threerings/miso/viewer/util/ViewerContext.java @@ -1,9 +1,11 @@ // -// $Id: ViewerContext.java,v 1.1 2001/07/25 17:38:15 shaper Exp $ +// $Id: ViewerContext.java,v 1.2 2001/08/15 00:00:52 mdb Exp $ package com.threerings.miso.viewer.util; import com.samskivert.util.Context; + +import com.threerings.miso.scene.SceneRepository; import com.threerings.miso.util.MisoContext; /** @@ -12,5 +14,8 @@ import com.threerings.miso.util.MisoContext; */ public interface ViewerContext extends MisoContext, Context { - // nothing for now. + /** + * Returns the scene repository that we can use to get scenes. + */ + public SceneRepository getSceneRepository (); }