Draw score info tooltips when hovering over a score.
Also added game mod 'name' fields. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
35b1bf197f
commit
a66133c605
|
@ -30,33 +30,33 @@ import org.newdawn.slick.Input;
|
||||||
*/
|
*/
|
||||||
public enum GameMod {
|
public enum GameMod {
|
||||||
EASY (Category.EASY, 0, GameImage.MOD_EASY, "EZ", 2, Input.KEY_Q, 0.5f,
|
EASY (Category.EASY, 0, GameImage.MOD_EASY, "EZ", 2, Input.KEY_Q, 0.5f,
|
||||||
"Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required."),
|
"Easy", "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required."),
|
||||||
NO_FAIL (Category.EASY, 1, GameImage.MOD_NO_FAIL, "NF", 1, Input.KEY_W, 0.5f,
|
NO_FAIL (Category.EASY, 1, GameImage.MOD_NO_FAIL, "NF", 1, Input.KEY_W, 0.5f,
|
||||||
"You can't fail. No matter what."),
|
"NoFail", "You can't fail. No matter what."),
|
||||||
HALF_TIME (Category.EASY, 2, GameImage.MOD_HALF_TIME, "HT", 256, Input.KEY_E, 0.3f, false,
|
HALF_TIME (Category.EASY, 2, GameImage.MOD_HALF_TIME, "HT", 256, Input.KEY_E, 0.3f, false,
|
||||||
"Less zoom."),
|
"HalfTime", "Less zoom."),
|
||||||
HARD_ROCK (Category.HARD, 0, GameImage.MOD_HARD_ROCK, "HR", 16, Input.KEY_A, 1.06f,
|
HARD_ROCK (Category.HARD, 0, GameImage.MOD_HARD_ROCK, "HR", 16, Input.KEY_A, 1.06f,
|
||||||
"Everything just got a bit harder..."),
|
"HardRock", "Everything just got a bit harder..."),
|
||||||
SUDDEN_DEATH (Category.HARD, 1, GameImage.MOD_SUDDEN_DEATH, "SD", 32, Input.KEY_S, 1f,
|
SUDDEN_DEATH (Category.HARD, 1, GameImage.MOD_SUDDEN_DEATH, "SD", 32, Input.KEY_S, 1f,
|
||||||
"Miss a note and fail."),
|
"SuddenDeath", "Miss a note and fail."),
|
||||||
// PERFECT (Category.HARD, 1, GameImage.MOD_PERFECT, "PF", 64, Input.KEY_S, 1f,
|
// PERFECT (Category.HARD, 1, GameImage.MOD_PERFECT, "PF", 64, Input.KEY_S, 1f,
|
||||||
// "SS or quit."),
|
// "Perfect", "SS or quit."),
|
||||||
DOUBLE_TIME (Category.HARD, 2, GameImage.MOD_DOUBLE_TIME, "DT", 64, Input.KEY_D, 1.12f, false,
|
DOUBLE_TIME (Category.HARD, 2, GameImage.MOD_DOUBLE_TIME, "DT", 64, Input.KEY_D, 1.12f, false,
|
||||||
"Zoooooooooom."),
|
"DoubleTime", "Zoooooooooom."),
|
||||||
// NIGHTCORE (Category.HARD, 2, GameImage.MOD_NIGHTCORE, "NT", 64, Input.KEY_D, 1.12f,
|
// NIGHTCORE (Category.HARD, 2, GameImage.MOD_NIGHTCORE, "NT", 64, Input.KEY_D, 1.12f,
|
||||||
// "uguuuuuuuu"),
|
// "Nightcore", "uguuuuuuuu"),
|
||||||
HIDDEN (Category.HARD, 3, GameImage.MOD_HIDDEN, "HD", 8, Input.KEY_F, 1.06f, false,
|
HIDDEN (Category.HARD, 3, GameImage.MOD_HIDDEN, "HD", 8, Input.KEY_F, 1.06f, false,
|
||||||
"Play with no approach circles and fading notes for a slight score advantage."),
|
"Hidden", "Play with no approach circles and fading notes for a slight score advantage."),
|
||||||
FLASHLIGHT (Category.HARD, 4, GameImage.MOD_FLASHLIGHT, "FL", 1024, Input.KEY_G, 1.12f, false,
|
FLASHLIGHT (Category.HARD, 4, GameImage.MOD_FLASHLIGHT, "FL", 1024, Input.KEY_G, 1.12f, false,
|
||||||
"Restricted view area."),
|
"Flashlight", "Restricted view area."),
|
||||||
RELAX (Category.SPECIAL, 0, GameImage.MOD_RELAX, "RL", 128, Input.KEY_Z, 0f,
|
RELAX (Category.SPECIAL, 0, GameImage.MOD_RELAX, "RL", 128, Input.KEY_Z, 0f,
|
||||||
"You don't need to click.\nGive your clicking/tapping finger a break from the heat of things.\n**UNRANKED**"),
|
"Relax", "You don't need to click.\nGive your clicking/tapping finger a break from the heat of things.\n**UNRANKED**"),
|
||||||
AUTOPILOT (Category.SPECIAL, 1, GameImage.MOD_AUTOPILOT, "AP", 8192, Input.KEY_X, 0f, false,
|
AUTOPILOT (Category.SPECIAL, 1, GameImage.MOD_AUTOPILOT, "AP", 8192, Input.KEY_X, 0f, false,
|
||||||
"Automatic cursor movement - just follow the rhythm.\n**UNRANKED**"),
|
"Relax2", "Automatic cursor movement - just follow the rhythm.\n**UNRANKED**"),
|
||||||
SPUN_OUT (Category.SPECIAL, 2, GameImage.MOD_SPUN_OUT, "SO", 4096, Input.KEY_V, 0.9f,
|
SPUN_OUT (Category.SPECIAL, 2, GameImage.MOD_SPUN_OUT, "SO", 4096, Input.KEY_V, 0.9f,
|
||||||
"Spinners will be automatically completed."),
|
"SpunOut", "Spinners will be automatically completed."),
|
||||||
AUTO (Category.SPECIAL, 3, GameImage.MOD_AUTO, "", 2048, Input.KEY_B, 1f,
|
AUTO (Category.SPECIAL, 3, GameImage.MOD_AUTO, "", 2048, Input.KEY_B, 1f,
|
||||||
"Watch a perfect automated play through the song.");
|
"Autoplay", "Watch a perfect automated play through the song.");
|
||||||
|
|
||||||
/** Mod categories. */
|
/** Mod categories. */
|
||||||
public enum Category {
|
public enum Category {
|
||||||
|
@ -148,6 +148,9 @@ public enum GameMod {
|
||||||
/** Whether or not the mod is implemented. */
|
/** Whether or not the mod is implemented. */
|
||||||
private boolean implemented;
|
private boolean implemented;
|
||||||
|
|
||||||
|
/** The name of the mod. */
|
||||||
|
private String name;
|
||||||
|
|
||||||
/** The description of the mod. */
|
/** The description of the mod. */
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
@ -234,6 +237,25 @@ public enum GameMod {
|
||||||
mod.active = ((state & mod.getBit()) > 0);
|
mod.active = ((state & mod.getBit()) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a comma-separated string of mod names of active mods in the given state.
|
||||||
|
* @param state the state (bitwise OR of active mods)
|
||||||
|
*/
|
||||||
|
public static String getModString(int state) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (GameMod mod : GameMod.values()) {
|
||||||
|
if ((state & mod.getBit()) > 0) {
|
||||||
|
sb.append(mod.getName());
|
||||||
|
sb.append(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sb.length() > 0) {
|
||||||
|
sb.setLength(sb.length() - 1);
|
||||||
|
return sb.toString();
|
||||||
|
} else
|
||||||
|
return "None";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param category the category for the mod
|
* @param category the category for the mod
|
||||||
|
@ -243,11 +265,12 @@ public enum GameMod {
|
||||||
* @param bit the bit
|
* @param bit the bit
|
||||||
* @param key the shortcut key
|
* @param key the shortcut key
|
||||||
* @param multiplier the score multiplier
|
* @param multiplier the score multiplier
|
||||||
|
* @param name the name
|
||||||
* @param description the description
|
* @param description the description
|
||||||
*/
|
*/
|
||||||
GameMod(Category category, int categoryIndex, GameImage image, String abbrev,
|
GameMod(Category category, int categoryIndex, GameImage image, String abbrev,
|
||||||
int bit, int key, float multiplier, String description) {
|
int bit, int key, float multiplier, String name, String description) {
|
||||||
this(category, categoryIndex, image, abbrev, bit, key, multiplier, true, description);
|
this(category, categoryIndex, image, abbrev, bit, key, multiplier, true, name, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -260,10 +283,11 @@ public enum GameMod {
|
||||||
* @param key the shortcut key
|
* @param key the shortcut key
|
||||||
* @param multiplier the score multiplier
|
* @param multiplier the score multiplier
|
||||||
* @param implemented whether the mod is implemented
|
* @param implemented whether the mod is implemented
|
||||||
|
* @param name the name
|
||||||
* @param description the description
|
* @param description the description
|
||||||
*/
|
*/
|
||||||
GameMod(Category category, int categoryIndex, GameImage image, String abbrev,
|
GameMod(Category category, int categoryIndex, GameImage image, String abbrev,
|
||||||
int bit, int key, float multiplier, boolean implemented, String description) {
|
int bit, int key, float multiplier, boolean implemented, String name, String description) {
|
||||||
this.category = category;
|
this.category = category;
|
||||||
this.categoryIndex = categoryIndex;
|
this.categoryIndex = categoryIndex;
|
||||||
this.image = image;
|
this.image = image;
|
||||||
|
@ -272,6 +296,7 @@ public enum GameMod {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.multiplier = multiplier;
|
this.multiplier = multiplier;
|
||||||
this.implemented = implemented;
|
this.implemented = implemented;
|
||||||
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,6 +325,12 @@ public enum GameMod {
|
||||||
*/
|
*/
|
||||||
public float getMultiplier() { return multiplier; }
|
public float getMultiplier() { return multiplier; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the mod.
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
public String getName() { return name; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a description of the mod.
|
* Returns a description of the mod.
|
||||||
* @return the description
|
* @return the description
|
||||||
|
|
|
@ -71,6 +71,12 @@ public class ScoreData implements Comparable<ScoreData> {
|
||||||
/** The score percent. */
|
/** The score percent. */
|
||||||
private float scorePercent = -1f;
|
private float scorePercent = -1f;
|
||||||
|
|
||||||
|
/** A formatted string of the timestamp. */
|
||||||
|
private String timeString;
|
||||||
|
|
||||||
|
/** A formatted string of the mods. */
|
||||||
|
private String modString;
|
||||||
|
|
||||||
/** Drawing values. */
|
/** Drawing values. */
|
||||||
private static float baseX, baseY, buttonWidth, buttonHeight, buttonOffset;
|
private static float baseX, baseY, buttonWidth, buttonHeight, buttonOffset;
|
||||||
|
|
||||||
|
@ -163,7 +169,9 @@ public class ScoreData implements Comparable<ScoreData> {
|
||||||
* Returns the timestamp as a string.
|
* Returns the timestamp as a string.
|
||||||
*/
|
*/
|
||||||
public String getTimeString() {
|
public String getTimeString() {
|
||||||
return new SimpleDateFormat("M/d/yyyy h:mm:ss a").format(new Date(timestamp * 1000L));
|
if (timeString == null)
|
||||||
|
timeString = new SimpleDateFormat("M/d/yyyy h:mm:ss a").format(new Date(timestamp * 1000L));
|
||||||
|
return timeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -207,6 +215,15 @@ public class ScoreData implements Comparable<ScoreData> {
|
||||||
return (timeSince.isEmpty()) ? null : timeSince;
|
return (timeSince.isEmpty()) ? null : timeSince;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a comma-separated string of mod names.
|
||||||
|
*/
|
||||||
|
private String getModString() {
|
||||||
|
if (modString == null)
|
||||||
|
modString = GameMod.getModString(mods);
|
||||||
|
return modString;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the score data as a rectangular button.
|
* Draws the score data as a rectangular button.
|
||||||
* @param g the graphics context
|
* @param g the graphics context
|
||||||
|
@ -300,13 +317,25 @@ public class ScoreData implements Comparable<ScoreData> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws the a tooltip containing the score information.
|
||||||
|
* @param g the graphics context
|
||||||
|
*/
|
||||||
|
public void drawTooltip(Graphics g) {
|
||||||
|
String text = String.format(
|
||||||
|
"Achieved on %s\n300:%d 100:%d 50:%d Miss:%d\nAccuracy: %.2f%%\nMods: %s",
|
||||||
|
getTimeString(), hit300, hit100, hit50, miss,
|
||||||
|
getScorePercent(), getModString());
|
||||||
|
UI.drawTooltip(g, text, true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format(
|
return String.format(
|
||||||
"%s | ID: (%d, %d) | %s - %s [%s] (by %s) | " +
|
"%s | ID: (%d, %d) | %s - %s [%s] (by %s) | " +
|
||||||
"Hits: (%d, %d, %d, %d, %d, %d) | Score: %d (%d combo%s) | Mods: %d",
|
"Hits: (%d, %d, %d, %d, %d, %d) | Score: %d (%d combo%s) | Mods: %s",
|
||||||
getTimeString(), MID, MSID, artist, title, version, creator,
|
getTimeString(), MID, MSID, artist, title, version, creator,
|
||||||
hit300, hit100, hit50, geki, katu, miss, score, combo, perfect ? ", FC" : "", mods
|
hit300, hit100, hit50, geki, katu, miss, score, combo, perfect ? ", FC" : "", getModString()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -353,14 +353,17 @@ public class SongMenu extends BasicGameState {
|
||||||
}
|
}
|
||||||
|
|
||||||
// score buttons
|
// score buttons
|
||||||
|
ScoreData hoverScore = null;
|
||||||
if (focusScores != null) {
|
if (focusScores != null) {
|
||||||
for (int i = 0; i < MAX_SCORE_BUTTONS; i++) {
|
for (int i = 0; i < MAX_SCORE_BUTTONS; i++) {
|
||||||
int rank = startScore + i;
|
int rank = startScore + i;
|
||||||
if (rank >= focusScores.length)
|
if (rank >= focusScores.length)
|
||||||
break;
|
break;
|
||||||
long prevScore = (rank + 1 < focusScores.length) ?
|
long prevScore = (rank + 1 < focusScores.length) ? focusScores[rank + 1].score : -1;
|
||||||
focusScores[rank + 1].score : -1;
|
boolean contains = ScoreData.buttonContains(mouseX, mouseY, i);
|
||||||
focusScores[rank].draw(g, i, rank, prevScore, ScoreData.buttonContains(mouseX, mouseY, i));
|
focusScores[rank].draw(g, i, rank, prevScore, contains);
|
||||||
|
if (contains)
|
||||||
|
hoverScore = focusScores[rank];
|
||||||
}
|
}
|
||||||
|
|
||||||
// scroll bar
|
// scroll bar
|
||||||
|
@ -456,6 +459,10 @@ public class SongMenu extends BasicGameState {
|
||||||
UI.getBackButton().draw();
|
UI.getBackButton().draw();
|
||||||
|
|
||||||
UI.draw(g);
|
UI.draw(g);
|
||||||
|
|
||||||
|
// tooltips
|
||||||
|
if (hoverScore != null)
|
||||||
|
hoverScore.drawTooltip(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user