Use NamedAttributeListener

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@838 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Dave Hoover
2009-05-19 19:31:31 +00:00
parent 75fdd4b2fc
commit 1bfaa30761
2 changed files with 11 additions and 13 deletions
@@ -36,9 +36,9 @@ import com.threerings.util.MessageBundle;
import com.threerings.util.Name;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.dobj.AttributeChangeListener;
import com.threerings.presents.dobj.AttributeChangedEvent;
import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.NamedAttributeListener;
import com.threerings.crowd.chat.server.SpeakUtil;
import com.threerings.crowd.data.BodyObject;
@@ -1334,13 +1334,12 @@ public class GameManager extends PlaceManager
}
/** Listens for game state changes. */
protected AttributeChangeListener _stateListener = new AttributeChangeListener() {
public void attributeChanged (AttributeChangedEvent event) {
if (event.getName().equals(GameObject.STATE)) {
protected NamedAttributeListener _stateListener = new NamedAttributeListener(GameObject.STATE) {
@Override
public void namedAttributeChanged (AttributeChangedEvent event) {
stateDidChange(_committedState = event.getIntValue(),
((Integer)event.getOldValue()).intValue());
}
}
};
/** A reference to our game config. */
@@ -42,6 +42,7 @@ import com.threerings.presents.dobj.AttributeChangeListener;
import com.threerings.presents.dobj.AttributeChangedEvent;
import com.threerings.presents.dobj.ElementUpdateListener;
import com.threerings.presents.dobj.ElementUpdatedEvent;
import com.threerings.presents.dobj.NamedAttributeListener;
import com.threerings.crowd.client.PlaceControllerDelegate;
import com.threerings.crowd.data.PlaceObject;
@@ -868,13 +869,11 @@ public abstract class PuzzleController extends GameController
};
/** Listens for various attribute changes. */
protected AttributeChangeListener _mlist = new AttributeChangeListener() {
public void attributeChanged (AttributeChangedEvent event) {
String name = event.getName();
if (name.equals(PuzzleObject.SEED)) {
protected AttributeChangeListener _mlist = new NamedAttributeListener(PuzzleObject.SEED) {
@Override
public void namedAttributeChanged (AttributeChangedEvent event) {
generateNewBoard();
}
}
};
/** A casted reference to the client context. */