|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.crowd.server.PlaceManagerDelegate
com.threerings.parlor.server.PlayManagerDelegate
com.threerings.parlor.game.server.GameManagerDelegate
com.threerings.parlor.rating.server.RatingDelegate
public abstract class RatingDelegate
Rates players after each game and handles persisting the results.
| Nested Class Summary | |
|---|---|
protected static class |
RatingDelegate.PlayerRating
Encapsulates the rating/experience tuple representing a player's rating for a game. |
| Field Summary | |
|---|---|
protected GameManager |
_gmgr
An appropriately casted reference to our GameManager. |
protected GameObject |
_gobj
An appropriately casted reference to our GameObject. |
protected Invoker |
_invoker
|
protected int[] |
_playerIds
Contains the persistent id of the players in this game. |
protected IntMap<RatingDelegate.PlayerRating> |
_ratings
The ratings for each player as they were at the beginning of the game. |
protected RatingRepository |
_repo
|
protected long |
_startStamp
A timestamp set at the beginning of the game, used to calculate its duration. |
| Fields inherited from class com.threerings.crowd.server.PlaceManagerDelegate |
|---|
_invmgr, _omgr, _plmgr |
| Fields inherited from interface com.threerings.parlor.rating.data.RatingCodes |
|---|
DEFAULT_RATING, MAXIMUM_RATING, MINIMUM_RATING |
| Constructor Summary | |
|---|---|
RatingDelegate()
|
|
| Method Summary | |
|---|---|
void |
bodyEntered(int bodyOid)
|
void |
bodyLeft(int bodyOid)
|
void |
didInit(PlaceConfig config)
|
void |
didStartup(PlaceObject plobj)
|
void |
gameDidEnd()
Called by the game manager after the game ended. |
void |
gameWillStart()
Called by the game manager when the game is about to start. |
protected int |
getGameId()
Returns the game id to use when reading and writing ratings. |
protected void |
loadRatings(Collection<RatingDelegate.PlayerRating> ratings)
Loads up rating information for the specified set of player ids and stores them in the _ratings table. |
protected RatingDelegate.PlayerRating |
maybeCreateRating(BodyObject bobj)
|
protected abstract int |
minimumRatedDuration()
Return the minimum time (in seconds) a game must've lasted for it to count towards rating. |
protected void |
saveRatings(Collection<RatingDelegate.PlayerRating> ratings)
|
protected boolean |
shouldRateGame()
Returns true if this game should be rated, false otherwise. |
protected abstract void |
updateRatingInMemory(int gameId,
RatingDelegate.PlayerRating rating)
Optionally store update ratings in memory e.g. in the user object. |
protected void |
updateRatings()
Computes updated ratings for the players of this game. |
| Methods inherited from class com.threerings.parlor.game.server.GameManagerDelegate |
|---|
gameDidStart, gameWillEnd, gameWillReset, playerWasReplaced, setAI, tickAI |
| Methods inherited from class com.threerings.parlor.server.PlayManagerDelegate |
|---|
isAgent, isPlayer, verifyIsPlayer, verifyIsPlayerOrAgent, verifyWritePermission |
| Methods inherited from class com.threerings.crowd.server.PlaceManagerDelegate |
|---|
addDispatcher, addProvider, bodyUpdated, didShutdown, init, placeBecameEmpty, where |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected GameManager _gmgr
protected GameObject _gobj
protected int[] _playerIds
protected IntMap<RatingDelegate.PlayerRating> _ratings
protected long _startStamp
@Inject protected RatingRepository _repo
@Inject protected Invoker _invoker
| Constructor Detail |
|---|
public RatingDelegate()
| Method Detail |
|---|
public void didInit(PlaceConfig config)
didInit in class PlayManagerDelegatepublic void didStartup(PlaceObject plobj)
didStartup in class PlaceManagerDelegatepublic void bodyEntered(int bodyOid)
bodyEntered in class PlaceManagerDelegatepublic void bodyLeft(int bodyOid)
bodyLeft in class PlaceManagerDelegatepublic void gameWillStart()
GameManagerDelegate
gameWillStart in class GameManagerDelegatepublic void gameDidEnd()
GameManagerDelegate
gameDidEnd in class GameManagerDelegateprotected RatingDelegate.PlayerRating maybeCreateRating(BodyObject bobj)
protected void loadRatings(Collection<RatingDelegate.PlayerRating> ratings)
_ratings table.
protected void saveRatings(Collection<RatingDelegate.PlayerRating> ratings)
protected void updateRatings()
GameObject.winners field to determine winners and losers and uses a FIDE/ELO
algorithm to compute updated ratings.
protected int getGameId()
protected boolean shouldRateGame()
protected abstract int minimumRatedDuration()
protected abstract void updateRatingInMemory(int gameId,
RatingDelegate.PlayerRating rating)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||