Nix place-specific willEnter and didLeave pattern since we're no longer bound
to places. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@257 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -28,7 +28,9 @@ import com.threerings.util.Util;
|
|||||||
import com.threerings.presents.client.BasicDirector;
|
import com.threerings.presents.client.BasicDirector;
|
||||||
import com.threerings.presents.client.Client;
|
import com.threerings.presents.client.Client;
|
||||||
import com.threerings.presents.client.ClientEvent;
|
import com.threerings.presents.client.ClientEvent;
|
||||||
|
import com.threerings.presents.client.InvocationService_ResultListener;
|
||||||
|
|
||||||
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.dobj.EntryAddedEvent;
|
import com.threerings.presents.dobj.EntryAddedEvent;
|
||||||
import com.threerings.presents.dobj.EntryRemovedEvent;
|
import com.threerings.presents.dobj.EntryRemovedEvent;
|
||||||
import com.threerings.presents.dobj.EntryUpdatedEvent;
|
import com.threerings.presents.dobj.EntryUpdatedEvent;
|
||||||
@@ -58,7 +60,7 @@ import com.threerings.parlor.util.ParlorContext;
|
|||||||
* matchmaking takes place implements the {@link TableLobbyObject} interface.
|
* matchmaking takes place implements the {@link TableLobbyObject} interface.
|
||||||
*/
|
*/
|
||||||
public class TableDirector extends BasicDirector
|
public class TableDirector extends BasicDirector
|
||||||
implements SetListener, ParlorService_TableListener
|
implements SetListener, InvocationService_ResultListener
|
||||||
{
|
{
|
||||||
protected static const log :Log = Log.getLog(TableDirector);
|
protected static const log :Log = Log.getLog(TableDirector);
|
||||||
|
|
||||||
@@ -83,29 +85,27 @@ public class TableDirector extends BasicDirector
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This must be called by the entity that uses the table director when the using entity
|
* This must be called by the entity that uses the table director when the using entity
|
||||||
* prepares to enter and display a place. It is assumed that the client is already subscribed
|
* prepares to enter and display a "place".
|
||||||
* to the provided place object.
|
|
||||||
*/
|
*/
|
||||||
public function willEnterPlace (place :PlaceObject) :void
|
public function setTableObject (tlobj :DObject) :void
|
||||||
{
|
{
|
||||||
// the place should be a TableLobbyObject
|
// the distributed object should be a TableLobbyObject
|
||||||
_tlobj = TableLobbyObject(place);
|
_tlobj = TableLobbyObject(tlobj);
|
||||||
|
// listen for table set updates
|
||||||
// add ourselves as a listener to the place object
|
tlobj.addListener(this);
|
||||||
place.addListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This must be called by the entity that uses the table director when the using entity has
|
* This must be called by the entity that uses the table director when the using entity has
|
||||||
* left and is done displaying a place.
|
* left and is done displaying the "place".
|
||||||
*/
|
*/
|
||||||
public function didLeavePlace (place :PlaceObject) :void
|
public function clearTableObject () :void
|
||||||
{
|
{
|
||||||
// remove our listenership
|
// remove our listenership and clear out
|
||||||
place.removeListener(this);
|
if (_tlobj != null) {
|
||||||
|
(_tlobj as DObject).removeListener(this);
|
||||||
// clear out our reference
|
_tlobj = null;
|
||||||
_tlobj = null;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public class TableListView extends JPanel
|
|||||||
public void willEnterPlace (PlaceObject place)
|
public void willEnterPlace (PlaceObject place)
|
||||||
{
|
{
|
||||||
// pass the good word on to our table director
|
// pass the good word on to our table director
|
||||||
_tdtr.willEnterPlace(place);
|
_tdtr.setTableObject(place);
|
||||||
|
|
||||||
// iterate over the tables already active in this lobby and put
|
// iterate over the tables already active in this lobby and put
|
||||||
// them in their respective lists
|
// them in their respective lists
|
||||||
@@ -164,7 +164,7 @@ public class TableListView extends JPanel
|
|||||||
public void didLeavePlace (PlaceObject place)
|
public void didLeavePlace (PlaceObject place)
|
||||||
{
|
{
|
||||||
// pass the good word on to our table director
|
// pass the good word on to our table director
|
||||||
_tdtr.didLeavePlace(place);
|
_tdtr.clearTableObject();
|
||||||
|
|
||||||
// clear out our table lists
|
// clear out our table lists
|
||||||
_matchList.removeAll();
|
_matchList.removeAll();
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ import com.samskivert.util.ObserverList;
|
|||||||
import com.threerings.presents.client.BasicDirector;
|
import com.threerings.presents.client.BasicDirector;
|
||||||
import com.threerings.presents.client.Client;
|
import com.threerings.presents.client.Client;
|
||||||
|
|
||||||
|
import com.threerings.presents.dobj.DObject;
|
||||||
import com.threerings.presents.dobj.EntryAddedEvent;
|
import com.threerings.presents.dobj.EntryAddedEvent;
|
||||||
import com.threerings.presents.dobj.EntryRemovedEvent;
|
import com.threerings.presents.dobj.EntryRemovedEvent;
|
||||||
import com.threerings.presents.dobj.EntryUpdatedEvent;
|
import com.threerings.presents.dobj.EntryUpdatedEvent;
|
||||||
import com.threerings.presents.dobj.SetListener;
|
import com.threerings.presents.dobj.SetListener;
|
||||||
|
|
||||||
import com.threerings.crowd.data.BodyObject;
|
import com.threerings.crowd.data.BodyObject;
|
||||||
import com.threerings.crowd.data.PlaceObject;
|
|
||||||
|
|
||||||
import com.threerings.parlor.Log;
|
import com.threerings.parlor.Log;
|
||||||
import com.threerings.parlor.data.Table;
|
import com.threerings.parlor.data.Table;
|
||||||
@@ -81,27 +81,27 @@ public class TableDirector extends BasicDirector
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This must be called by the entity that uses the table director when the using entity
|
* This must be called by the entity that uses the table director when the using entity
|
||||||
* prepares to enter and display a place. It is assumed that the client is already subscribed
|
* prepares to enter and display a place.
|
||||||
* to the provided place object.
|
|
||||||
*/
|
*/
|
||||||
public void willEnterPlace (PlaceObject place)
|
public void setTableObject (DObject tlobj)
|
||||||
{
|
{
|
||||||
// the place should be a TableLobbyObject
|
// the place should be a TableLobbyObject
|
||||||
_tlobj = (TableLobbyObject)place;
|
_tlobj = (TableLobbyObject)tlobj;
|
||||||
// add ourselves as a listener to the place object
|
// listen for table set changes
|
||||||
place.addListener(this);
|
tlobj.addListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This must be called by the entity that uses the table director when the using entity has
|
* This must be called by the entity that uses the table director when the using entity has
|
||||||
* left and is done displaying a place.
|
* left and is done dealing with tables.
|
||||||
*/
|
*/
|
||||||
public void didLeavePlace (PlaceObject place)
|
public void clearTableObject ()
|
||||||
{
|
{
|
||||||
// remove our listenership
|
// remove our listenership and clear out
|
||||||
place.removeListener(this);
|
if (_tlobj != null) {
|
||||||
// clear out our reference
|
((DObject)_tlobj).removeListener(this);
|
||||||
_tlobj = null;
|
_tlobj = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -279,7 +279,7 @@ public class TableDirector extends BasicDirector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited from interface
|
// from interface TableService.ResultListener
|
||||||
public void requestFailed (String reason)
|
public void requestFailed (String reason)
|
||||||
{
|
{
|
||||||
Log.warning("Table action failed [reason=" + reason + "].");
|
Log.warning("Table action failed [reason=" + reason + "].");
|
||||||
|
|||||||
Reference in New Issue
Block a user