2015-01-29 06:56:30 +01:00
|
|
|
/*
|
|
|
|
* opsu! - an open-source osu! client
|
|
|
|
* Copyright (C) 2014, 2015 Jeffrey Han
|
|
|
|
*
|
|
|
|
* opsu! is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* opsu! is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with opsu!. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package itdelatrisu.opsu;
|
|
|
|
|
|
|
|
import itdelatrisu.opsu.GameData.Grade;
|
|
|
|
import itdelatrisu.opsu.states.SongMenu;
|
2015-08-21 03:14:24 +02:00
|
|
|
import itdelatrisu.opsu.ui.Colors;
|
2015-08-21 03:40:07 +02:00
|
|
|
import itdelatrisu.opsu.ui.Fonts;
|
2015-05-29 07:55:57 +02:00
|
|
|
import itdelatrisu.opsu.ui.UI;
|
2015-09-06 07:44:29 +02:00
|
|
|
import itdelatrisu.opsu.ui.animations.AnimationEquation;
|
2015-01-29 06:56:30 +01:00
|
|
|
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.text.NumberFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.Date;
|
2015-11-30 16:19:25 +01:00
|
|
|
import java.util.Locale;
|
2015-01-29 06:56:30 +01:00
|
|
|
|
|
|
|
import org.newdawn.slick.Color;
|
|
|
|
import org.newdawn.slick.Graphics;
|
|
|
|
import org.newdawn.slick.Image;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class encapsulating and drawing all score data.
|
|
|
|
*/
|
|
|
|
public class ScoreData implements Comparable<ScoreData> {
|
|
|
|
/** The time when the score was achieved (Unix time). */
|
|
|
|
public long timestamp;
|
|
|
|
|
|
|
|
/** The beatmap and beatmap set IDs. */
|
|
|
|
public int MID, MSID;
|
|
|
|
|
|
|
|
/** Beatmap metadata. */
|
|
|
|
public String title, artist, creator, version;
|
|
|
|
|
|
|
|
/** Hit counts. */
|
|
|
|
public int hit300, hit100, hit50, geki, katu, miss;
|
|
|
|
|
|
|
|
/** The score. */
|
|
|
|
public long score;
|
|
|
|
|
|
|
|
/** The max combo. */
|
|
|
|
public int combo;
|
|
|
|
|
|
|
|
/** Whether or not a full combo was achieved. */
|
|
|
|
public boolean perfect;
|
|
|
|
|
|
|
|
/** Game mod bitmask. */
|
|
|
|
public int mods;
|
|
|
|
|
2015-03-12 01:52:51 +01:00
|
|
|
/** The replay string. */
|
|
|
|
public String replayString;
|
2015-03-09 23:32:43 +01:00
|
|
|
|
2015-06-30 02:22:38 +02:00
|
|
|
/** The player name. */
|
|
|
|
public String playerName;
|
|
|
|
|
2015-01-29 09:05:09 +01:00
|
|
|
/** Time since the score was achieved. */
|
|
|
|
private String timeSince;
|
|
|
|
|
2015-01-29 06:56:30 +01:00
|
|
|
/** The grade. */
|
|
|
|
private Grade grade;
|
|
|
|
|
|
|
|
/** The score percent. */
|
|
|
|
private float scorePercent = -1f;
|
|
|
|
|
2015-03-13 05:24:51 +01:00
|
|
|
/** A formatted string of the timestamp. */
|
|
|
|
private String timeString;
|
|
|
|
|
2015-03-13 07:52:18 +01:00
|
|
|
/** The tooltip string. */
|
|
|
|
private String tooltip;
|
2015-03-13 05:24:51 +01:00
|
|
|
|
2015-01-29 06:56:30 +01:00
|
|
|
/** Drawing values. */
|
2015-07-02 01:45:13 +02:00
|
|
|
private static float baseX, baseY, buttonWidth, buttonHeight, buttonOffset, buttonAreaHeight;
|
2015-01-29 06:56:30 +01:00
|
|
|
|
2015-09-17 02:12:47 +02:00
|
|
|
/** The container width. */
|
|
|
|
private static int containerWidth;
|
|
|
|
|
2015-01-29 06:56:30 +01:00
|
|
|
/**
|
|
|
|
* Initializes the base coordinates for drawing.
|
2015-02-16 03:38:54 +01:00
|
|
|
* @param containerWidth the container width
|
|
|
|
* @param topY the top y coordinate
|
2015-01-29 06:56:30 +01:00
|
|
|
*/
|
2015-02-16 03:38:54 +01:00
|
|
|
public static void init(int containerWidth, float topY) {
|
2015-09-17 02:12:47 +02:00
|
|
|
ScoreData.containerWidth = containerWidth;
|
2015-02-16 03:38:54 +01:00
|
|
|
baseX = containerWidth * 0.01f;
|
|
|
|
baseY = topY;
|
|
|
|
buttonWidth = containerWidth * 0.4f;
|
2015-01-29 06:56:30 +01:00
|
|
|
float gradeHeight = GameImage.MENU_BUTTON_BG.getImage().getHeight() * 0.45f;
|
2015-08-21 03:40:07 +02:00
|
|
|
buttonHeight = Math.max(gradeHeight, Fonts.DEFAULT.getLineHeight() * 3.03f);
|
2015-01-29 06:56:30 +01:00
|
|
|
buttonOffset = buttonHeight + gradeHeight / 10f;
|
2015-07-02 01:45:13 +02:00
|
|
|
buttonAreaHeight = (SongMenu.MAX_SCORE_BUTTONS - 1) * buttonOffset + buttonHeight;
|
2015-01-29 06:56:30 +01:00
|
|
|
}
|
|
|
|
|
2015-07-02 01:45:13 +02:00
|
|
|
/**
|
|
|
|
* Returns the Buttons Offset
|
|
|
|
*/
|
2015-09-16 05:20:53 +02:00
|
|
|
public static float getButtonOffset() { return buttonOffset; }
|
|
|
|
|
2015-01-29 06:56:30 +01:00
|
|
|
/**
|
|
|
|
* Returns true if the coordinates are within the bounds of the
|
|
|
|
* button at the given index.
|
|
|
|
* @param cx the x coordinate
|
|
|
|
* @param cy the y coordinate
|
|
|
|
* @param index the index (to offset the button from the topmost button)
|
|
|
|
*/
|
|
|
|
public static boolean buttonContains(float cx, float cy, int index) {
|
|
|
|
float y = baseY + (index * buttonOffset);
|
|
|
|
return ((cx >= 0 && cx < baseX + buttonWidth) &&
|
|
|
|
(cy > y && cy < y + buttonHeight));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the coordinates are within the bounds of the
|
|
|
|
* score button area.
|
|
|
|
* @param cx the x coordinate
|
|
|
|
* @param cy the y coordinate
|
|
|
|
*/
|
|
|
|
public static boolean areaContains(float cx, float cy) {
|
|
|
|
return ((cx >= 0 && cx < baseX + buttonWidth) &&
|
|
|
|
(cy > baseY && cy < baseY + buttonOffset * SongMenu.MAX_SCORE_BUTTONS));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Draws the scroll bar for the score buttons.
|
|
|
|
* @param g the graphics context
|
2015-09-16 05:20:53 +02:00
|
|
|
* @param pos the start button index
|
2015-01-29 06:56:30 +01:00
|
|
|
* @param total the total number of buttons
|
|
|
|
*/
|
2015-07-02 01:45:13 +02:00
|
|
|
public static void drawScrollbar(Graphics g, float pos, float total) {
|
|
|
|
UI.drawScrollbar(g, pos, total, SongMenu.MAX_SCORE_BUTTONS * buttonOffset, 0, baseY,
|
|
|
|
0, buttonAreaHeight, null, Color.white, false);
|
|
|
|
}
|
2015-09-16 05:20:53 +02:00
|
|
|
|
2015-07-02 01:45:13 +02:00
|
|
|
/**
|
2015-09-17 02:12:47 +02:00
|
|
|
* Sets a vertical clip to the area.
|
2015-07-02 01:45:13 +02:00
|
|
|
* @param g the graphics context
|
|
|
|
*/
|
2015-09-17 02:12:47 +02:00
|
|
|
public static void clipToArea(Graphics g) {
|
|
|
|
g.setClip(0, (int) baseY, containerWidth, (int) buttonAreaHeight);
|
2015-01-29 06:56:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-09-10 05:51:16 +02:00
|
|
|
* Creates an empty score data object.
|
2015-01-29 06:56:30 +01:00
|
|
|
*/
|
|
|
|
public ScoreData() {}
|
|
|
|
|
|
|
|
/**
|
2015-09-10 05:51:16 +02:00
|
|
|
* Builds a score data object from a database result set.
|
|
|
|
* @param rs the {@link ResultSet} to read from (at the current cursor position)
|
|
|
|
* @throws SQLException if a database access error occurs or the result set is closed
|
2015-01-29 06:56:30 +01:00
|
|
|
*/
|
|
|
|
public ScoreData(ResultSet rs) throws SQLException {
|
|
|
|
this.timestamp = rs.getLong(1);
|
|
|
|
this.MID = rs.getInt(2);
|
|
|
|
this.MSID = rs.getInt(3);
|
|
|
|
this.title = rs.getString(4);
|
|
|
|
this.artist = rs.getString(5);
|
|
|
|
this.creator = rs.getString(6);
|
|
|
|
this.version = rs.getString(7);
|
|
|
|
this.hit300 = rs.getInt(8);
|
|
|
|
this.hit100 = rs.getInt(9);
|
|
|
|
this.hit50 = rs.getInt(10);
|
|
|
|
this.geki = rs.getInt(11);
|
|
|
|
this.katu = rs.getInt(12);
|
|
|
|
this.miss = rs.getInt(13);
|
|
|
|
this.score = rs.getLong(14);
|
|
|
|
this.combo = rs.getInt(15);
|
|
|
|
this.perfect = rs.getBoolean(16);
|
|
|
|
this.mods = rs.getInt(17);
|
2015-03-12 01:52:51 +01:00
|
|
|
this.replayString = rs.getString(18);
|
2015-04-02 04:10:36 +02:00
|
|
|
this.playerName = rs.getString(19);
|
2015-01-29 06:56:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the timestamp as a string.
|
|
|
|
*/
|
|
|
|
public String getTimeString() {
|
2015-03-13 05:24:51 +01:00
|
|
|
if (timeString == null)
|
|
|
|
timeString = new SimpleDateFormat("M/d/yyyy h:mm:ss a").format(new Date(timestamp * 1000L));
|
|
|
|
return timeString;
|
2015-01-29 06:56:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the raw score percentage based on score data.
|
|
|
|
* @see GameData#getScorePercent(int, int, int, int)
|
|
|
|
*/
|
|
|
|
private float getScorePercent() {
|
|
|
|
if (scorePercent < 0f)
|
|
|
|
scorePercent = GameData.getScorePercent(hit300, hit100, hit50, miss);
|
|
|
|
return scorePercent;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns letter grade based on score data,
|
|
|
|
* or Grade.NULL if no objects have been processed.
|
2015-03-15 20:38:04 +01:00
|
|
|
* @see GameData#getGrade(int, int, int, int, boolean)
|
2015-01-29 06:56:30 +01:00
|
|
|
*/
|
|
|
|
public Grade getGrade() {
|
|
|
|
if (grade == null)
|
2015-03-15 20:38:04 +01:00
|
|
|
grade = GameData.getGrade(hit300, hit100, hit50, miss,
|
|
|
|
((mods & GameMod.HIDDEN.getBit()) > 0 || (mods & GameMod.FLASHLIGHT.getBit()) > 0));
|
2015-01-29 06:56:30 +01:00
|
|
|
return grade;
|
|
|
|
}
|
|
|
|
|
2015-01-29 09:05:09 +01:00
|
|
|
/**
|
|
|
|
* Returns the time since achieving the score, or null if over 24 hours.
|
|
|
|
* This value will not change after the first call.
|
|
|
|
* @return a string: {number}{s|m|h}
|
|
|
|
*/
|
|
|
|
public String getTimeSince() {
|
|
|
|
if (timeSince == null) {
|
|
|
|
long seconds = (System.currentTimeMillis() / 1000L) - timestamp;
|
|
|
|
if (seconds < 60)
|
|
|
|
timeSince = String.format("%ds", seconds);
|
|
|
|
else if (seconds < 3600)
|
|
|
|
timeSince = String.format("%dm", seconds / 60L);
|
|
|
|
else if (seconds < 86400)
|
|
|
|
timeSince = String.format("%dh", seconds / 3600L);
|
|
|
|
else
|
|
|
|
timeSince = "";
|
|
|
|
}
|
|
|
|
return (timeSince.isEmpty()) ? null : timeSince;
|
|
|
|
}
|
|
|
|
|
2015-01-29 06:56:30 +01:00
|
|
|
/**
|
|
|
|
* Draws the score data as a rectangular button.
|
|
|
|
* @param g the graphics context
|
2015-09-16 05:20:53 +02:00
|
|
|
* @param position the index (to offset the button from the topmost button)
|
2015-01-29 06:56:30 +01:00
|
|
|
* @param rank the score rank
|
|
|
|
* @param prevScore the previous (lower) score, or -1 if none
|
|
|
|
* @param focus whether the button is focused
|
2015-09-06 07:44:29 +02:00
|
|
|
* @param t the animation progress [0,1]
|
2015-01-29 06:56:30 +01:00
|
|
|
*/
|
2015-09-15 01:32:18 +02:00
|
|
|
public void draw(Graphics g, float position, int rank, long prevScore, boolean focus, float t) {
|
2015-09-06 07:44:29 +02:00
|
|
|
float x = baseX - buttonWidth * (1 - AnimationEquation.OUT_BACK.calc(t)) / 2.5f;
|
|
|
|
float textX = x + buttonWidth * 0.24f;
|
|
|
|
float edgeX = x + buttonWidth * 0.98f;
|
2015-07-02 01:45:13 +02:00
|
|
|
float y = baseY + position;
|
2015-01-29 09:05:09 +01:00
|
|
|
float midY = y + buttonHeight / 2f;
|
2015-08-21 03:40:07 +02:00
|
|
|
float marginY = Fonts.DEFAULT.getLineHeight() * 0.01f;
|
2015-09-06 07:44:29 +02:00
|
|
|
Color c = Colors.WHITE_FADE;
|
|
|
|
float alpha = t;
|
|
|
|
float oldAlpha = c.a;
|
|
|
|
c.a = alpha;
|
2015-01-29 06:56:30 +01:00
|
|
|
|
|
|
|
// rectangle outline
|
2015-09-06 07:44:29 +02:00
|
|
|
Color rectColor = (focus) ? Colors.BLACK_BG_FOCUS : Colors.BLACK_BG_NORMAL;
|
|
|
|
float oldRectAlpha = rectColor.a;
|
|
|
|
rectColor.a *= AnimationEquation.IN_QUAD.calc(alpha);
|
|
|
|
g.setColor(rectColor);
|
|
|
|
g.fillRect(x, y, buttonWidth, buttonHeight);
|
|
|
|
rectColor.a = oldRectAlpha;
|
2015-01-29 06:56:30 +01:00
|
|
|
|
|
|
|
// rank
|
|
|
|
if (focus) {
|
2015-08-21 03:40:07 +02:00
|
|
|
Fonts.LARGE.drawString(
|
2015-09-06 07:44:29 +02:00
|
|
|
x + buttonWidth * 0.04f,
|
2015-08-21 03:40:07 +02:00
|
|
|
y + (buttonHeight - Fonts.LARGE.getLineHeight()) / 2f,
|
2015-09-06 07:44:29 +02:00
|
|
|
Integer.toString(rank + 1), c
|
2015-01-29 06:56:30 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// grade image
|
2015-09-06 07:44:29 +02:00
|
|
|
Image img = getGrade().getMenuImage();
|
|
|
|
img.setAlpha(alpha);
|
|
|
|
img.drawCentered(x + buttonWidth * 0.15f, midY);
|
|
|
|
img.setAlpha(1f);
|
2015-01-29 06:56:30 +01:00
|
|
|
|
|
|
|
// score
|
2015-08-21 03:40:07 +02:00
|
|
|
float textOffset = (buttonHeight - Fonts.MEDIUM.getLineHeight() - Fonts.SMALL.getLineHeight()) / 2f;
|
2015-09-06 07:44:29 +02:00
|
|
|
Fonts.MEDIUM.drawString(textX, y + textOffset,
|
|
|
|
String.format("Score: %s (%dx)", NumberFormat.getNumberInstance().format(score), combo), c);
|
2015-01-29 06:56:30 +01:00
|
|
|
|
|
|
|
// hit counts (custom: osu! shows user instead, above score)
|
2015-06-30 02:22:38 +02:00
|
|
|
String player = (playerName == null) ? "" : String.format(" (%s)", playerName);
|
2015-09-06 07:44:29 +02:00
|
|
|
Fonts.SMALL.drawString(textX, y + textOffset + Fonts.MEDIUM.getLineHeight(),
|
|
|
|
String.format("300:%d 100:%d 50:%d Miss:%d%s", hit300, hit100, hit50, miss, player), c);
|
2015-01-29 06:56:30 +01:00
|
|
|
|
|
|
|
// mods
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
for (GameMod mod : GameMod.values()) {
|
|
|
|
if ((mod.getBit() & mods) > 0) {
|
|
|
|
sb.append(mod.getAbbreviation());
|
|
|
|
sb.append(',');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sb.length() > 0) {
|
|
|
|
sb.setLength(sb.length() - 1);
|
|
|
|
String modString = sb.toString();
|
2015-09-06 07:44:29 +02:00
|
|
|
Fonts.DEFAULT.drawString(edgeX - Fonts.DEFAULT.getWidth(modString), y + marginY, modString, c);
|
2015-01-29 06:56:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// accuracy
|
|
|
|
String accuracy = String.format("%.2f%%", getScorePercent());
|
2015-09-06 07:44:29 +02:00
|
|
|
Fonts.DEFAULT.drawString(edgeX - Fonts.DEFAULT.getWidth(accuracy), y + marginY + Fonts.DEFAULT.getLineHeight(), accuracy, c);
|
2015-01-29 06:56:30 +01:00
|
|
|
|
|
|
|
// score difference
|
|
|
|
String diff = (prevScore < 0 || score < prevScore) ?
|
|
|
|
"-" : String.format("+%s", NumberFormat.getNumberInstance().format(score - prevScore));
|
2015-09-06 07:44:29 +02:00
|
|
|
Fonts.DEFAULT.drawString(edgeX - Fonts.DEFAULT.getWidth(diff), y + marginY + Fonts.DEFAULT.getLineHeight() * 2, diff, c);
|
2015-01-29 09:05:09 +01:00
|
|
|
|
|
|
|
// time since
|
|
|
|
if (getTimeSince() != null) {
|
|
|
|
Image clock = GameImage.HISTORY.getImage();
|
2015-09-06 07:44:29 +02:00
|
|
|
clock.drawCentered(x + buttonWidth * 1.02f + clock.getWidth() / 2f, midY);
|
2015-08-21 03:40:07 +02:00
|
|
|
Fonts.DEFAULT.drawString(
|
2015-09-06 07:44:29 +02:00
|
|
|
x + buttonWidth * 1.03f + clock.getWidth(),
|
2015-08-21 03:40:07 +02:00
|
|
|
midY - Fonts.DEFAULT.getLineHeight() / 2f,
|
2015-09-06 07:44:29 +02:00
|
|
|
getTimeSince(), c
|
2015-01-29 09:05:09 +01:00
|
|
|
);
|
|
|
|
}
|
2015-09-06 07:44:29 +02:00
|
|
|
|
|
|
|
c.a = oldAlpha;
|
2015-01-29 06:56:30 +01:00
|
|
|
}
|
|
|
|
|
2015-11-29 09:56:10 +01:00
|
|
|
/**
|
2016-10-13 20:41:58 +02:00
|
|
|
* Draws the score in-game (smaller and with less information).
|
2015-11-29 09:56:10 +01:00
|
|
|
* @param g the current graphics context
|
|
|
|
* @param vPos the base y position of the scoreboard
|
|
|
|
* @param rank the current rank of this score
|
|
|
|
* @param position the animated position offset
|
|
|
|
* @param data an instance of GameData to draw rank number
|
2016-10-13 20:41:58 +02:00
|
|
|
* @param alpha the transparency of the score
|
2015-11-29 09:56:10 +01:00
|
|
|
* @param isActive if this score is the one currently played
|
|
|
|
*/
|
|
|
|
public void drawSmall(Graphics g, int vPos, int rank, float position, GameData data, float alpha, boolean isActive) {
|
2016-10-13 20:41:58 +02:00
|
|
|
int rectWidth = (int) (145 * GameImage.getUIscale()); //135
|
2015-11-29 09:56:10 +01:00
|
|
|
int rectHeight = data.getScoreSymbolImage('0').getHeight();
|
|
|
|
int vertDistance = rectHeight + 10;
|
2016-10-13 20:41:58 +02:00
|
|
|
int yPos = (int) (vPos + position * vertDistance - rectHeight / 2);
|
|
|
|
int xPaddingLeft = Math.max(4, (int) (rectWidth * 0.04f));
|
|
|
|
int xPaddingRight = Math.max(2, (int) (rectWidth * 0.02f));
|
|
|
|
int yPadding = Math.max(2, (int) (rectHeight * 0.02f));
|
2015-11-30 16:19:25 +01:00
|
|
|
String scoreString = String.format(Locale.US, "%,d", score);
|
|
|
|
String comboString = String.format("%dx", combo);
|
2015-11-29 09:56:10 +01:00
|
|
|
String rankString = String.format("%d", rank);
|
|
|
|
|
2016-10-13 20:41:58 +02:00
|
|
|
Color white = Colors.WHITE_ALPHA, blue = Colors.BLUE_SCOREBOARD, black = Colors.BLACK_ALPHA;
|
|
|
|
float oldAlphaWhite = white.a, oldAlphaBlue = blue.a, oldAlphaBlack = black.a;
|
|
|
|
|
|
|
|
// rectangle background
|
|
|
|
Color rectColor = isActive ? white : blue;
|
|
|
|
rectColor.a = alpha * 0.2f;
|
2015-11-29 09:56:10 +01:00
|
|
|
g.setColor(rectColor);
|
|
|
|
g.fillRect(0, yPos, rectWidth, rectHeight);
|
2016-10-13 20:41:58 +02:00
|
|
|
black.a = alpha * 0.2f;
|
|
|
|
g.setColor(black);
|
|
|
|
float oldLineWidth = g.getLineWidth();
|
|
|
|
g.setLineWidth(1f);
|
|
|
|
g.drawRect(0, yPos, rectWidth, rectHeight);
|
|
|
|
g.setLineWidth(oldLineWidth);
|
|
|
|
|
|
|
|
// rank
|
|
|
|
data.drawSymbolString(rankString, rectWidth, yPos, 1.0f, alpha * 0.2f, true);
|
|
|
|
|
|
|
|
white.a = blue.a = alpha * 0.75f;
|
|
|
|
|
|
|
|
// player name
|
|
|
|
if (playerName != null)
|
|
|
|
Fonts.MEDIUMBOLD.drawString(xPaddingLeft, yPos + yPadding, playerName, white);
|
|
|
|
|
|
|
|
// score
|
|
|
|
Fonts.DEFAULT.drawString(
|
|
|
|
xPaddingLeft, yPos + rectHeight - Fonts.DEFAULT.getLineHeight() - yPadding, scoreString, white
|
|
|
|
);
|
|
|
|
|
|
|
|
// combo
|
|
|
|
Fonts.DEFAULT.drawString(
|
|
|
|
rectWidth - Fonts.DEFAULT.getWidth(comboString) - xPaddingRight,
|
|
|
|
yPos + rectHeight - Fonts.DEFAULT.getLineHeight() - yPadding,
|
|
|
|
comboString, blue
|
|
|
|
);
|
2015-11-29 09:56:10 +01:00
|
|
|
|
2016-10-13 20:41:58 +02:00
|
|
|
white.a = oldAlphaWhite;
|
|
|
|
blue.a = oldAlphaBlue;
|
|
|
|
black.a = oldAlphaBlack;
|
2015-11-29 09:56:10 +01:00
|
|
|
}
|
|
|
|
|
2015-03-13 05:24:51 +01:00
|
|
|
/**
|
2015-03-13 07:52:18 +01:00
|
|
|
* Returns the tooltip string for this score.
|
2015-03-13 05:24:51 +01:00
|
|
|
*/
|
2015-03-13 07:52:18 +01:00
|
|
|
public String getTooltipString() {
|
|
|
|
if (tooltip == null)
|
|
|
|
tooltip = String.format(
|
|
|
|
"Achieved on %s\n300:%d 100:%d 50:%d Miss:%d\nAccuracy: %.2f%%\nMods: %s",
|
|
|
|
getTimeString(), hit300, hit100, hit50, miss, getScorePercent(), GameMod.getModString(mods));
|
|
|
|
return tooltip;
|
2015-03-13 05:24:51 +01:00
|
|
|
}
|
|
|
|
|
2015-01-29 06:56:30 +01:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return String.format(
|
|
|
|
"%s | ID: (%d, %d) | %s - %s [%s] (by %s) | " +
|
2015-03-13 05:24:51 +01:00
|
|
|
"Hits: (%d, %d, %d, %d, %d, %d) | Score: %d (%d combo%s) | Mods: %s",
|
2015-01-29 06:56:30 +01:00
|
|
|
getTimeString(), MID, MSID, artist, title, version, creator,
|
2015-03-13 07:52:18 +01:00
|
|
|
hit300, hit100, hit50, geki, katu, miss, score, combo, perfect ? ", FC" : "", GameMod.getModString(mods)
|
2015-01-29 06:56:30 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int compareTo(ScoreData that) {
|
|
|
|
if (this.score != that.score)
|
|
|
|
return Long.compare(this.score, that.score);
|
|
|
|
else
|
|
|
|
return Long.compare(this.timestamp, that.timestamp);
|
|
|
|
}
|
2015-02-18 04:49:19 +01:00
|
|
|
}
|