|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.micasa.lobby.LobbyRegistry
public class LobbyRegistry
The lobby registry is the primary class that coordinates the lobby services on the client. It sets up the necessary invocation services and keeps track of the lobbies in operation on the server. Only one lobby registry should be created on a server.
Presently, the lobby registry is configured with lobbies via the server configuration. An example configuration follows:
lobby_ids = foolobby, barlobby, bazlobby foolobby.mgrclass = com.threerings.micasa.lobby.LobbyManager foolobby.ugi =This information will be loaded from the MiCasa server configuration which means that it should live infoolobby.name = foolobby.config1 = some config value foolobby.config2 = some other config value barlobby.mgrclass = com.threerings.micasa.lobby.LobbyManager barlobby.ugi = barlobby.name = ...
rsrc/config/micasa/server.properties somwhere in the classpath where it
will override the default MiCasa server properties file.
The UGI or universal game identifier is a string that is used to uniquely
identify every type of game and also to classify it according to meaningful keywords. It is best
described with a few examples:
backgammon,board,strategy spades,card,partner yahtzee,diceAs you can see, a UGI should start with an identifier uniquely identifying the type of game and can be followed by a list of keywords that classify it as a member of a particular category of games (eg. board, card, dice, partner game, strategy game). A game can belong to multiple categories.
As long as the UGIs in use by a particular server make some kind of sense, the client will be able to use them to search for lobbies containing games of similar types using the provided facilities.
| Field Summary | |
|---|---|
protected int |
_defLobbyOid
The oid of the default lobby. |
protected Map<String,List<Lobby>> |
_lobbies
A table containing references to our lobby records (in the form of category lists. |
protected PlaceRegistry |
_plreg
|
protected static String |
LOBIDS_KEY
The configuration key for the lobby managers list. |
| Constructor Summary | |
|---|---|
LobbyRegistry(InvocationManager invmgr)
|
|
| Method Summary | |
|---|---|
String[] |
getCategories(BodyObject requester)
Returns an array containing the category identifiers of all the categories in which lobbies have been registered with the registry. |
void |
getCategories(ClientObject caller,
LobbyService.CategoriesListener listener)
Processes a request by the client to obtain a list of the lobby categories available on this server. |
int |
getDefaultLobbyOid()
Returns the oid of the default lobby. |
void |
getLobbies(BodyObject requester,
String category,
List<Lobby> target)
Returns information about all lobbies hosting games in the specified category. |
void |
getLobbies(ClientObject caller,
String category,
LobbyService.LobbiesListener listener)
Processes a request by the client to obtain a list of lobbies matching the supplied category string. |
void |
init()
Initializes the registry, creating our default lobbies. |
protected void |
loadLobby(String lobbyId)
Extracts the properties for a lobby from the server config and creates and initializes the lobby manager. |
protected void |
lobbyReady(int placeOid,
String gameIdent,
String name)
Called by our lobby managers once they have started up and are ready to do their lobby duties. |
protected void |
registerLobby(String category,
Lobby record)
Registers the supplied lobby in the specified category table. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@Inject protected PlaceRegistry _plreg
protected Map<String,List<Lobby>> _lobbies
protected int _defLobbyOid
protected static final String LOBIDS_KEY
| Constructor Detail |
|---|
@Inject public LobbyRegistry(InvocationManager invmgr)
| Method Detail |
|---|
public void init()
public int getDefaultLobbyOid()
protected void loadLobby(String lobbyId)
public void getLobbies(BodyObject requester,
String category,
List<Lobby> target)
requester - the body object of the client requesting the lobby list (which can be used
to filter the list based on their capabilities).category - the category of game for which the lobbies are desired.target - the list into which the matching lobbies will be deposited.public String[] getCategories(BodyObject requester)
requester - the body object of the client requesting the category list (which can be
used to filter the list based on their capabilities).
public void getCategories(ClientObject caller,
LobbyService.CategoriesListener listener)
getCategories in interface LobbyProvider
public void getLobbies(ClientObject caller,
String category,
LobbyService.LobbiesListener listener)
getLobbies in interface LobbyProvider
protected void lobbyReady(int placeOid,
String gameIdent,
String name)
protected void registerLobby(String category,
Lobby record)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||