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
@@ -0,0 +1,51 @@
//
// $Id: EditableScene.java,v 1.1 2001/11/12 20:56:56 mdb Exp $
package com.threerings.whirled.tools;
import com.threerings.whirled.client.DisplayScene;
import com.threerings.whirled.data.SceneModel;
/**
* The editable scene interface is used in the offline scene building
* tools as well as by the tools that load those prototype scenes into the
* runtime database. Accordingly, it provides a means for modifying scene
* values and for obtaining access to the underlying scene models that
* represent the underlying scene information.
*
* <p> Because the editable scene is used in the scene editor, where it is
* displayed, the editable scene interface extends the {@link
* DisplayScene} interface so that the same display mechanisms can be used
* in the client and the editor. This leaves one anomaly, however which is
* that {@link #getPlaceConfig} is out of place in the editor or in
* loading tools. Instead of complicating things with an additional
* interface that factors out that method, we instead recommend that
* editable scene implementations simply return null from that method with
* the expectation that it will never be called.
*/
public interface EditableScene extends DisplayScene
{
/**
* Sets this scene's unique identifier.
*/
public void setId (int sceneId);
/**
* Sets this scene's version number.
*/
public void setVersion (int version);
/**
* Sets the ids of the neighbors of this scene.
*/
public void setNeighborIds (int[] neighborIds);
/**
* Implementations must provide a scene model that represents the
* current state of this editable scene in response to a call to this
* method. Whether they maintain an up to date scene model all along
* or generate one at the time this method is called is up to the
* implementation.
*/
public SceneModel getSceneModel ();
}
@@ -0,0 +1,49 @@
//
// $Id: EditableSceneImpl.java,v 1.1 2001/11/12 20:56:56 mdb Exp $
package com.threerings.whirled.tools;
import com.threerings.crowd.data.PlaceConfig;
import com.threerings.whirled.client.DisplaySceneImpl;
import com.threerings.whirled.data.SceneModel;
/**
* A basic implementation of the {@link EditableScene} interface.
*/
public class EditableSceneImpl
extends DisplaySceneImpl
implements EditableScene
{
/**
* Creates an instance that will obtain data from the supplied scene
* model and update it when changes are made.
*/
public EditableSceneImpl (SceneModel model)
{
super(model, null);
}
// documentation inherited
public void setId (int sceneId)
{
_model.sceneId = sceneId;
}
// documentation inherited
public void setVersion (int version)
{
_model.version = version;
}
// documentation inherited
public void setNeighborIds (int[] neighborIds)
{
_model.neighborIds = neighborIds;
}
// documentation inherited
public SceneModel getSceneModel ()
{
return _model;
}
}