[js]吃金币联机活动:联机有人拒绝时的处理 (#1073)
* Add files via upload * 传送至指定合成台 * Delete repo/js/蒙德合成台.json * Delete repo/js/main.js * Delete repo/js/manifest.json * Delete repo/js/settings.json * Delete repo/js/枫丹合成台.json * Delete repo/js/璃月合成台.json * Delete repo/js/稻妻合成台.json * Update settings.json * 去除main.js里的sleep函数,jsv8引擎不再必报错(maybe) js小白,不要拷打我了😭😭😭 * Update main.js 新增默认选项 * Update settings.json * Update manifest.json * Add files via upload
This commit is contained in:
@@ -123,7 +123,7 @@
|
|||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
|
|
||||||
// 7. 等待并确认匹配
|
// 7. 等待并确认匹配
|
||||||
let matchFound = false;
|
let matchFound = false,matchFound_1st = false;
|
||||||
for (let i = 0; i < 60; i++) { // 最多等待60秒
|
for (let i = 0; i < 60; i++) { // 最多等待60秒
|
||||||
const confirmRegion = captureGameRegion().deriveCrop(
|
const confirmRegion = captureGameRegion().deriveCrop(
|
||||||
1037,
|
1037,
|
||||||
@@ -136,6 +136,15 @@
|
|||||||
const confirmResults = confirmRegion.findMulti(RecognitionObject.ocrThis);
|
const confirmResults = confirmRegion.findMulti(RecognitionObject.ocrThis);
|
||||||
log.info("匹配确认区域OCR识别结果数量: {count}", confirmResults.count);
|
log.info("匹配确认区域OCR识别结果数量: {count}", confirmResults.count);
|
||||||
|
|
||||||
|
/*处理联机确认按钮
|
||||||
|
执行逻辑:(如有报错,自己改 或者 反馈naralan0502@gmail.com)
|
||||||
|
如果OCR识别结果数量等于0,判断是否已经点击过确认按钮(通过变量matchFound_1st确认)
|
||||||
|
是:设置matchFound为true,跳出循环
|
||||||
|
否:继续循环
|
||||||
|
如果OCR识别结果数量大于0,遍历所有识别结果
|
||||||
|
如果存在确认按钮,设置变量matchFound_1st = true
|
||||||
|
*/
|
||||||
|
if(confirmResults.count){
|
||||||
// 遍历所有识别结果
|
// 遍历所有识别结果
|
||||||
for (let j = 0; j < confirmResults.count; j++) {
|
for (let j = 0; j < confirmResults.count; j++) {
|
||||||
const region = confirmResults[j];
|
const region = confirmResults[j];
|
||||||
@@ -143,14 +152,23 @@
|
|||||||
// region.x, region.y, region.width, region.height, region.text);
|
// region.x, region.y, region.width, region.height, region.text);
|
||||||
|
|
||||||
if (region.text.includes("接受")) {
|
if (region.text.includes("接受")) {
|
||||||
log.info("匹配成功, 点击接受");
|
|
||||||
click(1182, 737); // 点击确认按钮
|
click(1182, 737); // 点击确认按钮
|
||||||
|
matchFound_1st = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(matchFound_1st) {
|
||||||
matchFound = true;
|
matchFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchFound) break;
|
if (matchFound) {
|
||||||
|
log.info("匹配成功, 点击接受");
|
||||||
|
break;
|
||||||
|
}
|
||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user