public class GameObject
extends com.threerings.crowd.data.PlaceObject
com.threerings.crowd.data.PlaceObject.ManagerCaller| Modifier and Type | Field and Description |
|---|---|
static int |
CANCELLED
A game state constant indicating that the game was cancelled.
|
static int |
GAME_OVER
A game state constant indicating that the game ended normally.
|
static int |
IN_PLAY
A game state constant indicating that the game is in play.
|
static String |
IS_PRIVATE
The field name of the
isPrivate field. |
static String |
IS_RATED
The field name of the
isRated field. |
boolean |
isPrivate
Indicates whether the game is "private".
|
boolean |
isRated
Indicates whether or not this game is rated.
|
static int |
PLAYER_IN_PLAY
The player status constant for a player whose game is in play.
|
static int |
PLAYER_LEFT_GAME
The player status constant for a player whose has been knocked out of the game.
|
static String |
PLAYER_STATUS
The field name of the
playerStatus field. |
com.threerings.util.Name[] |
players
The usernames of the players involved in this game.
|
static String |
PLAYERS
The field name of the
players field. |
int[] |
playerStatus
If null, indicates that all present players are active, or for more complex games can be
non-null to indicate the current status of each player in the game.
|
static int |
PRE_GAME
A game state constant indicating that the game has not yet started and is still awaiting
the arrival of all of the players.
|
static String |
SESSION_ID
The field name of the
sessionId field. |
int |
sessionId
A unique identifier for each game session.
|
int |
state
|
static String |
STATE
The field name of the
state field. |
boolean[] |
winners
Whether each player in the game is a winner, or null if the game is not yet over.
|
static String |
WINNERS
The field name of the
winners field. |
| Constructor and Description |
|---|
GameObject() |
| Modifier and Type | Method and Description |
|---|---|
int |
getActivePlayerCount()
Returns the number of active players in the game.
|
int |
getPlayerCount()
Returns the number of players in the game.
|
int |
getPlayerIndex(com.threerings.util.Name username)
Returns the player index of the given user in the game, or
-1 if the player is
not involved in the game. |
int |
getWinnerCount()
Returns the number of winners for this game, or
0 if the winners array is not
populated, e.g., the game is not yet over. |
int |
getWinnerIndex()
Returns the winner index of the first winning player for this game, or
-1 if
there are no winners or the winners array is not yet assigned. |
boolean |
isActivePlayer(int pidx)
Returns whether the given player is still an active player in the game.
|
boolean |
isDraw()
Returns true if the game is ended in a draw.
|
boolean |
isInPlay()
Returns whether the game is in play.
|
boolean |
isOccupiedPlayer(int pidx)
Returns whether the given player index in the game is occupied.
|
boolean |
isWinner(int pidx)
Returns whether the given player index is a winner, or false if the winners are not yet
assigned.
|
void |
setIsPrivate(boolean value)
Requests that the
isPrivate field be set to the
specified value. |
void |
setIsRated(boolean value)
Requests that the
isRated field be set to the
specified value. |
void |
setPlayers(com.threerings.util.Name[] value)
Requests that the
players field be set to the
specified value. |
void |
setPlayersAt(com.threerings.util.Name value,
int index)
Requests that the
indexth element of
players field be set to the specified value. |
void |
setPlayerStatus(int[] value)
Requests that the
playerStatus field be set to the
specified value. |
void |
setPlayerStatusAt(int value,
int index)
Requests that the
indexth element of
playerStatus field be set to the specified value. |
void |
setSessionId(int value)
Requests that the
sessionId field be set to the
specified value. |
void |
setState(int value)
Requests that the
state field be set to the
specified value. |
void |
setWinners(boolean[] value)
Requests that the
winners field be set to the
specified value. |
void |
setWinnersAt(boolean value,
int index)
Requests that the
indexth element of
winners field be set to the specified value. |
addToOccupantInfo, addToOccupants, applyToListeners, getChatIdentifier, getOccupantInfo, initManagerCaller, removeFromOccupantInfo, removeFromOccupants, setOccupantInfo, setSpeakService, shouldBroadcast, updateOccupantInfoacquireLock, addListener, addListener, addSubscriber, addToSet, cancelTransaction, changeAttribute, checkPermissions, checkPermissions, commitTransaction, destroy, getAccessController, getAttribute, getLocal, getLocals, getManager, getOid, getSet, inTransaction, isActive, notifyListeners, notifyProxies, postEvent, postMessage, postMessage, releaseLock, removeFromSet, removeListener, removeSubscriber, setAccessController, setAttribute, setDestroyOnLastSubscriberRemoved, setLocal, setManager, setOid, startTransaction, toString, updateSet, which@Generated(value="com.threerings.presents.tools.GenDObjectTask") public static final String STATE
state field.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public static final String IS_RATED
isRated field.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public static final String IS_PRIVATE
isPrivate field.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public static final String PLAYERS
players field.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public static final String WINNERS
winners field.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public static final String SESSION_ID
sessionId field.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public static final String PLAYER_STATUS
playerStatus field.public static final int PRE_GAME
public static final int IN_PLAY
public static final int GAME_OVER
public static final int CANCELLED
public static final int PLAYER_IN_PLAY
public static final int PLAYER_LEFT_GAME
public int state
public boolean isRated
public boolean isPrivate
public com.threerings.util.Name[] players
public boolean[] winners
public int sessionId
public int[] playerStatus
PLAYER_LEFT_GAME or PLAYER_IN_PLAY. Subclasses of GameObject may use
other means to determine a player's status in the game, so call isActivePlayer(int)
to see if a player is still participating in a game.
public int getPlayerCount()
public int getActivePlayerCount()
public boolean isActivePlayer(int pidx)
public int getPlayerIndex(com.threerings.util.Name username)
-1 if the player is
not involved in the game.public boolean isInPlay()
public boolean isOccupiedPlayer(int pidx)
public boolean isWinner(int pidx)
public int getWinnerCount()
0 if the winners array is not
populated, e.g., the game is not yet over.public boolean isDraw()
public int getWinnerIndex()
-1 if
there are no winners or the winners array is not yet assigned. This is only likely to be
useful for games that are known to have a single winner.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public void setState(int value)
state field be set to the
specified value. The local value will be updated immediately and an
event will be propagated through the system to notify all listeners
that the attribute did change. Proxied copies of this object (on
clients) will apply the value change when they received the
attribute changed notification.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public void setIsRated(boolean value)
isRated field be set to the
specified value. The local value will be updated immediately and an
event will be propagated through the system to notify all listeners
that the attribute did change. Proxied copies of this object (on
clients) will apply the value change when they received the
attribute changed notification.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public void setIsPrivate(boolean value)
isPrivate field be set to the
specified value. The local value will be updated immediately and an
event will be propagated through the system to notify all listeners
that the attribute did change. Proxied copies of this object (on
clients) will apply the value change when they received the
attribute changed notification.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public void setPlayers(com.threerings.util.Name[] value)
players field be set to the
specified value. The local value will be updated immediately and an
event will be propagated through the system to notify all listeners
that the attribute did change. Proxied copies of this object (on
clients) will apply the value change when they received the
attribute changed notification.@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public void setPlayersAt(com.threerings.util.Name value,
int index)
indexth element of
players field be set to the specified value.
The local value will be updated immediately and an event will be
propagated through the system to notify all listeners that the
attribute did change. Proxied copies of this object (on clients)
will apply the value change when they received the attribute
changed notification.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public void setWinners(boolean[] value)
winners field be set to the
specified value. The local value will be updated immediately and an
event will be propagated through the system to notify all listeners
that the attribute did change. Proxied copies of this object (on
clients) will apply the value change when they received the
attribute changed notification.@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public void setWinnersAt(boolean value,
int index)
indexth element of
winners field be set to the specified value.
The local value will be updated immediately and an event will be
propagated through the system to notify all listeners that the
attribute did change. Proxied copies of this object (on clients)
will apply the value change when they received the attribute
changed notification.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public void setSessionId(int value)
sessionId field be set to the
specified value. The local value will be updated immediately and an
event will be propagated through the system to notify all listeners
that the attribute did change. Proxied copies of this object (on
clients) will apply the value change when they received the
attribute changed notification.@Generated(value="com.threerings.presents.tools.GenDObjectTask") public void setPlayerStatus(int[] value)
playerStatus field be set to the
specified value. The local value will be updated immediately and an
event will be propagated through the system to notify all listeners
that the attribute did change. Proxied copies of this object (on
clients) will apply the value change when they received the
attribute changed notification.@Generated(value="com.threerings.presents.tools.GenDObjectTask")
public void setPlayerStatusAt(int value,
int index)
indexth element of
playerStatus field be set to the specified value.
The local value will be updated immediately and an event will be
propagated through the system to notify all listeners that the
attribute did change. Proxied copies of this object (on clients)
will apply the value change when they received the attribute
changed notification.Copyright © 2015. All rights reserved.