|
|
@ -3,10 +3,13 @@ package sig; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Font; |
|
|
|
import java.awt.Font; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.Graphics; |
|
|
|
|
|
|
|
import java.awt.Image; |
|
|
|
import java.awt.Rectangle; |
|
|
|
import java.awt.Rectangle; |
|
|
|
import java.awt.geom.Rectangle2D; |
|
|
|
import java.awt.geom.Rectangle2D; |
|
|
|
|
|
|
|
import java.awt.image.BufferedImage; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import sig.utils.ImageUtils; |
|
|
|
import sig.utils.TextUtils; |
|
|
|
import sig.utils.TextUtils; |
|
|
|
|
|
|
|
|
|
|
|
public class Display { |
|
|
|
public class Display { |
|
|
@ -17,6 +20,7 @@ public class Display { |
|
|
|
Font modifiedfont=font; |
|
|
|
Font modifiedfont=font; |
|
|
|
int x; |
|
|
|
int x; |
|
|
|
int y; |
|
|
|
int y; |
|
|
|
|
|
|
|
int modDisplayX=0; |
|
|
|
int width=200; |
|
|
|
int width=200; |
|
|
|
int height=48; |
|
|
|
int height=48; |
|
|
|
int fontHeight=0; |
|
|
|
int fontHeight=0; |
|
|
@ -147,7 +151,13 @@ public class Display { |
|
|
|
modifiedfont = font; |
|
|
|
modifiedfont = font; |
|
|
|
Rectangle2D bounds = TextUtils.calculateStringBoundsFont(currentText, font); |
|
|
|
Rectangle2D bounds = TextUtils.calculateStringBoundsFont(currentText, font); |
|
|
|
fontHeight = (int)bounds.getHeight(); |
|
|
|
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; |
|
|
|
currentSize-=2; |
|
|
|
if (currentSize<=1) {break;} |
|
|
|
if (currentSize<=1) {break;} |
|
|
|
modifiedfont = new Font(font.getFontName(),Font.PLAIN,currentSize); |
|
|
|
modifiedfont = new Font(font.getFontName(),Font.PLAIN,currentSize); |
|
|
@ -162,8 +172,25 @@ public class Display { |
|
|
|
g.fillRect(x, y, width, height); |
|
|
|
g.fillRect(x, y, width, height); |
|
|
|
g.setColor(textCol); |
|
|
|
g.setColor(textCol); |
|
|
|
g.setFont(modifiedfont); |
|
|
|
g.setFont(modifiedfont); |
|
|
|
|
|
|
|
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); |
|
|
|
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() { |
|
|
|
public String getSaveString() { |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
@ -197,11 +224,19 @@ public class Display { |
|
|
|
try { |
|
|
|
try { |
|
|
|
switch (string) { |
|
|
|
switch (string) { |
|
|
|
case "Best Play":{ |
|
|
|
case "Best Play":{ |
|
|
|
if (data.bestPlayTime>System.currentTimeMillis()-10000) { |
|
|
|
if (data.bestPlayTime>System.currentTimeMillis()-5000) { |
|
|
|
return "New Record!"; |
|
|
|
return "New Record!"; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (data.bestPlay!=null) { |
|
|
|
|
|
|
|
if (data.bestPlay.safe+data.bestPlay.sad+data.bestPlay.worst==0) { |
|
|
|
|
|
|
|
return header+data.bestPlay.display(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return header+((data.bestPlay!=null)?data.bestPlay.display():"No plays"); |
|
|
|
return header+((data.bestPlay!=null)?data.bestPlay.display():"No plays"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return header+"No plays"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
case "Overall Rating":{ |
|
|
|
case "Overall Rating":{ |
|
|
|
if (data.ratingTime>System.currentTimeMillis()-10000) { |
|
|
|
if (data.ratingTime>System.currentTimeMillis()-10000) { |
|
|
|