public class Game extends GameModelObservable implements IGame
Constructor and Description |
---|
Game(String name,
int gameId,
Configuration configuration)
Constructor method.
|
Game(String name,
int gameId,
Configuration configuration,
GameModel gameModel)
Deprecated.
please use the constructor without passing a GameModel, since this will happen automatically by the GameModel when setting it's Game object
Constructor method. Creates a new game with the parameters passed.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addPlayer(Player player)
adds a
Player object to the list of players that participate in this game. |
boolean |
addWinner(Player player)
adds a player to the winner list
|
Configuration |
getConfig() |
int |
getGameId() |
GameState |
getGameState() |
String |
getName() |
Player |
getPlayerByClientId(int clientId)
returns the player with the client id passed or null, if that player doesn't exist
|
Iterator<Player> |
getPlayersIterator() |
Iterator<Player> |
getWinnersIterator()
Returns an iterator over the players that won the game.
|
boolean |
kickPlayer(Player player,
KickState kickState)
changes the given players kickState (only if the player object belongs to this game)
|
void |
setGameState(GameState gameState) |
addGameModelObservable, getGameModel, notifyGameModel, notifyGameModel, removeGameModelObservable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
public Game(String name, int gameId, Configuration configuration)
name
- the name of the gamegameId
- the id of the game (given by the server)configuration
- the configuration the game usespublic Game(String name, int gameId, Configuration configuration, GameModel gameModel)
name
- the name of the gamegameId
- the id of the game (given by the server)configuration
- the configuration the game usesgameModel
- the GameModel object to be notified on changespublic Iterator<Player> getPlayersIterator()
getPlayersIterator
in interface IGame
public boolean addWinner(Player player)
player
- the player who won the gamepublic Iterator<Player> getWinnersIterator()
public Player getPlayerByClientId(int clientId)
clientId
- the clientId of the player to be returnedpublic GameState getGameState()
getGameState
in interface IGame
public void setGameState(GameState gameState)
setGameState
in interface IGame
public Configuration getConfig()
public boolean addPlayer(Player player)
IGame
Player
object to the list of players that participate in this game.public boolean kickPlayer(Player player, KickState kickState)
IGame
kickPlayer
in interface IGame
player
- the player whose kickState should be changedkickState
- the given players kickStateCopyright © 2017 smarTen. All rights reserved.