|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.parlor.server.TableManager
public class TableManager
A table manager can be used by a place manager (or other entity) to take care of the management of a table matchmaking service on a particular distributed object.
| Nested Class Summary | |
|---|---|
protected class |
TableManager.GameListener
Listens to all games and updates the table objects as necessary. |
protected class |
TableManager.UserListener
Listens to all users who have joined a table, takes care of removing them as necessary. |
| Field Summary | |
|---|---|
protected boolean |
_allowBooting
Whether or not tables should support booting. |
protected IntMap<Table> |
_boidMap
A mapping from body oid to table. |
protected DObject |
_dobj
A reference to the distributed object in which we're managing tables. |
protected ChangeListener |
_gameListener
A listener that prunes tables after the game dies. |
protected IntMap<Table> |
_goidMap
Once a game starts, a mapping from gameOid to table. |
protected InvocationManager |
_invmgr
|
protected RootDObjectManager |
_omgr
|
protected ChangeListener |
_placeListener
Listens for players leaving the place that contains our tables. |
protected PlaceRegistry |
_plreg
|
protected Class<? extends Table> |
_tableClass
The class of table we instantiate. |
protected IntMap<Table> |
_tables
The table of pending tables. |
protected TableLobbyObject |
_tlobj
A reference to our distributed object casted to a table lobby object. |
protected ChangeListener |
_userListener
A listener that removes users from tables when they're no longer able to play. |
| Fields inherited from interface com.threerings.parlor.data.ParlorCodes |
|---|
ALREADY_AT_TABLE, BANNED_FROM_TABLE, GAME_ALREADY_STARTED, INVALID_TABLE_POSITION, INVITATION_ACCEPTED, INVITATION_COUNTERED, INVITATION_REFUSED, INVITEE_NOT_ONLINE, MUST_BE_CREATOR, NO_SELF_BOOT, NO_SUCH_TABLE, NOT_AT_TABLE, PARLOR_GROUP, TABLE_POSITION_OCCUPIED |
| Fields inherited from interface com.threerings.presents.data.InvocationCodes |
|---|
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR |
| Constructor Summary | |
|---|---|
TableManager(RootDObjectManager omgr,
InvocationManager invmgr,
PlaceRegistry plreg,
DObject tableObject)
Creates a table manager that will manage tables in the supplied distributed object (which must implement TableLobbyObject. |
|
| Method Summary | |
|---|---|
protected void |
addTableToLobby(Table table)
Add the table to the lobby object, after it has already been validated as being publishable. |
protected void |
bodyLeft(int bodyOid)
Called when a body is known to have left either the room that contains our tables or logged off of the server. |
void |
bootPlayer(ClientObject caller,
int tableId,
Name target,
InvocationService.InvocationListener listener)
Handles a TableService.bootPlayer(int, com.threerings.util.Name, com.threerings.presents.client.InvocationService.InvocationListener) request. |
protected GameConfig |
createConfig(Table table)
This method should validate that the (client provided) configuration in the supplied Table object is valid and fill in any extra information that is the purview of the server. |
protected int |
createGame(Table table)
Called when we're ready to create a game (either an invitation has been accepted or a table is ready to start. |
protected GameManager |
createGameManager(GameConfig config)
Creates a GameManager using the supplied config. |
Table |
createTable(BodyObject creator,
TableConfig tableConfig,
GameConfig config)
Creates a table for the specified creator and returns said table. |
void |
createTable(ClientObject caller,
TableConfig tableConfig,
GameConfig config,
InvocationService.ResultListener listener)
Handles a TableService.createTable(com.threerings.parlor.data.TableConfig, com.threerings.parlor.game.data.GameConfig, com.threerings.presents.client.InvocationService.ResultListener) request. |
protected void |
gameCreated(Table table,
GameObject gameobj,
GameManager gmgr)
Called when our game has been created, we take this opportunity to clean up the table and transition it to "in play" mode. |
int |
getTableCount()
Returns the number of tables being managed currently. |
void |
joinTable(ClientObject caller,
int tableId,
int position,
InvocationService.InvocationListener listener)
Handles a TableService.joinTable(int, int, com.threerings.presents.client.InvocationService.InvocationListener) request. |
void |
leaveTable(ClientObject caller,
int tableId,
InvocationService.InvocationListener listener)
Handles a TableService.leaveTable(int, com.threerings.presents.client.InvocationService.InvocationListener) request. |
protected void |
notePlayerAdded(Table table,
BodyObject body)
Called when a player is added to a table to set up our mappings. |
protected Table |
notePlayerRemoved(int playerOid)
Called when a player leaves the room and we're not sure if the user is still online. |
protected Table |
notePlayerRemoved(int playerOid,
BodyObject body)
Called when a player leaves a table to clear our mappings. |
protected void |
purgeTable(Table table)
Removes the table from all of our internal tables and from its lobby's distributed object. |
protected void |
removeTableFromLobby(Integer tableId)
Safely remove the table from the lobby. |
void |
setAllowBooting(boolean allowBooting)
Allow a player in the first position of a table to boot others. |
void |
setTableClass(Class<? extends Table> tableClass)
Set the subclass of Table that this instance should generate. |
void |
setTableObject(DObject tableObject)
Initialize the TableLobbyObject. |
protected boolean |
shouldPublish(Table table)
Derived classes can override this method to filter certain tables from being published in the lobby object. |
void |
shutdown()
This must be called when the table manager is no longer needed. |
void |
startTableNow(ClientObject caller,
int tableId,
InvocationService.InvocationListener listener)
Handles a TableService.startTableNow(int, com.threerings.presents.client.InvocationService.InvocationListener) request. |
protected void |
tableCreated(Table table)
Publishes a newly created table to the lobby object. |
protected void |
unmapTable(int gameOid)
Called when a game created from a table managed by this table manager was destroyed. |
protected void |
updateOccupants(int gameOid)
Called when the occupants in a game change: publishes new info. |
protected void |
updateTableInLobby(Table table)
Safely update the table in the lobby, if it's there. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ChangeListener _placeListener
protected DObject _dobj
protected TableLobbyObject _tlobj
protected Class<? extends Table> _tableClass
protected IntMap<Table> _tables
protected IntMap<Table> _boidMap
protected IntMap<Table> _goidMap
protected ChangeListener _gameListener
protected ChangeListener _userListener
protected boolean _allowBooting
protected RootDObjectManager _omgr
protected InvocationManager _invmgr
protected PlaceRegistry _plreg
| Constructor Detail |
|---|
public TableManager(RootDObjectManager omgr,
InvocationManager invmgr,
PlaceRegistry plreg,
DObject tableObject)
TableLobbyObject.
| Method Detail |
|---|
public void setTableObject(DObject tableObject)
public int getTableCount()
public void shutdown()
public void setTableClass(Class<? extends Table> tableClass)
public void setAllowBooting(boolean allowBooting)
public Table createTable(BodyObject creator,
TableConfig tableConfig,
GameConfig config)
throws InvocationException
InvocationException - thrown if the table could not be created for any reason.
public void createTable(ClientObject caller,
TableConfig tableConfig,
GameConfig config,
InvocationService.ResultListener listener)
throws InvocationException
TableProviderTableService.createTable(com.threerings.parlor.data.TableConfig, com.threerings.parlor.game.data.GameConfig, com.threerings.presents.client.InvocationService.ResultListener) request.
createTable in interface TableProviderInvocationException
public void joinTable(ClientObject caller,
int tableId,
int position,
InvocationService.InvocationListener listener)
throws InvocationException
TableProviderTableService.joinTable(int, int, com.threerings.presents.client.InvocationService.InvocationListener) request.
joinTable in interface TableProviderInvocationException
public void leaveTable(ClientObject caller,
int tableId,
InvocationService.InvocationListener listener)
throws InvocationException
TableProviderTableService.leaveTable(int, com.threerings.presents.client.InvocationService.InvocationListener) request.
leaveTable in interface TableProviderInvocationException
public void startTableNow(ClientObject caller,
int tableId,
InvocationService.InvocationListener listener)
throws InvocationException
TableProviderTableService.startTableNow(int, com.threerings.presents.client.InvocationService.InvocationListener) request.
startTableNow in interface TableProviderInvocationException
public void bootPlayer(ClientObject caller,
int tableId,
Name target,
InvocationService.InvocationListener listener)
throws InvocationException
TableProviderTableService.bootPlayer(int, com.threerings.util.Name, com.threerings.presents.client.InvocationService.InvocationListener) request.
bootPlayer in interface TableProviderInvocationExceptionprotected void tableCreated(Table table)
protected void purgeTable(Table table)
protected void notePlayerAdded(Table table,
BodyObject body)
protected final Table notePlayerRemoved(int playerOid)
protected Table notePlayerRemoved(int playerOid,
BodyObject body)
body - will be non-null if the user is still online.
protected int createGame(Table table)
throws InvocationException
InvocationExceptionprotected GameConfig createConfig(Table table)
Table object is valid and fill in any extra information that is the purview of the server.
protected GameManager createGameManager(GameConfig config)
throws InstantiationException,
InvocationException
GameManager using the supplied config. Used by createGame(com.threerings.parlor.data.Table), but
extracted into a method to allow customization of this process.
InstantiationException
InvocationException
protected void gameCreated(Table table,
GameObject gameobj,
GameManager gmgr)
protected void unmapTable(int gameOid)
protected void updateOccupants(int gameOid)
protected void bodyLeft(int bodyOid)
protected boolean shouldPublish(Table table)
protected void addTableToLobby(Table table)
protected void updateTableInLobby(Table table)
protected void removeTableFromLobby(Integer tableId)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||