|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.samskivert.swing.Controller
com.threerings.crowd.client.PlaceController
com.threerings.parlor.game.client.GameController
public abstract class GameController
The game controller manages the flow and control of a game on the client side. This class serves as the root of a hierarchy of controller classes that aim to provide functionality shared between various similar games. The base controller provides functionality for starting and ending the game and for calculating ratings adjustements when a game ends normally. It also handles the basic house keeping like subscription to the game object and dispatch of commands and distributed object events.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.crowd.client.PlaceController |
|---|
com.threerings.crowd.client.PlaceController.DelegateOp |
| Field Summary |
|---|
| Fields inherited from class com.samskivert.swing.Controller |
|---|
DISPATCHER |
| Constructor Summary | |
|---|---|
GameController()
|
|
| Method Summary | |
|---|---|
void |
attributeChanged(com.threerings.presents.dobj.AttributeChangedEvent event)
|
void |
didLeavePlace(com.threerings.crowd.data.PlaceObject plobj)
Removes our listener registration from the game object and cleans house. |
int |
getMatchType()
Convenience method to determine the type of game. |
int |
getSessionId()
Returns the unique session identifier for the current gameplay session. |
boolean |
handleAction(ActionEvent action)
Handles basic game controller action events. |
void |
init(com.threerings.crowd.util.CrowdContext ctx,
com.threerings.crowd.data.PlaceConfig config)
Initializes this game controller with the game configuration that was established during the match making process. |
boolean |
isGameOver()
Returns whether the game is over. |
void |
resetGame()
Calls gameWillReset(), ends the current game (locally, it does not tell the server to
end the game), and waits to receive a reset notification (which is simply an event setting
the game state to IN_PLAY even though it's already set to IN_PLAY)
from the server which will start up a new game. |
void |
setGameOver(boolean gameOver)
Sets the client game over override. |
void |
systemMessage(String bundle,
String msg)
A way for controllers to display a game-related system message. |
void |
willEnterPlace(com.threerings.crowd.data.PlaceObject plobj)
Adds this controller as a listener to the game object (thus derived classes need not do so) and lets the game manager know that we are now ready to go. |
| Methods inherited from class com.threerings.crowd.client.PlaceController |
|---|
getPlaceConfig, getPlaceView, mayLeavePlace |
| Methods inherited from class com.samskivert.swing.Controller |
|---|
actionPerformed, configureAction, createActionButton, handleAction, handleAction, handleAction, postAction, postAction, postAction, setControlledPanel, wasAdded, wasRemoved |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GameController()
| Method Detail |
|---|
public void init(com.threerings.crowd.util.CrowdContext ctx,
com.threerings.crowd.data.PlaceConfig config)
super.init in such cases.
init in class com.threerings.crowd.client.PlaceControllerctx - the client context.config - the configuration of the game we are intended to
control.public void willEnterPlace(com.threerings.crowd.data.PlaceObject plobj)
willEnterPlace in class com.threerings.crowd.client.PlaceControllerpublic void didLeavePlace(com.threerings.crowd.data.PlaceObject plobj)
didLeavePlace in class com.threerings.crowd.client.PlaceControllerpublic int getMatchType()
public boolean isGameOver()
public void setGameOver(boolean gameOver)
public void resetGame()
gameWillReset(), ends the current game (locally, it does not tell the server to
end the game), and waits to receive a reset notification (which is simply an event setting
the game state to IN_PLAY even though it's already set to IN_PLAY)
from the server which will start up a new game. Derived classes should override gameWillReset() to perform any game-specific animations.
public int getSessionId()
public boolean handleAction(ActionEvent action)
super.handleAction for events they don't specifically handle.
handleAction in class com.threerings.crowd.client.PlaceController
public void systemMessage(String bundle,
String msg)
public void attributeChanged(com.threerings.presents.dobj.AttributeChangedEvent event)
attributeChanged in interface com.threerings.presents.dobj.AttributeChangeListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||