|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.asdf.common.GameController
com.asdf.plugins.pokergames.PokerGameController
public abstract class PokerGameController
Provides control for receiving game updates and forwarding them to the players and GUI and sending actions to server
Field Summary | |
---|---|
GameInfo |
gameInfo
|
Constructor Summary | |
---|---|
PokerGameController()
|
Method Summary | |
---|---|
void |
addBot(int seatNumber,
java.lang.String name,
Player bot,
double cash)
Adding a bot to the table, sends the info to the server Should be called only after the seat has been successfully reserved |
void |
addPlayer(int seatNumber,
java.lang.String plrName,
double cash)
A player sits to the table, creates a new OurPlayer and sends the info to the Server Should be called only after the player has received confirmation of a successful reservation |
java.lang.String |
getAccountName()
Returns the name of the account for the user |
GameInfo |
getGameInfo()
Getter for current game state |
boolean |
getHasNextAction()
|
int |
getNextAction()
Getter for next action. |
double |
getNextAmount()
Getter for next amount. |
int |
getOurPlayer()
Getter for the main seat player. |
Player[] |
getPlayers()
Getter for players |
PokerGameController |
getThis()
Getter for myself. |
Hand[] |
getVisibleHands(int seat)
Retrieves visible hands. |
void |
handleRequest(Request req)
Handles a Request sent by the server. |
void |
handleResponse(Response rsp)
Handles a response sent by players. |
void |
handleStateUpdate(StateUpdate stateUp)
Handles StateUpdates sent by server. |
void |
init(GameResponse response,
java.lang.String accountName,
AccountType accountType)
initialized the game controller for use. |
void |
playerBack(int seatNumber)
Receives notification from GUI for a player wishing to come back from sit out and forwards it to the server |
void |
receiveConfirmationForReservation(int seat)
Receives confirmation for a seat reservation. |
void |
receiveHand(Hand hand,
int seat)
Receives a hand for a given seat. |
void |
removePlayer(int seatNumber)
Removes player from given seat and sends the action to leave to the server Always supposed to close the window |
void |
removePlayer(int seatNumber,
boolean isLeavingTable)
Removes player from given seat and sends the action to leave to the server |
boolean |
reserveSeat(int seat)
called when a player wants to reserve a seat, adds a reserving object to the model (only for internal purposes) and sends a reserve action to server |
void |
sendAction(Action action,
int currentPlayer)
Sends an action message to server. |
void |
sendChat(java.lang.String message)
Gets chat messages from the GUI to be send forwards to the server If the player is playing, uses the name given, otherwise uses accountname if logged in, or Guest |
void |
sendChat(java.lang.String name,
java.lang.String message)
Sends given chat to the server for distribution |
void |
sendVoice(byte[] data)
Send voice data to server. |
void |
setHasNextAction(boolean has)
Setter for has an action to process. |
void |
setNextAction(int nextAction)
Setter for action. |
void |
setNextAction(int nextAction,
double amount)
Setter for the next action to be processed. |
void |
setNextAmount(double amount)
Setter for nextAmount |
void |
standing()
called to update the available seats, after not sitting down after reserving a seat, or only adding a bot |
void |
updateGameModel(GameModel newModel)
Updates the game model given the new game model If the current player is one in this controller, starts a thread to get it's action |
void |
updateGUI()
Updates game information for a GUI instance |
void |
updateGUIBigger()
Updates game information and turn related information. |
void |
updateSeatAvailable()
Calls GUI to update available seat positions |
void |
waitForNextAction()
Waits for the next action. |
void |
zeroActions()
Clears all current action information. |
Methods inherited from class com.asdf.common.GameController |
---|
getConnectionHandler, getGameID, getID, setConnectionHandler, setGameID, setID, start |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public GameInfo gameInfo
Constructor Detail |
---|
public PokerGameController()
Method Detail |
---|
public PokerGameController getThis()
public java.lang.String getAccountName()
public Player[] getPlayers()
public int getOurPlayer()
public GameInfo getGameInfo()
public void waitForNextAction()
public void setHasNextAction(boolean has)
has
- with value 'true' awakens waiting position to start handling actions.public boolean getHasNextAction()
public void setNextAction(int nextAction, double amount)
nextAction
- Integer description of the action.amount
- Cash amounts related to action, meaning depends on the value of action.public void setNextAction(int nextAction)
nextAction
- Integer description of the action.public void setNextAmount(double amount)
amount
- Cash amounts related to nextAction, meaning depends on the value of action.public void zeroActions()
public int getNextAction()
public double getNextAmount()
public void updateGUI()
public void updateGUIBigger()
public void updateSeatAvailable()
public void updateGameModel(GameModel newModel)
newModel
- A new game model.public void addPlayer(int seatNumber, java.lang.String plrName, double cash)
seatNumber
- the seat to sit atplrName
- name of the playercash
- amount of money brought to tablepublic void addBot(int seatNumber, java.lang.String name, Player bot, double cash)
seatNumber
- the seat to sit the bot atname
- name of the botbot
- object implementing the Player interface for the botcash
- amount of money brought to tablepublic void removePlayer(int seatNumber)
seatNumber
- public void removePlayer(int seatNumber, boolean isLeavingTable)
seatNumber
- isLeavingTable
- when the player leaving also closes the windowpublic void playerBack(int seatNumber)
seatNumber
- seat of the returning playerpublic boolean reserveSeat(int seat)
seat
- the seat to reserve
public void standing()
public Hand[] getVisibleHands(int seat)
seat
- The user's seat.
public void sendAction(Action action, int currentPlayer)
action
- Action of current player.currentPlayer
- Seat of the current player.public void sendVoice(byte[] data)
data
- Voice datapublic void sendChat(java.lang.String name, java.lang.String message)
name
- The sender's namemessage
- public void receiveHand(Hand hand, int seat)
hand
- The hand received.seat
- The seat for which the hand was received.public void receiveConfirmationForReservation(int seat)
seat
- Seat which is reserved.public void sendChat(java.lang.String message)
message
- public void init(GameResponse response, java.lang.String accountName, AccountType accountType)
init
in class GameController
response
- Parameters received from server required to initialize thisaccountName
- Account name of the user who is associated with this GameController.accountType
- Type of the user account. Some users might have more privileges than
others.
GameControllerpublic void handleResponse(Response rsp)
rsp
- Response sent by server. Response is an object generated from
XML message using JAXB.public void handleRequest(Request req)
MessageHandler
req
- Request sent by server. Request is an object generated from
XML message using JAXB.public void handleStateUpdate(StateUpdate stateUp)
MessageHandler
stateUp
- StateUpdate sent by server. StateUpdate is an object generated from
XML message using JAXB.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |