|
|
|
@ -205,12 +205,14 @@ public class MyRobot{ |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
try { |
|
|
|
|
if (CALIBRATION_MODE) { |
|
|
|
|
if (MyRobot.calibrating) { |
|
|
|
|
MyRobot.calibrating=false; |
|
|
|
|
Overlay.OVERLAY.setVisible(false); |
|
|
|
|
Thread.sleep(1000); |
|
|
|
|
Calibrator c = new Calibrator(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (checkSongSelect()) { |
|
|
|
|
if (!overlayHidden) { |
|
|
|
|
overlayHidden=true; |
|
|
|
@ -240,7 +242,6 @@ public class MyRobot{ |
|
|
|
|
p.repaint(0, 0, 1400, 1000); |
|
|
|
|
} |
|
|
|
|
if ((selectedSong!=null && difficulty!=null)) { |
|
|
|
|
|
|
|
|
|
if (OnResultsScreen() && !recordedResults && !recordingResults && results.size()==0) { |
|
|
|
|
lastSongSelectTime=System.currentTimeMillis(); |
|
|
|
|
MYROBOT.setAutoDelay(0); |
|
|
|
@ -261,7 +262,8 @@ public class MyRobot{ |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
Result data = typeface1.getAllData(MYROBOT.createScoreScreenCapture()); |
|
|
|
|
//ImageIO.write(MYROBOT.createNormalScreenCapture(new Rectangle(418,204,1227,690)),"png",new File("test.png"));
|
|
|
|
|
System.out.println(data); |
|
|
|
|
//ImageIO.write(MYROBOT.,"png",new File("test.png"));
|
|
|
|
|
if (data.cool==-1 || data.fine==-1 || data.safe==-1 || data.sad==-1 || data.worst==-1 || data.percent<0f || data.percent>110f || data.combo==-1 || data.score==-1) { |
|
|
|
|
System.out.println("Waiting for results to populate..."); |
|
|
|
|
} else |
|
|
|
@ -383,15 +385,21 @@ public class MyRobot{ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
MYROBOT.refreshScreen(); |
|
|
|
|
} |
|
|
|
|
} catch (IOException | InterruptedException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean OnResultsScreen() { |
|
|
|
|
Color c1 = new Color(MYROBOT.createScreenCapture(new Rectangle(449,434,2,2)).getRGB(0, 0)); |
|
|
|
|
Color c2 = new Color(MYROBOT.createScreenCapture(new Rectangle(449,400,2,2)).getRGB(0, 0)); |
|
|
|
|
Color c3 = new Color(MYROBOT.createScreenCapture(new Rectangle(901,460,2,2)).getRGB(0, 0)); |
|
|
|
|
private boolean OnResultsScreen() throws IOException { |
|
|
|
|
//r.x-418, r.y-204
|
|
|
|
|
ImageIO.write(MYROBOT.createScreenCapture(new Rectangle(31,230,40,40)),"png",new File("color1.png")); |
|
|
|
|
ImageIO.write(MYROBOT.createScreenCapture(new Rectangle(31,196,40,40)),"png",new File("color2.png")); |
|
|
|
|
ImageIO.write(MYROBOT.createScreenCapture(new Rectangle(483,256,40,40)),"png",new File("color3.png")); |
|
|
|
|
Color c1 = new Color(MYROBOT.createScreenCapture(new Rectangle(31,230,40,40)).getRGB(0, 0)); |
|
|
|
|
Color c2 = new Color(MYROBOT.createScreenCapture(new Rectangle(31,196,40,40)).getRGB(0, 0)); |
|
|
|
|
Color c3 = new Color(MYROBOT.createScreenCapture(new Rectangle(483,256,40,40)).getRGB(0, 0)); |
|
|
|
|
//System.out.println(c1+"/"+c2+"/"+c3);
|
|
|
|
|
return c1.getRed()>=254 && c1.getGreen()>=254 && c1.getBlue()>=254 && c2.getRed()==16 && c2.getGreen()==222 && c2.getBlue()==202 && |
|
|
|
|
c3.getRed()>=219 && c3.getRed()<=255 && c3.getGreen()>=213 && c3.getGreen()<=255 && c3.getBlue()>=160 && c3.getBlue()<=220; |
|
|
|
|
} |
|
|
|
@ -571,6 +579,7 @@ public class MyRobot{ |
|
|
|
|
f.add(OVERLAY); |
|
|
|
|
f.setBackground(new Color(0,0,0,0)); |
|
|
|
|
} else { |
|
|
|
|
RunTests(); |
|
|
|
|
f.setSize(1362, 1036); |
|
|
|
|
f.add(p); |
|
|
|
|
} |
|
|
|
@ -581,12 +590,12 @@ public class MyRobot{ |
|
|
|
|
title.setText((currentSong>=SONGNAMES.length)?"DONE!":SONGNAMES[currentSong].name); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SongData s = SongData.getByTitle(SONGNAMES[currentSong].name); |
|
|
|
|
//SongData s = SongData.getByTitle(SONGNAMES[currentSong].name);
|
|
|
|
|
|
|
|
|
|
BotMain(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void RunTests() throws IOException { |
|
|
|
|
static void RunTests() throws IOException { |
|
|
|
|
|
|
|
|
|
selectedSong=new SongData("LIKE THE WIND",new Color[] {}); |
|
|
|
|
difficulty="H"; |
|
|
|
@ -609,6 +618,7 @@ public class MyRobot{ |
|
|
|
|
RunTest("test16.png",320,46,2,0,4,93.26f,"EXEX","HS",135,463170,false); |
|
|
|
|
RunTest("test17.png",431,30,3,0,3,100.51f,"EXEX","HS",386,581700,false); |
|
|
|
|
RunTest("test18.png",427,86,5,1,4,92.45f,"EX","HS",136,526740,false); |
|
|
|
|
RunTest("test19.png",4,2,2,0,95,0.42f,"EXEX","HS",2,4130,true); |
|
|
|
|
RunTest("testimage.png",371,40,3,4,3,97.63f,"EX","HS",233,523750,false); |
|
|
|
|
RunTest("testimage2.png",942,71,1,0,3,97.02f,"EXEX","",714,951020,false); |
|
|
|
|
RunTest("testimage3.png",546,52,0,0,0,101.77f,"EX","",598,567430,false); |
|
|
|
@ -649,11 +659,11 @@ public class MyRobot{ |
|
|
|
|
RunTest("サマーアイドル.jpg",245,19,4,0,2,87.04f,"E","",103,179360,false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void RunTest(String _img,int _cool,int _fine, int _safe, int _sad, int _worst, float _percent,String _difficulty,String _mod,int _combo,int _score,boolean _fail) throws IOException { |
|
|
|
|
static void RunTest(String _img,int _cool,int _fine, int _safe, int _sad, int _worst, float _percent,String _difficulty,String _mod,int _combo,int _score,boolean _fail) throws IOException { |
|
|
|
|
RunTest(_img,_cool,_fine,_safe,_sad,_worst,_percent,_difficulty,_mod,_combo,_score,_fail,false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void RunTest(String _img,int _cool,int _fine, int _safe, int _sad, int _worst, float _percent,String _difficulty,String _mod,int _combo,int _score,boolean _fail,boolean debug) throws IOException { |
|
|
|
|
static void RunTest(String _img,int _cool,int _fine, int _safe, int _sad, int _worst, float _percent,String _difficulty,String _mod,int _combo,int _score,boolean _fail,boolean debug) throws IOException { |
|
|
|
|
System.out.println("Running test "+_img); |
|
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
|
String testdir="testsuite"; |
|
|
|
@ -671,6 +681,7 @@ public class MyRobot{ |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
Result data = typeface1.getAllData(img,debug); |
|
|
|
|
try { |
|
|
|
|
assert data.cool == _cool : "Expected cool count to be "+_cool+", got "+data.cool; |
|
|
|
|
assert data.fine == _fine : "Expected fine count to be "+_fine+", got "+data.fine; |
|
|
|
|
assert data.safe == _safe : "Expected safe count to be "+_safe+", got "+data.safe; |
|
|
|
@ -682,7 +693,11 @@ public class MyRobot{ |
|
|
|
|
assert data.difficulty == _difficulty : "Expected difficulty to be "+_difficulty+", got "+data.difficulty; |
|
|
|
|
assert data.combo == _combo : "Expected combo to be "+_combo+", got "+data.combo; |
|
|
|
|
assert data.score == _score : "Expected score to be "+_score+", got "+data.score; |
|
|
|
|
System.out.println(" Passed ("+(System.currentTimeMillis()-startTime)+"ms)!"); |
|
|
|
|
} catch(AssertionError e) { |
|
|
|
|
System.err.println("\t"+e.getMessage()+" "+"("+(System.currentTimeMillis()-startTime)+"ms)!"); |
|
|
|
|
System.exit(1); |
|
|
|
|
} |
|
|
|
|
System.out.println("\tPassed ("+(System.currentTimeMillis()-startTime)+"ms)!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static boolean checkSongSelect() throws IOException { |
|
|
|
|