|
|
|
@ -270,11 +270,11 @@ public abstract class JMacro {
|
|
|
|
|
robot.mouseMove(rect.getCenter().getX(), rect.getCenter().getY());
|
|
|
|
|
delayUnstable();
|
|
|
|
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
|
|
|
|
delay(100);
|
|
|
|
|
delay(60);
|
|
|
|
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
|
|
|
|
delay(100);
|
|
|
|
|
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
|
|
|
|
delay(100);
|
|
|
|
|
delay(60);
|
|
|
|
|
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -796,16 +796,6 @@ public abstract class JMacro {
|
|
|
|
|
return viewRects;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 多图例匹配调用优化
|
|
|
|
|
*
|
|
|
|
|
* @param legends 图例
|
|
|
|
|
* @return 匹配图片
|
|
|
|
|
*/
|
|
|
|
|
public ViewRect[] matchLegends(double minSimilar, String... legends) {
|
|
|
|
|
return matchLegends(legends, minSimilar);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 等待并匹配图例组合
|
|
|
|
|
*
|
|
|
|
@ -832,29 +822,6 @@ public abstract class JMacro {
|
|
|
|
|
}, seconds, TimeUnit.SECONDS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 等待并匹配图例组合
|
|
|
|
|
*
|
|
|
|
|
* @param minSimilar 最低相似度
|
|
|
|
|
* @param seconds 最长等待秒数
|
|
|
|
|
* @param legends 图例组
|
|
|
|
|
* @return 匹配区域
|
|
|
|
|
*/
|
|
|
|
|
public ViewRect[] waitAndMatchLegends(double minSimilar, long seconds, String... legends) {
|
|
|
|
|
return waitAndMatchLegends(legends, minSimilar, seconds);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 等待并匹配图例组合
|
|
|
|
|
*
|
|
|
|
|
* @param minSimilar 最低相似度
|
|
|
|
|
* @param legends 图例组
|
|
|
|
|
* @return 匹配区域
|
|
|
|
|
*/
|
|
|
|
|
public ViewRect[] waitAndMatchLegends(double minSimilar, String... legends) {
|
|
|
|
|
return waitAndMatchLegends(legends, minSimilar, defaultTimeOut);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 等待并匹配图例组合
|
|
|
|
|
*
|
|
|
|
@ -919,7 +886,23 @@ public abstract class JMacro {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查找颜色
|
|
|
|
|
* 指定区域查找颜色值,查到后点击
|
|
|
|
|
*
|
|
|
|
|
* @param color 颜色值例,如:#ffffff
|
|
|
|
|
*/
|
|
|
|
|
public boolean hasColorAndClick(int left, int top, int right, int bottom, String... color) {
|
|
|
|
|
ViewRect viewRect = of(left, top, right, bottom);
|
|
|
|
|
boolean hasColor = hasColor(viewRect, color);
|
|
|
|
|
if (hasColor) {
|
|
|
|
|
mouseLeftClick(viewRect);
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 指定区域查找颜色
|
|
|
|
|
*
|
|
|
|
|
* @param color 颜色值例,如:#ffffff
|
|
|
|
|
* @return 占比
|
|
|
|
@ -929,7 +912,24 @@ public abstract class JMacro {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查找颜色值
|
|
|
|
|
* 指定区域查找颜色值,查到后点击
|
|
|
|
|
*
|
|
|
|
|
* @param rect 查找区域
|
|
|
|
|
* @param color 颜色值例,如:#ffffff
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public boolean hasColorAndClick(ViewRect rect, String... color) {
|
|
|
|
|
boolean hasColor = hasColor(rect, color);
|
|
|
|
|
if (hasColor) {
|
|
|
|
|
mouseLeftClick(rect);
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 指定区域查找颜色值
|
|
|
|
|
*
|
|
|
|
|
* @param rect 查找区域
|
|
|
|
|
* @param color 颜色值例,如:#ffffff
|
|
|
|
@ -1034,6 +1034,15 @@ public abstract class JMacro {
|
|
|
|
|
return new ViewColor(x + ox, y + oy, hexColor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 将相对坐标转为色值坐标
|
|
|
|
|
*
|
|
|
|
|
* @return 绝对坐标
|
|
|
|
|
*/
|
|
|
|
|
public String[] of(String... legends) {
|
|
|
|
|
return legends;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 将相对坐标转为色值坐标
|
|
|
|
|
*
|
|
|
|
|