Let observers know when we attempt to switch zones as well as when we

succeed or fail in those attempts.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@824 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2001-12-17 04:11:40 +00:00
parent 54565c157a
commit f3f4ba4c16
2 changed files with 19 additions and 3 deletions
@@ -1,5 +1,5 @@
//
// $Id: ZoneDirector.java,v 1.3 2001/12/17 04:00:27 mdb Exp $
// $Id: ZoneDirector.java,v 1.4 2001/12/17 04:11:40 mdb Exp $
package com.threerings.whirled.zone.client;
@@ -82,6 +82,10 @@ public class ZoneDirector
return;
}
// let our zone observers know that we're attempting to switch
// zones
notifyObservers(new Integer(zoneId));
// check the version of our cached copy of the scene to which
// we're requesting to move; if we were unable to load it, assume
// a cached version of zero
@@ -155,7 +159,9 @@ public class ZoneDirector
for (int i = 0; i < _observers.size(); i++) {
ZoneObserver obs = (ZoneObserver)_observers.get(i);
try {
if (data instanceof ZoneSummary) {
if (data instanceof Integer) {
obs.zoneWillChange(((Integer)data).intValue());
} else if (data instanceof ZoneSummary) {
obs.zoneDidChange((ZoneSummary)data);
} else {
obs.zoneChangeFailed((String)data);
@@ -1,5 +1,5 @@
//
// $Id: ZoneObserver.java,v 1.1 2001/12/17 04:00:27 mdb Exp $
// $Id: ZoneObserver.java,v 1.2 2001/12/17 04:11:40 mdb Exp $
package com.threerings.whirled.zone.client;
@@ -11,6 +11,16 @@ import com.threerings.whirled.zone.data.ZoneSummary;
*/
public interface ZoneObserver
{
/**
* Called when we begin the process of switching to a new zone. This
* will be followed by a call to {@link #zoneDidChange} to indicate
* that the change was successful or {@link #zoneChangeFailed} if the
* change fails.
*
* @param zoneId the zone id of the zone to which we are changing.
*/
public void zoneWillChange (int zoneId);
/**
* Called when we have switched to a new zone.
*