public class ObserverGUIControl extends Object implements IObserverGUIControl
Modifier and Type | Field and Description |
---|---|
protected ObserverClientControl |
clientControl |
protected de.smarten.tsuro.shared.gamemodel.GameModel |
gameModel |
protected GUI |
gui |
Constructor and Description |
---|
ObserverGUIControl(GUI gui)
Creates and sets the ObserverClientControl instance, called by class GUI
|
Modifier and Type | Method and Description |
---|---|
void |
displayLosses(List<de.smarten.tsuro.shared.gamemodel.Player> pKickedPlayers)
The method tells the GUI to display the kicked players in
|
GUI |
getGui()
function necessary and used for testing
|
ObserverClientControl |
getObserverClientControl() |
void |
joinGame(int pGameId,
String pPlayerName,
de.smarten.tsuro.shared.gamemodel.Role role)
This method is called when the user wants to register with a game after he entered the necessary information
|
void |
notifyCancel()
The method tells the GUI to display that the game has been cancelled.
|
void |
notifyContinue()
The method tells the GUI to display that the game has been continued.
|
void |
notifyDisconnect()
Is called when the connection timed out or is reset in another way.
|
void |
notifyFinish()
The method tells the GUI to display that the game has been finished.
|
void |
notifyKick(String kickedPlayersMsg)
Displays the kicked players on the GUI.
|
void |
notifyPause()
The method tells the GUI to display that the game has been paused.
|
void |
notifyTurn()
Is used to notify the gui that it is the client's turn.
|
void |
registerClicked(String pNetworkAddress)
This method is called when the user wants to connect (indicated by pressing the register button) with a
server after entering a network address.
|
void |
requestGameList()
Forwards request for GameList to the client control.
|
void |
setError(String pError,
String errorSource)
Receives an error message and the source of the error (e.g.
|
void |
setGameJoined() |
void |
setGameList(List<de.smarten.tsuro.shared.gamemodel.Game> pGameList)
Receives a List of Game objects and forwards this list to the gui for displaying it.
|
void |
setGameModel(de.smarten.tsuro.shared.gamemodel.GameModel gameModel)
This method sets the GameModel variable of this class.
|
void |
setMessage(String pMessage,
String messageSource)
Receives an message and the source of the error (e.g.
|
void |
showGameList()
Tells the GUI to display the gamelistwindow.
|
protected GUI gui
protected ObserverClientControl clientControl
protected de.smarten.tsuro.shared.gamemodel.GameModel gameModel
public ObserverGUIControl(GUI gui)
gui
- the graphical user interface that started the initialization chainpublic void registerClicked(String pNetworkAddress)
IObserverGUIControl
registerClicked
in interface IObserverGUIControl
pNetworkAddress
- The network address to be connected to and was entered by the user in beforepublic void setError(String pError, String errorSource)
IObserverGUIControl
setError
in interface IObserverGUIControl
pError
- the error message to be displayederrorSource
- the source where the error occuredpublic void setMessage(String pMessage, String messageSource)
IObserverGUIControl
setMessage
in interface IObserverGUIControl
pMessage
- the message to be displayedmessageSource
- the source where the message came frompublic void setGameList(List<de.smarten.tsuro.shared.gamemodel.Game> pGameList)
IObserverGUIControl
setGameList
in interface IObserverGUIControl
pGameList
- List with Game objects that are currently available for joiningpublic void requestGameList()
IObserverGUIControl
requestGameList
in interface IObserverGUIControl
public void notifyPause()
IObserverGUIControl
notifyPause
in interface IObserverGUIControl
public void notifyContinue()
IObserverGUIControl
notifyContinue
in interface IObserverGUIControl
public void notifyFinish()
IObserverGUIControl
notifyFinish
in interface IObserverGUIControl
public void joinGame(int pGameId, String pPlayerName, de.smarten.tsuro.shared.gamemodel.Role role)
IObserverGUIControl
joinGame
in interface IObserverGUIControl
pGameId
- the ID of the game the client would like to join (-1 if client wants to join general game pool)pPlayerName
- the name of the client userpublic void notifyCancel()
IObserverGUIControl
notifyCancel
in interface IObserverGUIControl
public void displayLosses(List<de.smarten.tsuro.shared.gamemodel.Player> pKickedPlayers)
IObserverGUIControl
displayLosses
in interface IObserverGUIControl
pKickedPlayers
- List of the players that have been kicked.public void setGameModel(de.smarten.tsuro.shared.gamemodel.GameModel gameModel) throws Exception
IObserverGUIControl
setGameModel
in interface IObserverGUIControl
gameModel
- gameModel that represents the game the spectator would like to watchException
- if the GameModel variable can't be setpublic void notifyKick(String kickedPlayersMsg)
IObserverGUIControl
notifyKick
in interface IObserverGUIControl
kickedPlayersMsg
- the list of players that were kickedpublic ObserverClientControl getObserverClientControl()
public GUI getGui()
public void showGameList()
IObserverGUIControl
showGameList
in interface IObserverGUIControl
public void notifyTurn()
public void notifyDisconnect()
public void setGameJoined()
Copyright © 2017 smarTen. All rights reserved.