Phase one of the scene refactoring (which will set the stage for all

manner of happiness and joy).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@615 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-11-12 20:56:56 +00:00
parent b1748332f5
commit d35f2894c1
27 changed files with 743 additions and 227 deletions
@@ -1,32 +1,50 @@
//
// $Id: SceneManager.java,v 1.7 2001/10/24 00:58:12 mdb Exp $
// $Id: SceneManager.java,v 1.8 2001/11/12 20:56:56 mdb Exp $
package com.threerings.whirled.server;
import com.threerings.crowd.chat.ChatMessageHandler;
import com.threerings.crowd.chat.ChatService;
import com.threerings.crowd.server.PlaceManager;
import com.threerings.whirled.data.SceneModel;
import com.threerings.whirled.data.Scene;
/**
* The scene manager extends the place manager and takes care of basic
* scene services. Presently that is little more than registering the
* scene manager with the scene registry so that the manager can be looked
* up by scene id in addition to place object id.
*/
public class SceneManager extends PlaceManager
{
/**
* Returns the scene object (not the scene distributed object)
* associated with this scene.
* Returns the runtime scene object (not the scene distributed object)
* being managed by this scene manager.
*/
public Scene getScene ()
public RuntimeScene getScene ()
{
return _scene;
}
/**
* Returns a reference to the scene model from which we created our
* runtime scene object. This model must reflect any modifications
* this manager may have made to it in the course of managing the
* scene as it will be provided to the client as the definitive
* version of the scene. (The scene manager is responsible for writing
* changes made to the scene model back to the scene repository.)
*/
public SceneModel getSceneModel ()
{
return _model;
}
/**
* Called by the scene registry once the scene manager has been
* created (and initialized), but before it is started up.
*/
protected void postInit (Scene scene, SceneRegistry screg)
protected void postInit (
RuntimeScene scene, SceneModel model, SceneRegistry screg)
{
_scene = scene;
_model = model;
_screg = screg;
}
@@ -41,11 +59,6 @@ public class SceneManager extends PlaceManager
// let the scene registry know that we're up and running
_screg.sceneManagerDidStart(this);
// register a chat message handler because we want to support
// chatting
MessageHandler handler = new ChatMessageHandler();
registerMessageHandler(ChatService.SPEAK_REQUEST, handler);
}
/**
@@ -66,6 +79,17 @@ public class SceneManager extends PlaceManager
buf.append(", scene=").append(_scene);
}
protected Scene _scene;
/** A reference to our runtime scene implementation which provides a
* meaningful interpretation of the data in the scene model. */
protected RuntimeScene _scene;
/** A reference to the scene model which we keep around because we may
* have to send it to clients that need updated versions of the model
* or to update the scene model in the repository if we modify the
* scene for some reason. */
protected SceneModel _model;
/** A reference to the scene registry so that we can call back to it
* when we're fully initialized. */
protected SceneRegistry _screg;
}