|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlecturequiz.server.gamemodes.AbstractGameMode
public abstract class AbstractGameMode
Field Summary | |
---|---|
protected boolean |
canJoinStarted
|
protected Question |
currentQuestion
|
protected int |
currentQuestionIndex
|
protected java.lang.String |
id
|
protected java.lang.String |
name
|
protected User |
owner
|
protected java.util.ArrayList<User> |
players
|
protected java.util.Date |
questionStartTime
|
protected Quiz |
quiz
|
protected java.lang.String |
quizCode
|
protected boolean |
quizHasEnded
|
protected boolean |
started
|
Constructor Summary | |
---|---|
AbstractGameMode(Quiz quiz,
java.lang.String quizCode)
Constructor. |
Method Summary | |
---|---|
boolean |
canJoinStarted()
Tells if a client can join this game mode if the first question has already started. |
Question |
getCurrentQuestion()
Returns the current question in the quiz. |
GameStatus |
getGameStatus()
Get the current status of this game, such as players in game, number of teams, what question we are on etc. |
java.lang.String |
getId()
Returns the game mode ID of the game mode that runs on this game. |
java.lang.String |
getName()
Returns the game mode name of the game mode that runs on this game |
int |
getNumberOfPlayers()
Returns the number of current players that have joined this game. |
abstract java.util.ArrayList<StatisticsEntry> |
getOverallStatistics()
Returns the overall statistics for the entire game for all users. |
abstract java.util.ArrayList<StatisticsEntry> |
getOverallStatistics(User user)
Returns the overall statistics for the entire game for a specified user. |
User |
getOwner()
Return the owner of this game |
java.util.ArrayList<User> |
getPlayers()
Returns the list of players in this game |
abstract java.util.ArrayList<StatisticsEntry> |
getQuestionStatistics()
Returns the combined statistics for all users of this game |
abstract java.util.ArrayList<StatisticsEntry> |
getQuestionStatistics(User user)
Returns the statistics for the last question for the requested user. |
java.lang.String |
getQuizCode()
Returns the quiz code for this game. |
int |
getTimeLeft()
Returns the time left before the question should change. |
boolean |
hasQuestionTimedOut()
Checks if the current question running has reached the time limit set by the question. |
boolean |
hasQuizEnded()
Tells if the quiz has ended and the last question has been answered |
boolean |
isStarted()
Check if the game is started. |
int |
joinGame(User player,
java.util.List<ParameterEntry> parameters)
Tries add a player to the game. |
abstract int |
receiveAnswer(int answerID,
User player)
Receives an answer from a player and registers it. |
void |
removeUser(User user)
Remove a user from the game |
void |
setOwner(User user)
Set the owner of this game |
boolean |
setParameters(java.util.List<ParameterEntry> parameters)
Sets the custom parameters for this game mode. |
abstract boolean |
startNextQuestion()
Starts the next question in the quiz |
void |
startQuiz()
Starts the quiz. |
protected boolean |
timeoutReached()
Simple function to determine if the time limit of a question has been reached |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String id
protected java.lang.String name
protected java.lang.String quizCode
protected User owner
protected java.util.ArrayList<User> players
protected Quiz quiz
protected boolean canJoinStarted
protected Question currentQuestion
protected int currentQuestionIndex
protected java.util.Date questionStartTime
protected boolean quizHasEnded
protected boolean started
Constructor Detail |
---|
public AbstractGameMode(Quiz quiz, java.lang.String quizCode)
quiz
- Quiz the game will use.quizCode
- Quiz code of the game.Method Detail |
---|
public java.lang.String getId()
public java.lang.String getName()
public java.lang.String getQuizCode()
public int joinGame(User player, java.util.List<ParameterEntry> parameters)
player
- The player to add.parameters
- Custom parameters from the client
public boolean isStarted()
public java.util.ArrayList<User> getPlayers()
public int getNumberOfPlayers()
public void startQuiz()
public Question getCurrentQuestion()
public abstract boolean startNextQuestion()
public abstract java.util.ArrayList<StatisticsEntry> getQuestionStatistics()
public abstract java.util.ArrayList<StatisticsEntry> getQuestionStatistics(User user)
user
- User to get statistics for, pass null for general statistics.
public abstract java.util.ArrayList<StatisticsEntry> getOverallStatistics()
public abstract java.util.ArrayList<StatisticsEntry> getOverallStatistics(User user)
user
- The user to get statistics for
public boolean hasQuestionTimedOut()
public boolean canJoinStarted()
public abstract int receiveAnswer(int answerID, User player)
answerID
- player
-
public void setOwner(User user)
user
- the user to set as ownerpublic User getOwner()
public void removeUser(User user)
user
- user to removepublic boolean hasQuizEnded()
public GameStatus getGameStatus()
public boolean setParameters(java.util.List<ParameterEntry> parameters)
parameters
- The custom parameters from the teacher client who created the game.
public int getTimeLeft()
protected boolean timeoutReached()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |