|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.parlor.data.Table
public class Table
This class represents a table that is being used to matchmake a game by the Parlor services.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.threerings.io.Streamable |
|---|
Streamable.Closure |
| Field Summary | |
|---|---|
protected HashSet<Name> |
_bannedUsers
On the server, the usernames that have been banned from this table. |
protected static int |
_tableIdCounter
A counter for assigning table ids. |
static int |
ANY_POSITION
Used to request any position at a table. |
int[] |
bodyOids
The body oids of the players of this table, or null if a party game. |
GameConfig |
config
The game config for the game that is being matchmade. |
int |
gameOid
The oid of the game that was created from this table or -1 if the table is still in matchmaking mode. |
int |
lobbyOid
The object id of the lobby object with which this table is associated. |
Name[] |
players
An array of the usernames of the players of this table (some slots may not be filled), or null if a party game. |
int |
tableId
The unique identifier for this table. |
TableConfig |
tconfig
The table configuration object. |
Name[] |
watchers
An array of the usernames of the non-player occupants of this game. |
| 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 | |
|---|---|
Table()
Constructs a blank table instance, suitable for unserialization. |
|
| Method Summary | |
|---|---|
void |
addBannedUser(Name player)
Indicate to this table that a user was booted and should be prevented from rejoining. |
boolean |
clearPlayer(Name username)
Requests that the specified user be removed from their seat at this table. |
boolean |
clearPlayerByOid(int bodyOid)
Requests that the user identified by the specified body object id be removed from their seat at this table. |
void |
clearPlayerPos(int position)
Called to clear a player at the specified position. |
boolean |
containsPlayer(Name player)
Returns true if this table contains the specified player. |
protected Name[] |
createPlayerNamesArray(int length)
Creates a names array of the appropriate type. |
boolean |
equals(Object other)
|
Comparable<?> |
getKey()
|
int |
getOccupiedCount()
Count the number of players currently occupying this table. |
Name[] |
getPlayers()
Once a table is ready to play (see mayBeStarted() and shouldBeStarted()), the
players array can be fetched using this method. |
int[][] |
getTeamMemberIndices()
For a team game, get the team member indices of the compressed players array returned by getPlayers(). |
int |
hashCode()
|
void |
init(int lobbyOid,
TableConfig tconfig,
GameConfig config)
Initializes a new table instance, and assigns it the next monotonically increasing table id. |
boolean |
inPlay()
Returns true if this table is in play, false if it is still being matchmade. |
boolean |
isEmpty()
Returns true if there is no one sitting at this table. |
boolean |
mayBeStarted()
Returns true if this table has a sufficient number of players that the game can be started. |
String |
setPlayer(int position,
BodyObject player)
Requests to seat the specified user at the specified position in this table. |
void |
setPlayerPos(int position,
BodyObject player)
This method is used for party games, it does no bounds checking or verification of the player's ability to join, if you are unsure you should call 'setPlayer'. |
boolean |
shouldBeStarted()
Returns true if sufficient seats are occupied that the game should be automatically started. |
String |
toString()
|
protected void |
toString(StringBuilder buf)
Helper method for toString, ripe for overrideability. |
void |
updateOccupants(GameObject gameobj)
Called by the table manager when the game object's players have changed. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int ANY_POSITION
public int tableId
public int lobbyOid
public int gameOid
public Name[] players
public Name[] watchers
public transient int[] bodyOids
public GameConfig config
public TableConfig tconfig
protected static int _tableIdCounter
protected transient HashSet<Name> _bannedUsers
| Constructor Detail |
|---|
public Table()
| Method Detail |
|---|
public void init(int lobbyOid,
TableConfig tconfig,
GameConfig config)
lobbyOid - the object id of the lobby in which this table is to live.tconfig - the table configuration for this table.config - the configuration of the game being matchmade by this table.public boolean isEmpty()
public int getOccupiedCount()
public Name[] getPlayers()
mayBeStarted() and shouldBeStarted()), the
players array can be fetched using this method. It will return an array containing the
usernames of all of the players in the game, sized properly and with each player in the
appropriate position.
public int[][] getTeamMemberIndices()
getPlayers().
public String setPlayer(int position,
BodyObject player)
position - the position in which to seat the user.player - the player to set.
public void setPlayerPos(int position,
BodyObject player)
public void addBannedUser(Name player)
public boolean clearPlayer(Name username)
public boolean clearPlayerByOid(int bodyOid)
public void clearPlayerPos(int position)
public boolean containsPlayer(Name player)
public void updateOccupants(GameObject gameobj)
watchers array.
public boolean mayBeStarted()
public boolean shouldBeStarted()
public boolean inPlay()
public Comparable<?> getKey()
getKey in interface DSet.Entrypublic boolean equals(Object other)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectprotected void toString(StringBuilder buf)
protected Name[] createPlayerNamesArray(int length)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||