|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectJTP.Progress
public class Progress
Keeps track of highscores, levels reached and areas unlocked.
Field Summary | |
---|---|
static boolean |
COOP
Cooperative. |
static int |
HIGH_SCORE_COUNT
Number of entries in each highscore table. |
static boolean |
SINGLE
Single player. |
Constructor Summary | |
---|---|
Progress()
Constructs a new Progress instance. |
Method Summary | |
---|---|
boolean |
addHighScore(boolean coop,
int score,
String name)
Adds score to the highscore table. |
String |
getName(boolean coop,
int index)
Retrieves name associated with a score from the highscore table. |
int |
getReachedLevel(boolean coop)
Returns progress made in the levelset. |
int |
getScore(boolean coop,
int index)
Retrieves score from the highscore table. |
int |
isHighScoreWhere(boolean coop,
int score)
Checks whether the given score can go in the highscore table. |
void |
setReachedLevel(int levelNumber,
boolean coop)
Updates progress made in the levelset. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int HIGH_SCORE_COUNT
public static final boolean SINGLE
public static final boolean COOP
Constructor Detail |
---|
public Progress()
Progress
instance.
Method Detail |
---|
public int getReachedLevel(boolean coop)
coop
- specifies which levelset - can be either SINGLE
or COOP
.
public void setReachedLevel(int levelNumber, boolean coop) throws IllegalArgumentException
levelNumber
- level reachedcoop
- specifies which levelset - can be either SINGLE
or COOP
.
IllegalArgumentException
- if levelNumber < 0
.public int isHighScoreWhere(boolean coop, int score)
coop
- specifies which levelset - can be either SINGLE
or COOP
.score
- the score.
-1
if the score is not high enough.public boolean addHighScore(boolean coop, int score, String name) throws NullPointerException, IllegalArgumentException
coop
- specifies which levelset - can be either SINGLE
or COOP
.score
- the score.
true
if the score was added or false
if score
is not a highscore.
NullPointerException
- if name
is null
.
IllegalArgumentException
- if score < 1
.public int getScore(boolean coop, int index) throws ArrayIndexOutOfBoundsException
coop
- specifies which levelset - can be either SINGLE
or COOP
.index
- in highscore list of wanted score.
ArrayIndexOutOfBoundsException
- if index < 0
or
index >= HIGH_SCORE_COUNT
.public String getName(boolean coop, int index) throws ArrayIndexOutOfBoundsException
coop
- specifies which levelset - can be either SINGLE
or COOP
.index
- in highscore list of wanted score.
ArrayIndexOutOfBoundsException
- if index < 0
or
index >= HIGH_SCORE_COUNT
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |