Shortened display of "New Record!". Added miku fc icon.
This commit is contained in:
parent
ef0afa0292
commit
da84bac38e
@ -1,11 +1,11 @@
|
||||
DISPLAYDATA -16765135*-10027060*48*Yu Gothic UI Bold*665*64*10000*Song Title (Japanese+Romanized)|Song Title (English)*80*16**~-16765135*-10027060*48*Yu Gothic UI Light*380*64*10000*Best Play*80*952**~-16765135*-10027060*48*Yu Gothic UI Light*380*64*10000*Overall Rating*560*952**~-16765135*-10027060*48*Yu Gothic UI Light*380*64*10000*Song Difficulty|Pass/Play Count (+%)|FC Count (+%)*1048*952**~-16765135*-10027060*16*Yu Gothic UI Semilight*245*14*10000*Song Artist*504*16*Artist: *
|
||||
LAST_HEIGHT 64
|
||||
LAST_HEIGHT 128
|
||||
WIDTH 1936
|
||||
HEIGHT 1096
|
||||
BACKGROUND -16765135
|
||||
LAST_TEXT -10027060
|
||||
LAST_FONT Yu Gothic UI Bold
|
||||
LAST_FONT Yu Gothic UI Light
|
||||
LAST_FONTSIZE 48
|
||||
LAST_BACKGROUND -16765135
|
||||
LAST_WIDTH 665
|
||||
LAST_WIDTH 380
|
||||
LAST_DELAY 10000
|
||||
|
@ -3,10 +3,13 @@ package sig;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.HashMap;
|
||||
|
||||
import sig.utils.ImageUtils;
|
||||
import sig.utils.TextUtils;
|
||||
|
||||
public class Display {
|
||||
@ -17,6 +20,7 @@ public class Display {
|
||||
Font modifiedfont=font;
|
||||
int x;
|
||||
int y;
|
||||
int modDisplayX=0;
|
||||
int width=200;
|
||||
int height=48;
|
||||
int fontHeight=0;
|
||||
@ -147,7 +151,13 @@ public class Display {
|
||||
modifiedfont = font;
|
||||
Rectangle2D bounds = TextUtils.calculateStringBoundsFont(currentText, font);
|
||||
fontHeight = (int)bounds.getHeight();
|
||||
while (currentSize>1&&bounds.getWidth()>width) {
|
||||
if (labels[cycle].equalsIgnoreCase("Best Play")) {
|
||||
BufferedImage scaledMiku=ImageUtils.toBufferedImage(DrawCanvas.mikuFC.getScaledInstance(-1, height, BufferedImage.SCALE_SMOOTH));
|
||||
modDisplayX = width-scaledMiku.getWidth();
|
||||
} else {
|
||||
modDisplayX = width;
|
||||
}
|
||||
while (currentSize>1&&bounds.getWidth()>modDisplayX) {
|
||||
currentSize-=2;
|
||||
if (currentSize<=1) {break;}
|
||||
modifiedfont = new Font(font.getFontName(),Font.PLAIN,currentSize);
|
||||
@ -162,7 +172,24 @@ public class Display {
|
||||
g.fillRect(x, y, width, height);
|
||||
g.setColor(textCol);
|
||||
g.setFont(modifiedfont);
|
||||
g.drawString(currentText,x,y+height/2+fontHeight/4);
|
||||
DrawCanvas data = MyRobot.p;
|
||||
if (labels[cycle].equalsIgnoreCase("Best Play")) {
|
||||
if (data.bestPlay!=null) {
|
||||
if (data.bestPlay.safe+data.bestPlay.sad+data.bestPlay.worst==0) {
|
||||
if (height>1) {
|
||||
BufferedImage scaledMiku=ImageUtils.toBufferedImage(DrawCanvas.mikuFC.getScaledInstance(-1, height, BufferedImage.SCALE_SMOOTH));
|
||||
g.drawImage(scaledMiku,x,y+height-scaledMiku.getHeight(),MyRobot.p);
|
||||
}
|
||||
g.drawString(currentText,x+width-modDisplayX,y+height/2+fontHeight/4);
|
||||
} else {
|
||||
g.drawString(currentText,x,y+height/2+fontHeight/4);
|
||||
}
|
||||
} else {
|
||||
g.drawString(currentText,x,y+height/2+fontHeight/4);
|
||||
}
|
||||
} else {
|
||||
g.drawString(currentText,x,y+height/2+fontHeight/4);
|
||||
}
|
||||
}
|
||||
|
||||
public String getSaveString() {
|
||||
@ -197,10 +224,18 @@ public class Display {
|
||||
try {
|
||||
switch (string) {
|
||||
case "Best Play":{
|
||||
if (data.bestPlayTime>System.currentTimeMillis()-10000) {
|
||||
if (data.bestPlayTime>System.currentTimeMillis()-5000) {
|
||||
return "New Record!";
|
||||
} else {
|
||||
return header+((data.bestPlay!=null)?data.bestPlay.display():"No plays");
|
||||
if (data.bestPlay!=null) {
|
||||
if (data.bestPlay.safe+data.bestPlay.sad+data.bestPlay.worst==0) {
|
||||
return header+data.bestPlay.display();
|
||||
} else {
|
||||
return header+((data.bestPlay!=null)?data.bestPlay.display():"No plays");
|
||||
}
|
||||
} else {
|
||||
return header+"No plays";
|
||||
}
|
||||
}
|
||||
}
|
||||
case "Overall Rating":{
|
||||
|
@ -66,6 +66,7 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener,
|
||||
Result bestPlay=null;
|
||||
int overallrating = 0;
|
||||
BufferedImage addConfigButton,backgroundColorButton,reloadSongButton;
|
||||
static BufferedImage mikuFC;
|
||||
long ratingTime = System.currentTimeMillis()-10000;
|
||||
long bestPlayTime = System.currentTimeMillis()-10000;
|
||||
int lastRating = -1;
|
||||
@ -89,6 +90,7 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener,
|
||||
addConfigButton = ImageIO.read(new File("addDisplay.png"));
|
||||
backgroundColorButton = ImageIO.read(new File("backgroundCol.png"));
|
||||
reloadSongButton = ImageIO.read(new File("reloadSong.png"));
|
||||
mikuFC = ImageIO.read(new File("mikufc.png"));
|
||||
Thread t = new Thread() {
|
||||
public void run() {
|
||||
while (true) {
|
||||
@ -129,10 +131,6 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener,
|
||||
t = new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
/*JSONObject obj = FileUtils.readJsonArrayFromUrl("http://45.33.13.215:4501/song/"+URLEncoder.encode(MyRobot.p.songname, StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20")).getJSONObject(0);
|
||||
romanizedname = obj.getString("romanized_name");
|
||||
englishname = obj.getString("english_name");
|
||||
artist = obj.getString("artist");*/
|
||||
if (MyRobot.p.songname!=null) {
|
||||
SongInfo currentSong = SongInfo.getByTitle(MyRobot.p.songname);
|
||||
//FileUtils.writetoFile(new String[] {MyRobot.p.songname}, "testencode.txt");
|
||||
@ -164,19 +162,6 @@ public class DrawCanvas extends JPanel implements KeyListener,ComponentListener,
|
||||
if (obj.has("fccount")) {
|
||||
fcCount = obj.getInt("fccount");
|
||||
}
|
||||
/*obj = FileUtils.readJsonFromUrl("http://45.33.13.215:4501/rating/"+MyRobot.USERNAME);
|
||||
lastRating = overallrating;
|
||||
overallrating = (int)obj.getDouble("rating");
|
||||
if (lastRating<overallrating) {ratingTime=System.currentTimeMillis();}
|
||||
*/
|
||||
//String text = songname+" / "+((romanizedname.length()>0)?romanizedname:englishname)+" "+(artist.length()>0?"by "+artist:"")+" "+((plays>0)?("Plays - "+(passes)+"/"+(plays)):"")+" "+((plays!=0)?"("+((int)(Math.floor(((float)passes)/plays*100)))+"% pass rate"+((fcCount>0)?" - "+fcCount+" FC"+(fcCount==1?"":"s")+" "+((int)(Math.floor(((float)fcCount)/plays*100)))+"% FC rate":"")+")":"No plays")+" "+((bestPlay!=null)?"Best Play - "+bestPlay.display():"")+" Overall Rating: "+overallrating;
|
||||
/*Rectangle2D bounds = TextUtils.calculateStringBoundsFont(text, programFont);
|
||||
if (bounds.getWidth()>1345) {
|
||||
scrolling=true;
|
||||
} else {
|
||||
scrolling=false;
|
||||
}
|
||||
scrollX = 0;*/
|
||||
MyRobot.p.repaint();
|
||||
MyRobot.p.refreshAllLabels();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user