Need to save the scene director's pendingdata across a server-switch logoff/logon cycle when the user is moving via a zone move.
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@967 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -198,6 +198,20 @@ public class SceneDirector extends BasicDirector
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a function that may be used to restore the scene director's pendingData to its
|
||||||
|
* current state. This is primarily useful if you know something (such as a logoff) is about
|
||||||
|
* to happen and you want to ensure you can restore the pending data after re-login.
|
||||||
|
*/
|
||||||
|
public function getPendingDataRestoreFunc () :Function
|
||||||
|
{
|
||||||
|
var pendingData :PendingData = _pendingData;
|
||||||
|
|
||||||
|
return function () :void {
|
||||||
|
_pendingData = pendingData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the model loaded in preparation for a scene transition. This is made available only
|
* Returns the model loaded in preparation for a scene transition. This is made available only
|
||||||
* for cooperating directors which may need to coopt the scene transition process. The pending
|
* for cooperating directors which may need to coopt the scene transition process. The pending
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.threerings.presents.client.ConfirmAdapter;
|
|||||||
|
|
||||||
import com.threerings.crowd.data.PlaceConfig;
|
import com.threerings.crowd.data.PlaceConfig;
|
||||||
|
|
||||||
|
import com.threerings.whirled.client.PendingData;
|
||||||
import com.threerings.whirled.client.SceneDirector;
|
import com.threerings.whirled.client.SceneDirector;
|
||||||
import com.threerings.whirled.client.SceneDirector_MoveHandler;
|
import com.threerings.whirled.client.SceneDirector_MoveHandler;
|
||||||
import com.threerings.whirled.data.SceneModel;
|
import com.threerings.whirled.data.SceneModel;
|
||||||
@@ -201,8 +202,14 @@ public class ZoneDirector extends BasicDirector
|
|||||||
{
|
{
|
||||||
log.info("Zone switch requires server switch", "host", hostname, "ports", ports);
|
log.info("Zone switch requires server switch", "host", hostname, "ports", ports);
|
||||||
// ship on over to the other server
|
// ship on over to the other server
|
||||||
|
|
||||||
|
// keep track of our current pending data because it will be cleared when we log off of
|
||||||
|
// this server and onto the next one
|
||||||
|
var restorePending :Function = _scdir.getPendingDataRestoreFunc();
|
||||||
|
|
||||||
_wCtx.getClient().moveToServer(hostname, ports, new ConfirmAdapter(
|
_wCtx.getClient().moveToServer(hostname, ports, new ConfirmAdapter(
|
||||||
function () :void { // succeeded
|
function () :void { // succeeded
|
||||||
|
restorePending();
|
||||||
sendMoveRequest();
|
sendMoveRequest();
|
||||||
}, requestFailed));
|
}, requestFailed));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user