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.util.Name;
import com.threerings.presents.data.ClientObject; import com.threerings.presents.data.ClientObject;
import com.threerings.presents.dobj.AttributeChangeListener;
import com.threerings.presents.dobj.AttributeChangedEvent; import com.threerings.presents.dobj.AttributeChangedEvent;
import com.threerings.presents.dobj.DObject; import com.threerings.presents.dobj.DObject;
import com.threerings.presents.dobj.NamedAttributeListener;
import com.threerings.crowd.chat.server.SpeakUtil; import com.threerings.crowd.chat.server.SpeakUtil;
import com.threerings.crowd.data.BodyObject; import com.threerings.crowd.data.BodyObject;
@@ -1334,12 +1334,11 @@ public class GameManager extends PlaceManager
} }
/** Listens for game state changes. */ /** Listens for game state changes. */
protected AttributeChangeListener _stateListener = new AttributeChangeListener() { protected NamedAttributeListener _stateListener = new NamedAttributeListener(GameObject.STATE) {
public void attributeChanged (AttributeChangedEvent event) { @Override
if (event.getName().equals(GameObject.STATE)) { public void namedAttributeChanged (AttributeChangedEvent event) {
stateDidChange(_committedState = event.getIntValue(), stateDidChange(_committedState = event.getIntValue(),
((Integer)event.getOldValue()).intValue()); ((Integer)event.getOldValue()).intValue());
}
} }
}; };
@@ -42,6 +42,7 @@ import com.threerings.presents.dobj.AttributeChangeListener;
import com.threerings.presents.dobj.AttributeChangedEvent; import com.threerings.presents.dobj.AttributeChangedEvent;
import com.threerings.presents.dobj.ElementUpdateListener; import com.threerings.presents.dobj.ElementUpdateListener;
import com.threerings.presents.dobj.ElementUpdatedEvent; import com.threerings.presents.dobj.ElementUpdatedEvent;
import com.threerings.presents.dobj.NamedAttributeListener;
import com.threerings.crowd.client.PlaceControllerDelegate; import com.threerings.crowd.client.PlaceControllerDelegate;
import com.threerings.crowd.data.PlaceObject; import com.threerings.crowd.data.PlaceObject;
@@ -868,12 +869,10 @@ public abstract class PuzzleController extends GameController
}; };
/** Listens for various attribute changes. */ /** Listens for various attribute changes. */
protected AttributeChangeListener _mlist = new AttributeChangeListener() { protected AttributeChangeListener _mlist = new NamedAttributeListener(PuzzleObject.SEED) {
public void attributeChanged (AttributeChangedEvent event) { @Override
String name = event.getName(); public void namedAttributeChanged (AttributeChangedEvent event) {
if (name.equals(PuzzleObject.SEED)) { generateNewBoard();
generateNewBoard();
}
} }
}; };