|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.engine.state.GameState
vooga.examples.networking.tictactoe.states.PlayState
public class PlayState
The main GameState for the TicTacToe game. Handles placing pieces and dealing with the network to get opposing moves.
Field Summary |
---|
Fields inherited from class vooga.engine.state.GameState |
---|
myRenderField, myUpdateField |
Constructor Summary | |
---|---|
PlayState(Game game,
LevelManager levelManager,
ClientConnection connection)
Constructor for the PlayState. |
Method Summary | |
---|---|
void |
addPiece()
Called by Control whenever the user clicks in a square. |
boolean |
checkMessage()
If there is a message to send then call the method that corresponds with that message and then set the message to null. |
void |
initControls()
Set up Control object that handles adding a piece when the user clicks in a square. |
void |
initialize()
Load the first and only level, set up the Control object for clicking to add pieces, and create all the different GameStates and Events |
void |
initLevel()
Sets up the gameWon, wait, youLost, theyQuit, and tie GameStates as well as the GameWon, GameLost, and GameTied events. |
void |
interpretMessage(java.lang.String data)
If what we're parsing is an Integer and therefore an instance of Move, then deserialize the String into a Move object and place the piece on the board. |
void |
lost()
Called when the player loses. |
void |
placeOpposingPiece()
Called in interpretMessage if the data its parsing is an integer so it represents a Move. |
void |
quit()
Called when the other player quits. |
void |
setMessage(java.lang.String message)
Sets the message. |
void |
theirTurn()
Called when it is the opponent's turn. |
void |
tied()
Called when the player ties. |
void |
update(long elapsedTime)
First checks the events to make sure there won't be any message changes. |
void |
won()
Called when the player wins. |
void |
yourTurn()
Called when the it is the player's turn. |
Methods inherited from class vooga.engine.state.GameState |
---|
activate, addGroup, addPlayField, addRenderPlayField, addRenderState, addState, addUpdatePlayField, addUpdateState, deactivate, equals, getGroup, getRenderField, getUpdateField, isActive, removeEverything, render |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PlayState(Game game, LevelManager levelManager, ClientConnection connection)
game
- Game for the GameStateManager and other convenience methodslevelManager
- the LevelManager for making the other PlayStatesconnection
- the ClientConnection through which all communication with the server is doneMethod Detail |
---|
public void initialize()
initialize
in class GameState
public void initControls()
public void initLevel()
public void addPiece()
public void placeOpposingPiece()
public void setMessage(java.lang.String message)
message
- to set the message instance topublic void interpretMessage(java.lang.String data)
data
- data received from the socketpublic boolean checkMessage()
public void update(long elapsedTime)
update
in class GameState
public void won()
public void tied()
public void lost()
public void quit()
public void theirTurn()
public void yourTurn()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |